Beispiel #1
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)
            {
            }
        }
Beispiel #2
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();
            }
        }
Beispiel #3
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;
            }
        }
Beispiel #4
0
        void image1_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            string link = ((BitmapImage)((Image)sender).Source).UriSource.AbsoluteUri;

            HelperMetjods.UpdateOrAdd(userSettings, "BigImageLink", link.Replace("150px", "480px"));

            Uri i = new Uri("/ImageShow.xaml", UriKind.Relative);

            NavigationService.Navigate(i);
        }
Beispiel #5
0
        private void ResetArticles()
        {
            Thread t = new Thread(() =>
            {
                try
                {
                    List <Article> articles = new List <Article>();
                    try
                    {
                        articles = (List <Article>)userSettings["Articles"];
                    }
                    catch { }

                    articles.Clear();

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

                    HelperMetjods.getFutureArticles();
                }
                catch { }
            });

            t.Start();
        }
Beispiel #6
0
 private void ToggleSwitch_Unchecked(object sender, System.Windows.RoutedEventArgs e)
 {
     HelperMetjods.UpdateOrAdd(userSettings, "lang", false);
     ResetArticles();
 }