SecondaryTile 클래스

SecondaryTile Class

보조 타일에 대한 정보를 만들고 열거하고 제공합니다.

구문


var secondaryTile = new Windows.UI.StartScreen.SecondaryTile();
var secondaryTile = new Windows.UI.StartScreen.SecondaryTile(string);
var secondaryTile = new Windows.UI.StartScreen.SecondaryTile(string, string, string, uri, tileSize);
var secondaryTile = new Windows.UI.StartScreen.SecondaryTile(string, string, string, string, tileOptions, uri);
var secondaryTile = new Windows.UI.StartScreen.SecondaryTile(string, string, string, string, tileOptions, uri, uri);

특성

[Muse()]
[Version(0x06020000)]

멤버

SecondaryTile클래스에는 다음과 같은 형식의 멤버가 있습니다.

생성자

SecondaryTile클래스에는 다음과 같은 생성자가 있습니다.

생성자Description
SecondaryTile() Creates a SecondaryTile object. The caller must then set any mandatory properties through the object before attempting to pin, update, or delete the tile.
SecondaryTile(String) Creates a SecondaryTile object with a specific ID. This form of the constructor should be used to create a secondary tile object to perform a tile update or deletion.
SecondaryTile(String, String, String, String, TileOptions, Uri) Creates a SecondaryTile object as a medium tile.
SecondaryTile(String, String, String, String, TileOptions, Uri, Uri) Creates a SecondaryTile object as a wide tile.
SecondaryTile(String, String, String, Uri, TileSize) Creates a SecondaryTile object that includes all of the mandatory properties required to create a medium tile.

 

이벤트

SecondaryTile클래스에는 다음과 같은 이벤트가 있습니다.

이벤트Description
VisualElementsRequested Fired when a call is made to RequestCreateAsync.

 

메서드

The SecondaryTile 클래스 - 이러한 메서드가 있습니다. C#, Visual Basic 및 C++에서는 다음 위치의 메서드도 상속합니다. Object 클래스.

메서드Description
Exists Checks whether a specific secondary tile exists for the calling app.
FindAllAsync() Retrieves a list of secondary tiles created for the calling app.
FindAllAsync(String) Retrieves a list of secondary tiles created for another app in the same package as the calling app.
FindAllForPackageAsync Retrieves a list of secondary tiles created for all of the apps in the package of the calling app.
RequestCreateAsync() Displays the Pin to Start flyout, through which the user can confirm that they want to create the secondary tile. Overloads of this method let you specify the on-screen location of the flyout.
RequestCreateAsync(Point) Displays the Pin to Start flyout above a specified location, through which the user can confirm that they want to create the secondary tile.
RequestCreateForSelectionAsync(Rect) Displays the Pin to Start flyout above a specified area. This flyout is used by the user to confirm that they want to create the secondary tile.
RequestCreateForSelectionAsync(Rect, Placement) Displays the Pin to Start flyout at the specified side of a specified area. This flyout is used by the user to confirm that they want to create the secondary tile.
RequestDeleteAsync() Displays the Unpin from Start flyout. This flyout lets the user confirm removal of the secondary tile.
RequestDeleteAsync(Point) Displays the Unpin from Start flyout at a specified point. This flyout lets the user confirm removal of the secondary tile.
RequestDeleteForSelectionAsync(Rect) Displays the Unpin from Start flyout above a specified area. This flyout lets the user confirm removal of the secondary tile.
RequestDeleteForSelectionAsync(Rect, Placement) Displays the Unpin from Start flyout at the specified side of a specified area. This flyout lets the user confirm removal of the secondary tile.
UpdateAsync Updates a secondary tile after that tile is pinned to the Start screen.

 

속성

SecondaryTile클래스 - 이러한 속성이 있습니다.

속성사용 권한Description

Arguments

읽기/쓰기Gets or sets an app-defined set of information that is passed from the secondary tile to the app on activation. This property is required when you create a tile.

BackgroundColor

읽기/쓰기Gets or sets the tile's background color.

DisplayName

