0

我在我的应用程序中使用辅助磁贴一切正常,但不幸的是,当我从辅助磁贴启动我的应用程序时,它会打开开始屏幕,我已经搜索并且我知道我必须编辑我的 App.cs 需要捕获 tileActivationArguments但我不知道如何正确地做到这一点。请我需要你的帮助谢谢。

这是我用来固定的代码

private async void btnpin_Click_1(object sender, RoutedEventArgs e)
{
    //mantenmos abierta el appbar
    this.miappbar.IsSticky = true;

    //obtenemos la imagen del .json y la mostramos en la nota
    Uri logo = new Uri(pequeniaImagen);
    Uri smalllogo = new Uri(pequeniaImagen);

    //creamos el secondary tile
    SecondaryTile secondary = new SecondaryTile(logoSecondaryTileld, String.Format("{0} {1:d}",pageTitle.Text,Convert.ToDateTime(tvFecha.Text)),pageTitle.Text,logoSecondaryTileld, TileOptions.ShowNameOnLogo,logo);

    secondary.DisplayName =pageTitle.Text;//nombre de la nota

    //obtenemos el color de fondo del secondary tile
    SolidColorBrush brush= Editor.returnColorfromString(Mcolor);
    secondary.BackgroundColor = brush.Color;

    //color del texto
    secondary.ForegroundText = ForegroundText.Dark;

    bool isPinned = await secondary.RequestCreateForSelectionAsync(detalles.GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Below);
    //el usuario pinieo la nota

    if (isPinned)
    {
        //ocultamos el btn pin
        btnpin.Visibility = Visibility.Collapsed;

        //mostramos el btn unpin
        btnunpin.Visibility = Visibility.Visible;
    }

    this.miappbar.IsSticky = false;
}

这是我的 App.cs 代码

if (rootFrame.Content == null)
{
    if (!String.IsNullOrEmpty(args.Arguments))
        rootFrame.Navigate(typeof(detalles), args.Arguments);  
    else
        rootFrame.Navigate(typeof(GroupedItemsPage));
}
else    
{
    if (!String.IsNullOrEmpty(args.Arguments))
        rootFrame.Navigate(typeof(detalles), args.Arguments);
    else
        rootFrame.Navigate(typeof(GroupedItemsPage));
}
4

1 回答 1

0

你的代码是正确的,我认为会有问题args.Argumentsif由于参数不正确,可能不满足条件。

于 2013-06-01T04:22:00.363 回答