Example #1
0
        private void wep_Changedevent()
        {
            if (!loaded)
            {
                lock (IsolatedStorageSettings.ApplicationSettings)
                {
                    var articles = new List <Article>();
                    var art      = new Article();
                    try
                    {
                        articles = (List <Article>)userSettings["Articles"];
                        art      = articles[0];
                        articles.RemoveAt(0);
                    }
                    catch (Exception ex)
                    {
                        return;
                    }
                    loaded = true;
                    HelperMetjods.UpdateOrAdd(userSettings, "Articles", articles);

                    WikiParser.WikiArticleParser w = new WikiParser.WikiArticleParser(art.ArticleName, art.MainContent, art.ArticleLink, art.ImageLinks);
                    HelperMetjods.UpdateCurrentArticleStorage(w);

                    userSettings.Save();
                    App.ViewModel.wap = w;
                }


                loadData();
            }
        }
Example #2
0
        void Instance_ShakeGesture(object sender, ShakeGestureEventArgs e)
        {
            try
            {
                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)
                {
                    if (!NetworkInterface.GetIsNetworkAvailable())
                    {
                        offlineGrid.Visibility = Visibility.Visible;
                    }
                    return;
                }

                HelperMetjods.UpdateOrAdd(userSettings, "Articles", articles);

                var w = new WikiParser.WikiArticleParser(art.ArticleName, art.MainContent, art.ArticleLink, art.ImageLinks);

                HelperMetjods.UpdateCurrentArticleStorage(w);

                App.ViewModel.wap = w;
                App.ViewModel.LoadData();
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
 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);
 }
Example #4
0
        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;
            }
        }