읽기/쓰기Gets or sets a long name that is associated and displayed with the tile. This name is displayed on the tile in Start, in the tile's tooltip, next to the small tile representation in the Apps list, and in some Control Panel applications. This property is required when you create a tile.

ForegroundText

읽기/쓰기Gets or sets whether the tile should use dark or light text.

LockScreenBadgeLogo

읽기/쓰기Gets or sets the location of a badge logo image to represent the secondary tile on the lock screen. By supplying this image, you declare that the secondary tile is eligible to display a badge on the lock screen.

LockScreenDisplayBadgeAndTileText

읽기/쓰기Gets or sets whether the secondary tile is eligible to display both a badge and a detailed tile on the lock screen.

Logo

읽기/쓰기Gets or sets the logo image used in a medium tile. This property is required when you create either a square or a wide tile.

PhoneticName

읽기/쓰기Gets or sets a phonetic version of the secondary tile name. Used with character-based languages for UI sorting purposes.

RoamingEnabled

읽기/쓰기Gets or sets a value that determines whether the secondary tile will be reacquired through the cloud when the parent app is installed by the user, using their Microsoft account, on another computer.

ShortName

읽기/쓰기Gets or sets a short name to display directly on the tile. As of Windows 8.1, the short name is not used.

SmallLogo

읽기/쓰기Gets or sets the small logo image, used in search results, the All Programs list, and other locations in the UI.

TileId

읽기/쓰기Gets or sets a unique string to identify the tile within the package. This property is required when you create or delete a tile.

TileOptions

읽기/쓰기Gets or sets options available to a secondary tile.

VisualElements

읽기 전용Gets an object through which you can get or set a secondary tile's background color, foreground text, tile images, and app name display options.

WideLogo

읽기/쓰기Gets or sets the logo image used in a wide tile. This property is required when you create a wide tile.

 

예제

다음 예제에서는 보조 타일을 만들어서 시작 화면에 고정합니다.



// Prepare package images for use as the Tile Logo and Small Logo in our tile to be pinned.
var uriLogo = new Windows.Foundation.Uri("ms-appx:///images/SecondaryTileDefault-sdk.png");
var uriSmallLogo = new Windows.Foundation.Uri("ms-appx:///images/smallLogoSecondaryTile-sdk.png");

// Create a tile to be be pinned.

// During creation of secondary tiles, an application can set additional arguments on the tile 
// that will be passed in during activation. These arguments should be meaningful to the application. 
// In this example, we'll pass in the date and time that the Secondary Tile was pinned.
var currentTime = new Date();
var tileActivationArguments = "timeTileWasPinned=" + currentTime;

// Specify the short name to display on the tile, the display name, arguments to be passed in 
// during activation, attributes regarding how to display the tile by default, and the tile logo.
// Note that you should pick a unique ID that is descriptive and meaningful to your application. 
// In this case, we explicitly code a single ID to focus our attention on the pinning operation.

var tile = new Windows.UI.StartScreen.SecondaryTile("SecondaryTile.01", 
                                                    "A Secondary Tile", 
                                                    "Secondary Tile Sample Secondary Tile", 
                                                    tileActivationArguments, 
                                                    Windows.UI.StartScreen.TileOptions.showNameOnLogo, 
                                                    uriLogo);

// Specify a foreground text value.
// The secondary tile background color over which this text is shown is inherited from the 
// parent app unless a separate value is specified.
tile.foregroundText = Windows.UI.StartScreen.ForegroundText.dark;

// The small tile logo is inherited from the parent app unless overridden as we do here.
tile.smallLogo = uriSmallLogo;

// Attempt to pin the tile.
// Note that the status message is updated when the async operation to pin the tile completes.

tile.requestCreateAsync().then(function (isCreated) {
    if (isCreated) {
        // Secondary tile successfully pinned.
    } else {
        // Secondary tile not pinned.
    }
});

다음 예제에서는 RequestDeleteAsync 메서드를 사용하여 보조 타일을 삭제(고정 해제)하는 방법을 보여 줍니다. 이 예제에서는 타일이 있다고 가정합니다. RequestDeleteAsync를 호출하기 전에 타일이 고정되었는지 여부를 확인하려면 Exists 메서드를 확인하십시오.



