Code52 / MarkPadRT

168 stars 51 forks source link

Pin individual documents as tiles #16

Closed ghost closed 12 years ago

ghost commented 12 years ago

First example I could find, via: http://www.silverlightshow.net/items/Windows-8-and-the-future-of-XAML-Part-6-Tiles-toasts-and-badges.aspx

 Uri logo = new Uri("ms-appx:///assets/small.png");
    Uri smallLogo = new Uri("ms-appx:///assets/secondary.png");

    string tileActivationArguments = "timeTileWasPinned=" + DateTime.Now.ToLocalTime().ToString();

    // Create a 1x1 Secondary tile
    SecondaryTile secondaryTile = new SecondaryTile("AppSecondaryTile",
                                                    "Next webinar",
                                                    "",
                                                    tileActivationArguments,
                                                    TileOptions.ShowNameOnLogo,
                                                    smallLogo);

    secondaryTile.ForegroundText = ForegroundText.Light;

    bool isPinned = await secondaryTile.RequestCreateForSelectionAsync
        (GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Right);
ghost commented 12 years ago

Needs to be handled in App.OnLaunched via the LaunchActivatedEventArgs.Arguments.

The easiest way is to pass a token indicating an object in StorageApplicationPermissions.FutureAccessList

ghost commented 12 years ago

SecondaryTile.FindAllAsync() will return a list of current tiles for the app. This means when closing a document, it should only be removed from the FutureAccessList if its not pinned (relates to #11)