private ManualResetEvent UpdateUserLiveTile(string p, ShellTile shellTile) { var lck = new ManualResetEvent(false); FBEntity.FindByID<User>(p, user => { if (user != null) { user.GetStatuses(statuses => { var first = statuses.FirstOrDefault(); if (first != null) { LiveTileHelper.UpdateUserTileStatus(shellTile, user, first); } lck.Set(); }); } else { lck.Set(); } }); return lck; }
/// <summary> /// Agent that runs a scheduled task /// </summary> /// <param name="task"> /// The invoked task /// </param> /// <remarks> /// This method is called when a periodic or resource intensive task is invoked /// </remarks> protected override async void OnInvoke(ScheduledTask task) { //TODO: Add code to perform your task in background ShellTile appTile = ShellTile.ActiveTiles.First(); FlipTileData tileData; try { string nu = await Omegle.Client.getNumberOfUsers() + "\nusers online"; tileData = new FlipTileData() { BackContent = await Omegle.Client.getNumberOfUsers() + "\nusers online", BackTitle = "Omeddle", Title = "Omeddle", WideBackContent = await Omegle.Client.getNumberOfUsers() + "\nusers online" }; } catch { tileData = new FlipTileData() { BackContent = "Connection error", BackTitle = "Omeddle", Title = "Omeddle", WideBackContent = "Connection error" }; } appTile.Update(tileData); NotifyComplete(); }
private static ShellTile FindTile(string partOfUri) { ShellTile shellTile = ShellTile.ActiveTiles.FirstOrDefault( tile => tile.NavigationUri.ToString().Contains(partOfUri)); return(shellTile); }
public static void UpdateUserTileStatus(ShellTile shellTile, User user, FeedItem first) { shellTile.Update(new StandardTileData { BackBackgroundImage = GenerateUserTileBackBackgroundImage(user, first) }); }
//Method to create Tile public static void createOrUpdateTile() { IconicTileData oIcontile = new IconicTileData(); oIcontile.Title = modelTile + ": " + valueTile; //oIcontile.Count = indexItem; oIcontile.IconImage = new Uri("/Assets/Tiles/Iconic/IconicSmall.png", UriKind.Relative); oIcontile.SmallIconImage = new Uri("/Assets/Tiles/Iconic/FlipCycleSmall.png", UriKind.Relative); oIcontile.WideContent1 = "Value: " + valueTile; oIcontile.WideContent2 = "Currency: " + currencyTile; oIcontile.WideContent3 = "Last Update: " + updateTile; oIcontile.BackgroundColor = new Color { A = 255, R = 0, G = 0, B = 0 }; //new Color { A = 255, R = 0, G = 148, B = 255 }; ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Iconic".ToString())); //Update if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains("Iconic")) { //tileToFind.Delete(); tileToFind.Update(oIcontile); //ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true); } //Create new else { ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true); } }
void MainPage_BackKeyPress() { try { ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(); List <Article> articles = new List <Article>(); Article art = new Article(); try { articles = (List <Article>)userSettings["Articles"]; art = articles[0]; articles.RemoveAt(0); } catch (Exception ex) { return; } HelperMetjods.UpdateOrAdd(userSettings, "Articles", articles); WikiParser.WikiArticleParser w = new WikiParser.WikiArticleParser(art.ArticleName, art.MainContent, art.ArticleLink, art.ImageLinks); HelperMetjods.UpdateCurrentArticleStorage(w); Uri bg = null; try { bg = new Uri(w.ImageLinks[0].Replace("150px", "250px"), UriKind.Absolute); } catch { bg = new Uri("http://dl.dropbox.com/u/109923/wiki.png", UriKind.Absolute); } if (w.ArticleName.Length > 15) { w.ArticleName = w.ArticleName.Substring(0, 15) + "..."; } //test if Tile was created if (TileToFind != null) { TileToFind.Update(new StandardTileData { Title = w.ArticleName, BackgroundImage = bg, Count = 0, BackTitle = w.ArticleName, BackBackgroundImage = new Uri("http://dl.dropbox.com/u/109923/wiki.png", UriKind.Absolute) }); } } catch (Exception ex) { int a = 1; } }
/// <summary> /// Agent that runs a scheduled task /// </summary> /// <param name="task"> /// The invoked task /// </param> /// <remarks> /// This method is called when a periodic or resource intensive task is invoked /// </remarks> protected override void OnInvoke(ScheduledTask task) { System.Diagnostics.Debug.WriteLine("Launching the agent..."); int cleared = -1; if (getSetting("clean")) { var fires = getIntSetting("taskFireCount"); System.Diagnostics.Debug.WriteLine("Task fire count: " + fires); if (fires > 48) { //only run ever 48 launches, or about 24 hours setSetting("taskFireCount", 0); //Clean cache cleared = CacheClearer.cleanCache.clearAll(); if (getSetting("toast")) { ShellToast toast = new ShellToast(); toast.Content = "Cleared " + CacheClearer.Utils.readableFileSize(cleared); toast.Title = "CacheClearer"; toast.Show(); } } else { setSetting("taskFireCount", fires + 1); } } if (getSetting("updatetile")) { if (cleared >= 0) { BackTitle = "Cache cleared"; BackContent = DateTime.Now.ToString() + "\n" + CacheClearer.Utils.readableFileSize(cleared); } else { uint bytes = CacheClearer.cleanCache.getTotalCacheSize(); BackContent = DateTime.Now.ToString() + "\n" + CacheClearer.Utils.readableFileSize(bytes); BackTitle = "Cache Size"; } // Execute periodic task actions here. ShellTile TileToFind = ShellTile.ActiveTiles.First(); if (TileToFind != null) { StandardTileData NewTileData = new StandardTileData { BackContent = BackContent, BackTitle = BackTitle }; TileToFind.Update(NewTileData); } } NotifyComplete(); }
private async void RenderTrackingControlsUIAsync() { if (Globals.CurrentProfile.IsSOSOn) { PanicStatusText.Text = "ON"; PanicSubText.Text = Globals.IsRegisteredUser ? "Your buddies have been informed" : string.Empty; PanicButton.Background = new SolidColorBrush(Color.FromArgb(255, 0x10, 0xAA, 0x1E)); var appBarButton = ApplicationBar.Buttons[0] as ApplicationBarIconButton; appBarButton.IconUri = new Uri("/Assets/Images/stopsos.png", UriKind.Relative); appBarButton.Text = "stop sos"; } else { PanicStatusText.Text = "OFF"; PanicSubText.Text = "Tap this, if you are threatened"; PanicButton.Background = new SolidColorBrush(Color.FromArgb(255, 0xF9, 0x65, 0x11)); var appBarButton = ApplicationBar.Buttons[0] as ApplicationBarIconButton; appBarButton.IconUri = new Uri("/Assets/Images/sos.png", UriKind.Relative); appBarButton.Text = "start sos"; } if (Globals.CurrentProfile.IsTrackingOn) { TrackmeStatus.Text = "ON"; TrackTileImage.Source = new BitmapImage(new Uri("./Assets/TrackMeOn.png", UriKind.Relative)); TrackMeButton.Background = new SolidColorBrush(Color.FromArgb(255, 0x10, 0xAA, 0x1E)); var appBarButton = ApplicationBar.Buttons[1] as ApplicationBarIconButton; appBarButton.IconUri = new Uri("/Assets/Images/stoptrack.png", UriKind.Relative); appBarButton.Text = "stop tracking"; } else { TrackmeStatus.Text = "OFF"; TrackTileImage.Source = new BitmapImage(new Uri("./Assets/TrackMeOff.png", UriKind.Relative)); TrackMeButton.Background = new SolidColorBrush(Color.FromArgb(255, 0xF9, 0x65, 0x11)); var appBarButton = ApplicationBar.Buttons[1] as ApplicationBarIconButton; appBarButton.IconUri = new Uri("/Assets/Images/track.png", UriKind.Relative); appBarButton.Text = "start tracking"; } ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("DefaultTitle=SOSTile")); //Disable the application bar item if tile exits //if (TileToFind != null) //{ // ((ApplicationBarMenuItem)ApplicationBar.MenuItems[0]).IsEnabled = false; //Not able to access the control with Name. So have to go with this only! this is some known bug(http://www.learningwindowsphone.com/blog/?p=62) //} if (Globals.IsRegisteredUser) { //Assigning static soscount to Locate tile data SOSCountTextBlock.Text = SOSCountTextBlockData; TrackingCountTextBlock.Text = TrackingCountTextBlockData; } }
/// <summary> /// Updates application live tile /// </summary> public void updateTile(string options) { string[] args = JsonHelper.Deserialize <string[]>(options); string callbackId = args[1]; LiveTilesOptions liveTileOptions; try { liveTileOptions = JsonHelper.Deserialize <LiveTilesOptions>(args[0]); } catch (Exception) { DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION), callbackId); return; } try { ShellTile appTile = ShellTile.ActiveTiles.First(); if (appTile != null) { if (liveTileOptions.tileType == "iconic") { IconicTileData TileData = CreateIconicTileData(liveTileOptions); appTile.Update(TileData); DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId); } else if (liveTileOptions.tileType == "standard") { StandardTileData TileData = CreateStandardTileData(liveTileOptions); appTile.Update(TileData); DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId); } else if (liveTileOptions.tileType == "flip") { FlipTileData TileData = CreateFlipTileData(liveTileOptions); appTile.Update(TileData); DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId); } else { //StandardTileData TileData = CreateStandardTileData(liveTileOptions); //appTile.Update(TileData); //DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId); DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "tileType not defined"), callbackId); } } else { DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Can't get application tile"), callbackId); } } catch (Exception) { DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error updating application tile"), callbackId); } }
private async void CreateTile(string navSource, TileInfo tileInfo) { await CheckRemoteImages(tileInfo); var tileData = GetStandardTileData(tileInfo); ShellTile.Create(new Uri(navSource, UriKind.Relative), tileData); }
public bool ColumnTileIsCreated(TwitterResource Resource) { ShellTile ColumnTile = ShellTile.ActiveTiles.FirstOrDefault(item => item != null && !string.IsNullOrWhiteSpace(item.NavigationUri.ToString()) && item.NavigationUri.ToString().Contains(Uri.EscapeDataString(Resource.String))); return(ColumnTile != null); }
static private async void CreateTile(string url, TileInfo tileInfo) { await PopulateImages(tileInfo); var tileData = CreateTileData(tileInfo); ShellTile.Create(new Uri(url, UriKind.Relative), tileData); }
static private async void CreateTile(string url, TileInfo tileInfo) { await PopulateImages(tileInfo); var tileData = CreateTileData(tileInfo); ShellTile.Create(new Uri(url, UriKind.Relative), tileData, !string.IsNullOrEmpty(tileInfo.WideBackgroundImagePath)); }
private void ClearTileCounter() { ShellTile appTile = ShellTile.ActiveTiles.First(); appTile.Update(new StandardTileData() { Count = 0 }); }
public void ClearTiles() { ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(); var data = new StandardTileData(); data.Count = 0; data.BackContent = string.Empty; tile.Update(data); }
private void btnAtualizar_Click(object sender, RoutedEventArgs e) { ShellTile tile = ShellTile.ActiveTiles.First(); StandardTileData dados = new StandardTileData(); dados.Title = txtNome.Text; dados.Count = 2; tile.Update(dados); }
public void Update(ImageModel image) { Debug.WriteLine(image.id); // create a newTileData. var newTileData = Create(image); ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(image.url)); tile.Update(newTileData); }
// Creates a Tile for the current page and pins it to the start screen private void PinApplicationBar_Click(object sender, EventArgs e) { FlipTileData tileData = new FlipTileData(); // Use these variables to search the existing Tiles so we don't pin the same page twice. ShellTile currentTile = ShellTile.ActiveTiles.First(); String currentURI = currentTile.NavigationUri.ToString(); String browserSource = Browser.Source.ToString(); int activeTilesCount = ShellTile.ActiveTiles.Count(); Boolean tileFound = false; int activeTilesIndex = 0; // Search the active Tiles to see if the page is already pinned. while (activeTilesIndex < activeTilesCount) { if (currentURI.Contains(browserSource)) { // Found the current page in the collection of pinned tiles. tileFound = true; break; } else { if (++activeTilesIndex < activeTilesCount) { currentTile = ShellTile.ActiveTiles.ElementAt(activeTilesIndex); currentURI = currentTile.NavigationUri.ToString(); } } } // The page is already pinned if (tileFound) { // Show an error message and return. MessageBox.Show("This page is already pinned."); return; } // Uses the current date and time to create a unique title for this tile. // You'll want to use a title that better reflects your app and web site pages. tileData.Title = DateTime.Now.ToString(); // This is only an example. You must insert your own Tile image. tileData.BackgroundImage = new Uri("/Assets/Tiles/PinnedTile.png", UriKind.Relative); try { ShellTile.Create(new Uri("/gord.xaml?StartURL=" + Browser.Source.ToString(), UriKind.Relative), tileData, false); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void Tile_Update(string Type) { //No Tile was found, so add one for this page. //most displays cut off the 16th charactor, this reduces it to 13 + ... for the Edit page and LiveTile string liveTitle = curTitle; if (curTitle.Length > 24) { liveTitle = curTitle.Substring(0, 21) + "..."; } var settings = IsolatedStorageSettings.ApplicationSettings; //Conditional LiveTile Updates depending on the settings (past due w/ no due date, past due w/o no due date, total count int count = 0; if (GTaskSettings.LiveTileCount > 0) { if (GTaskSettings.IncludeNoDueDate) { count = (int)settings["DueCount_" + Id]; } else { count = (int)settings["DueNDCount_" + Id]; } } else { count = (int)settings["Count_" + Id]; } var tileData = new StandardTileData { Title = liveTitle, BackgroundImage = new Uri("/Assets/Icons/202.png", UriKind.Relative), Count = count }; if (Type == "Create") { //Create the tile ShellTile.Create(new Uri(("/Views/TaskView.xaml?Id=" + Id + "&Title=" + curTitle + "&From=Tile"), UriKind.Relative), tileData); //When a tile is pinned, Start the PeriodicAgent to update counts every hour StartPeriodicAgent(); //#DEBUG Runs in 1500 milliseconds after pinning a tile if not comment out if (Debugger.IsAttached) { var taskName = "MyTask"; ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromMilliseconds(1500)); } } else if (Type == "Update") { //Update the tile with the latest TileData (e.g. New Title) var tile = ShellTile.ActiveTiles.FirstOrDefault(o => o.NavigationUri.ToString().Contains(Id)); tile.Update(tileData); } }
public void UpdateTile() { Debug.WriteLine("Live tile updating"); const string filename = "/Shared/ShellContent/CustomTile.png"; const string wideFilename = "/Shared/ShellContent/CustomTileWide.png"; //create small tile using (var isf = IsolatedStorageFile.GetUserStoreForApplication()) { if (!isf.DirectoryExists("/CustomLiveTiles")) { isf.CreateDirectory("/CustomLiveTiles"); } using (var stream = isf.OpenFile(filename, System.IO.FileMode.OpenOrCreate)) { //bmp.SaveJpeg(stream, 336, 366, 0, 100); getBmp().WritePNG(stream); } //create large tile using (var stream = isf.OpenFile(wideFilename, System.IO.FileMode.OpenOrCreate)) { getWideBmp().WritePNG(stream); } } //update try { FlipTileData tileData = new FlipTileData { BackgroundImage = new Uri("isostore:" + filename, UriKind.Absolute), }; ShellTile tile = ShellTile.ActiveTiles.First(); if (null != tile) { foreach (var sec in ShellTile.ActiveTiles) { FlipTileData data = new FlipTileData(); // tile foreground data data.BackgroundImage = new Uri("isostore:" + filename, UriKind.Absolute); data.WideBackgroundImage = new Uri("isostore:" + wideFilename, UriKind.Absolute); // update tile sec.Update(data); } // create a new data for tile } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } }
private async Task LoadCinemaDetails() { Task taskCinemaFilmListing = null; if (SelectedFilm.Performances == null || SelectedFilm.Performances.Count == 0) { taskCinemaFilmListing = new LocalStorageHelper().GetCinemaFilmListings(SelectedCinema.ID); } if (pMain.Items.Contains(piFilmDetails)) { this.pMain.Items.Remove(piFilmDetails); } if (pMain.Items.Contains(piCast)) { this.pMain.Items.Remove(piCast); } if (pMain.Items.Contains(piReviews)) { this.pMain.Items.Remove(piReviews); } if (!pMain.Items.Contains(piCinema)) { pMain.Items.Add(piCinema); } ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(String.Format("CinemaID={0}", SelectedCinema.ID))); this.ApplicationBar.Buttons.Add(this.abibDirections); if (TileToFind == null) { this.ApplicationBar.Buttons.Add(this.abibPin); } if (Config.FavCinemas.Contains(SelectedCinema.ID)) { this.ApplicationBar.Buttons.Add(this.abibRemFav); } else { this.ApplicationBar.Buttons.Add(this.abibAddFav); } this.ApplicationBar.Buttons.Add(this.abibShare); if (taskCinemaFilmListing != null) { await taskCinemaFilmListing; SelectedFilm = App.CinemaFilms[SelectedCinema.ID].First(f => f.EDI == SelectedFilm.EDI); } }
public static void PinTabToStart(Tab tab) { bool tileExists = FindTile(TileNavigationUrl + tab.Id); if (!tileExists) { StandardTileData tileData = GetSecondaryTileData(tab); ShellTile.Create(new Uri(TileNavigationUrl + tab.Id, UriKind.Relative), tileData, false); } }
public void DeleteTileFor(long userOrGroupId, bool isGroup) { ShellTile tile = this.FindTile(userOrGroupId, isGroup); if (tile == null) { return; } tile.Delete(); }
private void updateTileUnknown(ShellTile tile) { StandardTileData tileData = new StandardTileData { Title = "Törölt csempe", BackgroundImage = new Uri("Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative) }; tile.Update(tileData); }
void appBarMenuItem_Click(object sender, EventArgs e) { ShellTile appTile = ShellTile.ActiveTiles.First(); StandardTileData appTData = new StandardTileData(); appTData.BackTitle = ""; appTData.BackContent = ""; appTData.BackBackgroundImage = new Uri("", UriKind.Relative); appTile.Update(appTData); }
private void toggleSwitchTile_Unchecked(object sender, RoutedEventArgs e) { ShellTile NowTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("TileID=2")); if (NowTile != null) { NowTile.Delete(); } HasTile = false; }
private int GetLastUpdatedDate(ShellTile t) { Dictionary <string, string> queryString = t.NavigationUri.ParseQueryString(); if (queryString.ContainsKey(SecondaryTileManager.LastUpdatedKey)) { return(int.Parse(queryString[SecondaryTileManager.LastUpdatedKey])); } return(0); }
/// <summary> /// Creates a new secondary tile. /// </summary> /// <param name="navigationUri"><see cref="Uri"/> for the tile being created. The <see cref="Uri"/> can contain custom launch parameters.</param> /// <param name="initialTileData">Text and image information for the tile being created.</param> /// <param name="supportsWideTile">true if the wide tile size is supported; otherwise, false.</param> public override void Create(Uri navigationUri, IShellTileServiceTileData initialTileData, bool supportsWideTile) { var shellTileServiceTileDataBase = initialTileData as ShellTileServiceTileDataBase; if (shellTileServiceTileDataBase == null) { throw new ArgumentException("A ShellTileServiceTileDataBase instance is expected.", "initialTileData"); } ShellTile.Create(navigationUri, shellTileServiceTileDataBase.ToShellTileData(), supportsWideTile); }
/// <summary> /// Updates the primary tile with specific title and background image. /// </summary> /// <param name="title">The title.</param> /// <param name="backgroundImage">The background image.</param> public static void UpdatePrimaryTile(string title, Uri backgroundImage) { ShellTile primaryTile = ShellTile.ActiveTiles.First(); StandardTileData newTileData = new StandardTileData { Title = title, BackgroundImage = backgroundImage }; primaryTile.Update(newTileData); }
private void pinButton_Click(object sender, EventArgs e) { StandardTileData tileData = new StandardTileData { BackgroundImage = new Uri("Background.png", UriKind.Relative), Title = string.Format("Hello {0}!", helloMessage.Text), }; ShellTile.Create(BuildNavigationUri(helloMessage.Text), tileData); }
public bool DeskContainsImage(ImageModel image) { if (image == null) { return(false); } ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(image.url)); return(tile != null && tile.NavigationUri.ToString().Contains(image.url.ToString())); }
private void cbShowTile_Unchecked(object sender, RoutedEventArgs e) { ShellTile tile = this.FindTile(SecondaryTileUriSource); if (tile != null) { tile.Delete(); MessageBox.Show("Secondary tile deleted."); } }
private StandardTileData GetInitialData(Contact contact, ShellTile data) { return new StandardTileData { Title = contact.DisplayName, Count = GetRandomNumber1To99(), BackgroundImage = new Uri("/Images/DellFront.png", UriKind.Relative), BackBackgroundImage = new Uri("/Images/DellBack.png", UriKind.Relative), BackTitle = DateTime.Now.ToShortDateString(), }; }
public void DisplayApplicationTile(String title) { applicationTile = ShellTile.ActiveTiles.First(); if (applicationTile != null) { StandardTileData NewTileData = new StandardTileData { Title = title, BackgroundImage = new Uri(Const.APP_TILE_FOR_IMG, UriKind.Relative), Count = 0, BackTitle = Const.APP_TITL_BACK_TITLE, BackBackgroundImage = new Uri(Const.APP_TILE_BACK_IMG, UriKind.Relative), BackContent = Const.APP_TITE_BACK_CONTENT }; applicationTile.Update(NewTileData); } }
void runNewDownload() { while (TilesToFind.Count > 0) { Random rand = new Random(); int indexEltToUpdate = rand.Next(0, TilesToFind.Count - 1); currentTile = TilesToFind.ElementAt(indexEltToUpdate); wc.DownloadStringAsync(AgentURIModel.Instance.getRandomWithCat(GetCategorie(currentTile.NavigationUri.OriginalString))); TilesToFind.RemoveAt(indexEltToUpdate); } }
private void EnableIconicTileSwitch_Unchecked(object sender, RoutedEventArgs e) { if (IconicTile == null) return; IconicTile.Delete(); IconicTile = null; }
internal ShellTileServiceTile(ShellTile shellTile) { _shellTile = shellTile; }
private Task RefreshTile(ShellTile tile, TileType type) { var queryString = tile.NavigationUri.ToString(); queryString = queryString.Substring(queryString.IndexOf('?')); var segments = Utils.ParseQueryString(queryString); int postalCode = 0; if (int.TryParse(segments["PostalCode"], out postalCode)) { var country = segments["Country"]; var offset = segments["Offset"]; GeoLocationCity city = null; switch (country) { case Denmark.Name: city = Denmark.PostalCodes[postalCode]; break; case Greenland.Name: city = Greenland.PostalCodes[postalCode]; break; case FaroeIslands.Name: city = FaroeIslands.PostalCodes[postalCode]; break; } if (city != null) { switch (type) { case TileType.Latest: return RefreshLatestTile(city); case TileType.Custom: return RefreshCustomTile(offset, city); case TileType.PlusTile: return RefreshPlusTile(offset, city); } } } throw new InvalidOperationException("Attempted to refresh a non-existant tile"); }
private void EnableIconicTileSwitch_Checked(object sender, RoutedEventArgs e) { if (IconicTile != null) return; IconicTileData oIcontile = new IconicTileData(); oIcontile.Title = "Hello Iconic Tile!!"; oIcontile.Count = 7; oIcontile.IconImage = new Uri("Assets/Tiles/Iconic/202x202.png", UriKind.Relative); oIcontile.SmallIconImage = new Uri("Assets/Tiles/Iconic/110x110.png", UriKind.Relative); oIcontile.WideContent1 = "windows phone 8 Live tile"; oIcontile.WideContent2 = "Icon tile"; oIcontile.WideContent3 = "All about Live tiles"; oIcontile.BackgroundColor = System.Windows.Media.Colors.Orange; ShellTile.Create(new Uri("/MainPage.xaml?tileType=iconic", UriKind.Relative), oIcontile, true); IconicTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("tileType=iconic".ToString())); }
private static bool IsPinned(string user, string repo, ShellTile t) { return t.NavigationUri.Equals(new Uri(string.Format(ViewModelLocator.REPOSITORY_URL, user, repo), UriKind.RelativeOrAbsolute)); }
private static String getSubscriptionIdForTile(ShellTile tile) { String subscriptionId = ""; List<String> urlParams = tile.NavigationUri.ToString().Split('=').ToList(); for (int i = 0; i < urlParams.Count - 1; i++) { if (urlParams[i].Contains("podcastId")) { foreach (Char c in urlParams[i + 1].ToCharArray()) { if (Char.IsDigit(c)) { subscriptionId += c; } } break; } } return subscriptionId; }
// 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; } }
private void UpdateOrPinForRealz(ShellTile tile, Uri navigationUri, AppTileSettings.TileSettings tileSettings) { AppTileSettings.Instance.Tiles[navigationUri] = tileSettings; AppTileSettings.Instance.Save(); var shellTileData = new StandardTileData { Title = tileSettings.Title, BackgroundImage = tileSettings.ShellFrontPhotoPath != null ? tileSettings.ShellFrontPhotoPath : tileSettings.FrontPhoto, BackBackgroundImage = tileSettings.BackPhoto, }; if (tile == null) { // Pin. try { ShellTile.Create(navigationUri, shellTileData); } catch (InvalidOperationException) { AppTileSettings.Instance.Tiles.Remove(navigationUri); AppTileSettings.Instance.Save(); MessageBox.Show("Unfortunately the tile could not be created at this time."); } } else { // Update. tile.Update(shellTileData); } }
private void UpdateTile(ShellTile tile) { StandardTileData newTileData = new StandardTileData(); // set tile data this.SetTileData(this.tbTitle, (text) => newTileData.Title = text); this.SetTileData(this.tbBackTitle, (text) => newTileData.BackTitle = text); this.SetTileData(this.tbBackContent, (text) => newTileData.BackContent = text); // update tile tile.Update(newTileData); MessageBox.Show("Tile updated. Go to home screen to see the result."); }
Project GetProject(ShellTile tile) { Project project = null; int queryStringIndex = tile.NavigationUri.OriginalString.IndexOf(Constants.QUERYSTRINGSTART); if (queryStringIndex > 0) { project = new Project(); string querystring = tile.NavigationUri.OriginalString.Substring(queryStringIndex + Constants.QUERYSTRINGSTART.Length); string[] parameters = querystring.Split(Constants.QUERYSTRINGSEPARATORS); if (parameters.Length >= 2 && parameters[0].Contains(Constants.PINPROJECTIDPARAM)) project.Id = new Guid(parameters[1]); if (parameters.Length >= 4 && parameters[2].Contains(Constants.PINPROJECTCOLORPARAM)) project.Color = parameters[3]; } return project; }
protected bool TileIsPrimaryTile(ShellTile tile) { return !TileIsSecondaryTile(tile); }
public ShellTileAdapter(ShellTile shelltile) { this.shelltile = shelltile; }
protected bool TileIsSecondaryTile(ShellTile tile) { return tile.NavigationUri.ToString().Contains("?fromSeconaryTile=true"); }
private void CheckSecondaryTile(String pagePath) { secondaryTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(pagePath)); isSecTilePined = (secondaryTile != null); }