C++ handler code for posting a secondary tile RRS feed

  • Question

  • I am trying to figure out the proper piece of code to create a secondary title in response to the user clicking a "Pin" button in the app bar.  Here is what I have.  Can someone correct this code?void GroupedItemsPage::Pin_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
        // Prepare package images for use as the Tile Logo and small logo in the tile to be pinned.
        // The path provided is a relative path to the package
        auto logo = ref new Uri("ms-appx:///Assets/StoreLogo.png");
        auto smallLogo = ref new Uri("ms-appx:///Assets/smallLogo.png");
        //Calendar^ cal = ref new Calendar();
        //auto longtime = ref new DateTimeFormatter("longtime");
        //DateTime time = cal->GetDateTime();
        Data::SmartRecorderSession^ session =
        // During creation of secondary tile, an application may set additional arguments on the tile that will be passed in during activation.
        // These arguments should be meaningful to the application. In this sample, we will just pass a text as an argument.
        String^ tileActivationArguments = "Session " + session->folder->Path ;

        auto secondaryTile = ref new SecondaryTile("Session",
            "Title text shown on the tile",
            "Name of the tile the user sees when searching for the tile",

        // The tile background color is inherited from the parent unless a separate value is specified.
        // This operation will over-ride the default.
        secondaryTile->ForegroundText = ForegroundText::Dark;

        // Like the background color, the small tile logo is inherited from the parent application tile by default.
        // This operation will over-ride the default.
        secondaryTile->SmallLogo = smallLogo;

        // OK, the tile is created and we can now attempt to pin the tile.
        // Note that the status message is updated when the async operation to pin the tile completes.

        auto const rect = GetElementRect(safe_cast<FrameworkElement^>(sender));
            create_task(secondaryTile->RequestCreateForSelectionAsync(rect, Windows::UI::Popups::Placement::Below)).then([this](bool isCreated)
                if (isCreated)
                    //rootPage->NotifyUser("Secondary tile successfully pinned.", NotifyType::StatusMessage);
                    //rootPage->NotifyUser("Secondary tile not pinned.", NotifyType::ErrorMessage);

    - Ken

    Saturday, August 18, 2012 10:33 PM

All replies

  • Hello Ken,

    Is there a specific problem that you are having setting your secondary tile or are you just looking for a code review of working code?


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Tuesday, August 21, 2012 12:53 AM