// Specify the secondary tile to be deleted, using the ID that it was given when it was originally created.
var tileToBeDeleted = new Windows.UI.StartScreen.SecondaryTile("SecondaryTile.01");

// Make the delete request.
tileToBeDeleted.requestDeleteAsync().then(function (isDeleted) {
    if (isDeleted) {
        // Secondary tile successfully deleted.
    } else {
        // Secondary tile not deleted.
    }
});

다음 예제에서는 FindAllForPackageAsync 메서드를 사용하여 동일 패키지에 있는 호출 앱과 다른 앱에 대해 생성된 모든 보조 타일의 ID 목록을 검색하는 방법을 보여 줍니다.



Windows.UI.StartScreen.SecondaryTile.findAllForPackageAsync().done(function (tiles) {
    tiles.forEach(function (tile) {
        var myTileId = tile.tileId;
        // Continue to process as necessary.
    });
});

다음 예제에서는 TileUpdateManager.createTileUpdaterForSecondaryTile 메서드를 사용하여 ID가 "SecondaryTile.Dynamic"인 보조 타일로 알림을 보내는 방법을 보여 줍니다. 사용자는 표시할 타일 형식을 제어할 수 있으므로 직사각형 및 정사각형 버전의 알림을 둘 다 제공합니다.



var notifications = Windows.UI.Notifications;

// Define the notification content.
var tileXml = notifications.TileUpdateManager.getTemplateContent(notifications.TileTemplateType.tileWide310x150Text04);
var tileTextAttributes = tileXml.getElementsByTagName("text");
tileTextAttributes[0].appendChild(tileXml.createTextNode("Sent to a secondary tile!"));

// Provide a square version of the notification.
var squareTileXml = notifications.TileUpdateManager.getTemplateContent(notifications.TileTemplateType.tileSquare150x150Text04);
var squareTileTextAttributes = squareTileXml.getElementsByTagName("text");
squareTileTextAttributes[0].appendChild(squareTileXml.createTextNode("Sent to a secondary tile!"));

// Add the medium tile to the notification.
var node = tileXml.importNode(squareTileXml.getElementsByTagName("binding").item(0), true);
tileXml.getElementsByTagName("visual").item(0).appendChild(node);

// Create the notification based on the XML content.
var tileNotification = new notifications.TileNotification(tileXml);

// Create a secondary tile updater, passing it the ID of the tile.
var tileUpdater = notifications.TileUpdateManager.createTileUpdaterForSecondaryTile("SecondaryTile.Dynamic");

// Send the notification to the secondary tile.
tileUpdater.update(tileNotification);

다음 예제에서는 BadgeUpdateManager.createBadgeUpdaterForSecondaryTile 메서드를 사용하여 ID가 "SecondaryTile.Dynamic"인 보조 타일로 숫자 배지 알림을 보내는 방법을 보여 줍니다.



var notifications = Windows.UI.Notifications;

// Define the badge content
var badgeNotification = notifications.BadgeUpdateManager.getTemplateContent(notifications.BadgeTemplateType.badgeNumber);
var badgeAttributes = badgeNotification.getElementsByTagName("badge");
badgeAttributes[0].setAttribute("value", "6");

// Create the notification based on the XML content.
var badge = new notifications.BadgeNotification(badgeNotification);

// Create a secondary tile updater, passing it the ID of the tile.
notifications.BadgeUpdateManager.createBadgeUpdaterForSecondaryTile("SecondaryTile.Dynamic");

// Send the notification to the secondary tile.
tileUpdater.update(tileNotification);

요구 사항

지원되는 최소 클라이언트

Windows 8 [Windows 스토어 앱만]

지원되는 최소 서버

Windows Server 2012 [Windows 스토어 앱만]

Namespace

Windows.UI.StartScreen
Windows::UI::StartScreen [C++]

Metadata

Windows.winmd

참고 항목

보조 타일 샘플

 

 

표시:
© 2017 Microsoft