0

現在、ユーザーがタイルをスタート メニューにピン留めおよびピン留め解除できる Windows ストア アプリがあります。背景とロゴとテキストを設定できますが、問題は、タイルをテキスト付きの静的なロゴではなく、ライブ タイルにしたいことです。

そのため、片側から画像だけを表示し、裏返すと、反対側が私のアプリ情報になります。通常のライブ タイルと xml を使用してこれを実行できることはわかっていますが、私は c# を使用しており、セカンダリ タイルでこれを機能させたいと考えています。

それをどうやって進めるかについての助けは素晴らしいでしょう。

セカンダリ タイルの作成に使用したコードを次に示します。

private async void PinButton_OnClick (オブジェクト送信者、RoutedEventArgs e) { var item = createdItem.SelectedItem;

if (item != null)
{
    var logo = new Uri(item.image);
    if (item != null)
    {
        var smallLogo = new Uri(item.image);
        var wideLogo = new Uri(item.image);
    }

    string tileActivationArguments = logoSecondaryTileId + "WasPinnedAt=" +
                                     DateTime.Now.ToLocalTime();
    logoSecondaryTileId = item.ID+ counter.ToString();
    counter++;

    //Create the tile
    SecondaryTile tile = new SecondaryTile(logoSecondaryTileId, item.Code, item.FirstName + " " + item.LastName,
        tileActivationArguments, TileOptions.ShowNameOnLogo | TileOptions.ShowNameOnWideLogo, logo);

    if (item.SelectedItem is Details)
    {

        tile.ForegroundText = ForegroundText.Light;
        tile.BackgroundColor = Colors.Black;


        bool isPinned =
            await
                tile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement)sender),
                    Placement.Default);


        if (isPinned)
        {
            Messages.InvokeToast(Toast.Created);
            UnpinButton.Visibility = Visibility.Visible;
            pinButton.Visibility = Visibility.Collapsed;
        }
        else
        {
            Messages.InvokeToast(Toast.Error);
        }

        if (SecondaryTile.Exists(logoSecondaryTileId))
        {
            var dialog = new MessageDialog("Already exists!")
            {
                Title = "Unable to Pin Tile!"
            };
            dialog.Commands.Add(new UICommand("Okay", new UICommandInvokedHandler(CommandHandler)));
            dialog.CancelCommandIndex = 1;
            await dialog.ShowAsync();
        }

    }
}
}
4

1 に答える 1