Here some of the Code Snippets which will be useful for developing Metro Style Store Apps
Toast Message :
var templateType = ToastTemplateType.ToastImageAndText02;
var toastTemplate = ToastNotificationManager.GetTemplateContent(templateType);
toastTemplate.GetElementsByTagName(“text”)[0].AppendChild(toastTemplate.CreateTextNode(“Toast Message From My App”));
toastTemplate.GetElementsByTagName(“image”)[1].AppendChild(toastTemplate.CreateTextNode(“Toast Message From My App”));
var toast = new ToastNotification(toastTemplate);
ToastNotificationManager.CreateToastNotifier().Show(toast);
Sharing Data between Apps :
Initialize this in the App.xaml.cs
var transferManager = DataTransferManager.GetForCurrentView();
transferManager.DataRequested += OnShareDataRequested;
//OnShareDataRequested Event
var request = e.Request;
var package = new DataPackage();
package.Properties.Title = “Shared from My Application”;
package.Properties.Description = “Information regarding disposition of search”;
StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder;
var file = await folder.CreateFileAsync(“Nirmal.txt”);
List
files.Add(file);
// To Share a File
package.SetStorageItems(files);
// To Share a Text
package.SetText(“Sharing some text from My Apps”);
request.Data = package;
Secondary Tile Creation :
var uri = new Uri(item.TileImagePath.AbsoluteUri);
var tile = new SecondaryTile(
item.UniqueId, // Tile ID
item.ShortTitle, // Tile short name
item.Title, // Tile display name
item.UniqueId, // Activation argument
TileOptions.ShowNameOnLogo, // Tile options
uri // Tile logo URI
);
await tile.RequestCreateAsync();