what we'll need to do is from some sort of command is we'll have to create a SecondaryTile. This secondary tile is going to require four things
- TileId (unique string)
- Arguments (App specific arguments to pass to your app when the tile is activate to let your app know what to do once it starts)
- DisplayName (the name )
- Tile Icon the image the tile will show
with those four set
var sc = new SecondaryTile
{
TileId = TileId,
Arguments = Arguments,
DisplayName = DisplayName
};
sc.VisualElements.Square150x150Logo
= new Uri("ms-appx:///Assets/logo.png");
sc.VisualElements.ShowNameOnSquare150x150Logo
= true;
await sc.RequestCreateAsync()
public Action GetPinAction(string TileId, string Arguments, string DisplayName)
{
return async () => {
var sc = new SecondaryTile
{
TileId = TileId,
Arguments = Arguments,
DisplayName = DisplayName
};
sc.VisualElements.Square150x150Logo = new Uri("ms-appx:///Assets/logo.png");
sc.VisualElements.ShowNameOnSquare150x150Logo = true;
if (await sc.RequestCreateAsync())
this.OnPropertyChanged("ShowPinToStart");
};
}
this.PinToStartCommand = new RelayCommand(base.GetPinAction(String.Format("{0}&{1}&{2}", this.RouteName, FromStationId, ToStationId), "Station", this.Title));
protected async override void OnLaunched(LaunchActivatedEventArgs e)
In that method use the parameter to create a switch statement to hanlde your various Secondary Tile App launches,
switch(e.Arguments)
{
case "Route":
rootFrame.Navigate(typeof(RoutePage), e.TileId);
break;
case "Station":
rootFrame.Navigate(typeof(StationPage), e.TileId);
break;
}