public static void UpdateTile(ShellTileData tileUpdateData) { // there's always at least one tile, the main tile, which is first var mainTile = ShellTile.ActiveTiles.ElementAt(0); mainTile.Update(tileUpdateData); }
public void SFlipTileTemplate() { Profile profil = JsonConvert.DeserializeObject <Profile>(iso.Read("profile.json")); //ShellTile oTile = ShellTile.ActiveTiles.First(); ShellTile oTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("flip".ToString())); if (oTile != null && oTile.NavigationUri.ToString().Contains("flip")) { FlipTileData oFliptile = new FlipTileData(); oFliptile.Title = "Old Gaming Quiz"; oFliptile.Count = profil.SolvedCount; oFliptile.BackTitle = profil.SolvedCount.ToString() + " ScreenShot Solved"; //oFliptile.BackContent = (30 - profil.solvedQuestion).ToString() + " Surah remaining"; oFliptile.BackContent = profil.SolvedCount.ToString() + " ScreenShot Solved"; oFliptile.WideBackContent = profil.SolvedCount.ToString() + " ScreenShot Solved"; oFliptile.SmallBackgroundImage = new Uri("/Assets/Tiles/159.png", UriKind.Relative); oFliptile.BackgroundImage = new Uri("/Assets/Tiles/336.png", UriKind.Relative); oFliptile.WideBackgroundImage = new Uri("/Assets/Tiles/691.png", UriKind.Relative); oFliptile.BackBackgroundImage = new Uri("/Assets/Tiles/336Back.png", UriKind.Relative); oFliptile.WideBackBackgroundImage = new Uri("/Assets/Tiles/691Back.png", UriKind.Relative); oTile.Update(oFliptile); } else { //once it is created flip tile MessageBox.Show("Tile Successfully Created"); Uri tileUri = new Uri("/MainPage.xaml?tile=flip", UriKind.Relative); ShellTileData tileData = this.CreateFlipTileData(); ShellTile.Create(tileUri, tileData, true); } }
public static void UpdateSecondaryTile(int count) { Uri tileUri = new Uri(string.Concat("/MainPage.xaml?", IconicTileQuery), UriKind.Relative); ShellTileData tileData = CreateIconicTileData(); ShellTile iconicTile = FindTile(IconicTileQuery); if (iconicTile != null) { iconicTile.Update(tileData); } }
public static void UpdatePrimaryTile(int count, string content) { //FlipTileData primaryTileData = new FlipTileData(); //primaryTileData.Count = count; //primaryTileData.BackContent = content; ShellTileData tileData = CreateIconicTileData(); ShellTile primaryTile = ShellTile.ActiveTiles.First(); primaryTile.Update(tileData); }
// Constructor public MainPage() { InitializeComponent(); ShellTile PinnedTile = ShellTile.ActiveTiles.First(); ShellTileData tileData = this.CreateFlipTileData(); PinnedTile.Update(tileData); // Sample code to localize the ApplicationBar //BuildLocalizedApplicationBar(); }
public void UpdateFilpLiveTitle(string navigationUrl, string title, string backTitle, string backContent, string wideBackContent, string smallBackgroundImage, string backgroundImage, string wideBackgroundImage, string backBackgroundImage, string wideBackBackgroundImage) { if (CheckLiveTitleExistByUrl(navigationUrl)) { //Exist title and update ShellTile indexTitle = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(navigationUrl)); ShellTileData titleData = CreateFilpTitleData(title, backTitle, backContent, wideBackContent, smallBackgroundImage, backgroundImage, wideBackgroundImage, backBackgroundImage, wideBackBackgroundImage); indexTitle.Update(titleData); } }
private void PinToStart_Click(object sender, EventArgs e) { var viewModel = ForView.Unwrap <ScheduleViewModel>(DataContext); if (viewModel == null) { return; } ShellTileData tileData = viewModel.GetTileData(); ShellTile.Create(NavigationService.CurrentSource, tileData); }
private void PinImage(ImageModel image) { if (flipTileDataManager.DeskContainsImage(image)) { flipTileDataManager.Update(image); MessageBox.Show(AppResources.UpdateSuccessfullyMsg, AppResources.Alert, MessageBoxButton.OK); } else { ShellTileData tileData = flipTileDataManager.Create(image); ShellTile.Create(new Uri("/MainPage.xaml?image=" + image.url, UriKind.Relative), tileData, true); } }
private static void InternalUpdateTile(ShellTileData tile) { var t = ShellTile.ActiveTiles.FirstOrDefault(); if (t == null) return; try { t.Update(tile); } catch { } }
private void btnPinSecondary_Click(object sender, EventArgs e) { if (Config.IsTargetedVersion) { // Get the new cycleTileData type. Type cycleTileDataType = Type.GetType("Microsoft.Phone.Shell.CycleTileData, Microsoft.Phone"); // Get the ShellTile type so we can call the new version of "Update" that takes the new Tile templates. Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone"); // Get the constructor for the new FlipTileData class and assign it to our variable to hold the Tile properties. var UpdateTileData = cycleTileDataType.GetConstructor(new Type[] { }).Invoke(null); Uri smallimage = new Uri("Images/CycleSmall.png", UriKind.Relative); Uri mediumimage = new Uri("Images/CycleMedium.png", UriKind.Relative); // Set the properties. SetProperty(UpdateTileData, "SmallBackgroundImage", smallimage); Uri[] mediumImages = new Uri[1]; mediumImages[0] = mediumimage; SetProperty(UpdateTileData, "CycleImages", mediumImages); SetProperty(UpdateTileData, "Title", SelectedCinema.Name); ShellTileData tiledata = UpdateTileData as ShellTileData; // Create the Tile and pin it to Start. This will cause a navigation to Start and a deactivation of our application. //ShellTile.Create(new Uri(String.Format("/CinemaDetails.xaml?CinemaID={0}&Region={1}&cycle", SelectedCinema.ID, Config.Region.ToString("d")), UriKind.Relative), tiledata); // Invoke the new version of ShellTile.Update. shellTileType.GetMethod("Create", new Type[] { typeof(Uri), typeof(ShellTileData), typeof(bool) }).Invoke(null, new Object[] { new Uri(String.Format("/CinemaDetails.xaml?CinemaID={0}&Region={1}", SelectedCinema.ID, Config.Region.ToString("d")), UriKind.Relative), tiledata, true }); } else { StandardTileData standardTileData = new StandardTileData { Title = "my cineworld", BackgroundImage = new Uri("Images/AppTile.png", UriKind.Relative), BackContent = SelectedCinema.Name }; // Create the Tile and pin it to Start. This will cause a navigation to Start and a deactivation of our application. ShellTile.Create(new Uri(String.Format("/CinemaDetails.xaml?CinemaID={0}&Region={1}", SelectedCinema.ID, Config.Region.ToString("d")), UriKind.Relative), standardTileData); } }
private static void UpdateOrCreateTile(string tileId, ShellTileData tileData, bool createIfNotExists) { ShellTile tileToUpdate = ShellTile.ActiveTiles.FirstOrDefault(t => t.NavigationUri.OriginalString.Contains(tileId)); if (tileToUpdate == null && createIfNotExists) { //NOTE: The main tile always exists, even if it's not pinned, so we don't need to worry about reaching this code for the main tile. ShellTile.Create(new Uri( string.Format("/MainPage.xaml?id={0}", tileId), UriKind.Relative), tileData, true); } else if (tileToUpdate != null) { tileToUpdate.Update(tileData); } }
private void ApplicationBarIconButton_OnClick(object sender, EventArgs e) { Uri tileUri = new Uri(string.Concat("/MainPage.xaml?", IconicTileQuery), UriKind.Relative); ShellTileData tileData = CreateIconicTileData(); ShellTile iconicTile = this.FindTile(IconicTileQuery); if (iconicTile != null) { iconicTile.Delete(); ShellTile.Create(tileUri, tileData, true); StartPeriodicAgent(); } else { ShellTile.Create(tileUri, tileData, true); StartPeriodicAgent(); } ShellTile primaryTile = ShellTile.ActiveTiles.FirstOrDefault(); primaryTile.Update(tileData); }
private static void UpdateOrCreateTile(string tileId, ShellTileData tileData, bool createIfNotExists) { //TODO: 2.2 - Update or Create the desired live tile // Retrieve the ShellTile tileToUpdate by calling ShellTile.ActiveTiles and grabing the first where shellTile.NavigationUri.OriginalString.Contains(tileId) // If the tile to update is null and createIfNotExists == true then use ShellTile.Create() to create the tile. // Use string.Format("/MainPage.xaml?id={0}", tileId) for the navigationUri // Pass tileData for the initialData arg // Pass true for supportsWideTile // Else if tileToUpdate != null // Call tileToUpdate.Update passing tileData ShellTile tileToUpdate = ShellTile.ActiveTiles.FirstOrDefault(t => t.NavigationUri.OriginalString.Contains(tileId)); if (tileToUpdate == null && createIfNotExists) { //NOTE: The main tile always exists, even if it's not pinned, so we don't need to worry about reaching this code for the main tile. ShellTile.Create(new Uri(string.Format("/MainPage.xaml?id={0}", tileId), UriKind.Relative), tileData, true); } else if (tileToUpdate != null) { tileToUpdate.Update(tileData); } }
private static void UpdateOrCreateTile(string tileId, ShellTileData tileData, bool createIfNotExists) { //TODO: 2.2 - Update or Create the desired live tile // Retrieve the ShellTile tileToUpdate by calling ShellTile.ActiveTiles and grabing the first where shellTile.NavigationUri.OriginalString.Contains(tileId) // If the tile to update is null and createIfNotExists == true then use ShellTile.Create() to create the tile. // Use string.Format("/MainPage.xaml?id={0}", tileId) for the navigationUri // Pass tileData for the initialData arg // Pass true for supportsWideTile // Else if tileToUpdate != null // Call tileToUpdate.Update passing tileData ShellTile tileToUpdate = ShellTile.ActiveTiles.FirstOrDefault(t => t.NavigationUri.OriginalString.Contains(tileId)); if (tileToUpdate == null && createIfNotExists) { //NOTE: The main tile always exists, even if it's not pinned, so we don't need to worry about reaching this code for the main tile. ShellTile.Create(new Uri(string.Format("/MainPage.xaml?id={0}", tileId), UriKind.Relative), tileData, true); } else if (tileToUpdate != null) { tileToUpdate.Update(tileData); } }
public void CreateTile(string url, ShellTileData tileData, bool supportsWideTile) { ShellTile.Create(new Uri(url, UriKind.Relative), tileData, supportsWideTile); }
public static void Pin(Uri uri, ShellTileData initialData) { // Create the tile and pin to start. This will cause the app to be deactivated ShellTile.Create(uri, initialData); }
// Do whatever action the button requested public void DoTileAction(string tileAction, Uri tileId, ShellTile tileToFind, ShellTileData tileData) { switch (tileAction) { case "create": ShellTile.Create(tileId, tileData, true); break; case "update": tileToFind.Update(tileData); break; case "delete": tileToFind.Delete(); break; } }
public void Update(ShellTileData data) { shelltile.Update(data); }
public void Create(Uri navigationUri, ShellTileData initialData) { ShellTile.Create(navigationUri, initialData); }
private void OnReverseGeocodeUpdated(object sender, EventArgs e) { var response = (sender as ReverseGeocode).Results; var localityName = ""; if (null != response) { foreach ( var result in response.Where(result => result.types.Contains("sublocality") && result.types.Contains("political"))) { localityName = result.formatted_address; break; } if ("" == localityName) { foreach (var address_component in response.SelectMany(result => result.address_components.Where( address_component => address_component.types.Contains("locality") && address_component.types.Contains("political")))) { localityName = address_component.long_name; break; } } } map.Dispatcher.BeginInvoke(() => { var usCultureInfo = new CultureInfo("en-US"); var latitude = map.Center.Latitude.ToString(usCultureInfo.NumberFormat); var longitude = map.Center.Longitude.ToString(usCultureInfo.NumberFormat); var zoom = map.ZoomLevel.ToString(usCultureInfo.NumberFormat); var tileParam = "Lat=" + latitude + "&Lon=" + longitude + "&Zoom=" + zoom; if (null != App.CheckIfTileExists(tileParam)) { return; } using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { foreach (var layer in map.Children.OfType <MapLayer>()) { layer.Visibility = Visibility.Collapsed; } var fileName = "/Shared/ShellContent/" + tileParam + ".jpg"; if (store.FileExists(fileName)) { store.DeleteFile(fileName); } using (var saveFileStream = new IsolatedStorageFileStream(fileName, FileMode.Create, store)) { var b = new WriteableBitmap(173, 173); var offsetX = (map.ActualWidth - 173) / 2; var offsetY = (map.ActualHeight - 173) / 2; b.Render(map, new TranslateTransform { X = -offsetX, Y = -offsetY, }); b.Invalidate(); b.SaveJpeg(saveFileStream, b.PixelWidth, b.PixelHeight, 0, 100); } var widefileName = "/Shared/ShellContent/" + tileParam + "_wide.jpg"; if (store.FileExists(widefileName)) { store.DeleteFile(widefileName); } using (var saveFileStream = new IsolatedStorageFileStream(widefileName, FileMode.Create, store)) { var b = new WriteableBitmap(691, 336); var scale = 691 / map.ActualWidth; var offsetX = ((map.ActualWidth) / 2) * scale; var offsetY = ((map.ActualHeight * scale - 336) / 2); //map.Width = 691; b.Render(map, new CompositeTransform { CenterX = .5, CenterY = .5, ScaleX = scale, ScaleY = scale, TranslateX = 0, TranslateY = -offsetY, }); b.Invalidate(); b.SaveJpeg(saveFileStream, b.PixelWidth, b.PixelHeight, 0, 100); } // 691 x 336 foreach (var layer in map.Children.OfType <MapLayer>()) { layer.Visibility = Visibility.Visible; } } ShellTileData shellTileData = null; var shellTileUri = new Uri("/MainPage.xaml?" + tileParam, UriKind.Relative); if (App.LeastVersionIs78) { var shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone"); var appTileData = App.CreateFlipTileData(); // Set the properties. App.SetProperty(appTileData, "Title", null); App.SetProperty(appTileData, "Count", 0); App.SetProperty(appTileData, "SmallBackgroundImage", null); App.SetProperty(appTileData, "BackgroundImage", new Uri("isostore:/Shared/ShellContent/" + tileParam + ".jpg", UriKind.Absolute)); App.SetProperty(appTileData, "BackContent", localityName); App.SetProperty(appTileData, "BackTitle", "FreeCars"); App.SetProperty(appTileData, "BackBackgroundImage", null); App.SetProperty(appTileData, "WideBackContent", localityName); App.SetProperty(appTileData, "WideBackgroundImage", new Uri("isostore:/Shared/ShellContent/" + tileParam + "_wide.jpg", UriKind.Absolute)); App.SetProperty(appTileData, "WideBackBackgroundImage", null); var m = shellTileType.GetMethod("Create", new[] { typeof(Uri), typeof(ShellTileData), typeof(bool) }); var r = m.Invoke(null, new[] { shellTileUri, appTileData, true }); } else { shellTileData = new StandardTileData { BackTitle = "FreeCars", BackContent = localityName, Count = 0, BackgroundImage = new Uri("isostore:/Shared/ShellContent/" + tileParam + ".jpg", UriKind.Absolute), }; ShellTile.Create(shellTileUri, shellTileData); } }); }