public static void getFutureArticles() { List <Article> articles = new List <Article>(); try { articles = (List <Article>)userSettings["Articles"]; } catch { } int maks = 15; if (articles.Count < maks) { for (int i = articles.Count; i < maks; i++) { if (NetworkInterface.GetIsNetworkAvailable()) { WikiParser.WikiArticleParser wep = new WikiArticleParser(HelperMetjods.GetLanguage(), true); } } } }
public static void UpdateCurrentArticleStorage(WikiParser.WikiArticleParser w) { HelperMetjods.UpdateOrAdd(userSettings, "ArticleBody", w.MainContent); HelperMetjods.UpdateOrAdd(userSettings, "ArticleName", w.ArticleName); HelperMetjods.UpdateOrAdd(userSettings, "ArticleLink", w.ArticleLink); HelperMetjods.UpdateOrAdd(userSettings, "ArticleImages", w.ImageLinks); }
/// <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) { if (task is PeriodicTask) { if (!NetworkInterface.GetIsNetworkAvailable()) { NotifyComplete(); return; } wap = new WikiParser.WikiArticleParser(HelperMetjods.GetLanguage(), false); wap.Changedevent += new WikiParser.WikiArticleParser.ArticleDownHanlder(wap_Changedevent); } }
void wap_Changedevent() { ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(); Uri bg = null; try { bg = new Uri(wap.ImageLinks[0].Replace("150px", "250px"), UriKind.Absolute); } catch { bg = new Uri("http://dl.dropbox.com/u/109923/wiki.png", UriKind.Absolute); } if (wap.ArticleName.Length > 15) { wap.ArticleName = wap.ArticleName.Substring(0, 15) + "..."; } HelperMetjods.UpdateOrAdd(userSettings, "ArticleBody", wap.MainContent); HelperMetjods.UpdateOrAdd(userSettings, "ArticleName", wap.ArticleName); HelperMetjods.UpdateOrAdd(userSettings, "ArticleLink", wap.ArticleLink); HelperMetjods.UpdateOrAdd(userSettings, "ArticleImages", wap.ImageLinks); //test if Tile was created if (TileToFind != null) { TileToFind.Update(new StandardTileData { Title = wap.ArticleName, BackgroundImage = bg, Count = 0, BackTitle = wap.ArticleName, BackBackgroundImage = new Uri("http://dl.dropbox.com/u/109923/wiki.png", UriKind.Absolute) }); } NotifyComplete(); }