コード例 #1
0
        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData()
        {
            if (wap != null)
            {
                wap_Changedevent();
            }
            else
            {
                wap = new WikiArticleParser(HelperMetjods.GetLanguage(), false);
                wap.Changedevent += new WikiArticleParser.ArticleDownHanlder(wap_Changedevent);
            }

            this.IsDataLoaded = true;
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: TomyMMX/Wiki-MONSTER
        void ViewModel_LoadImagesEvent(List <string> imageLinks)
        {
            this.Dispatcher.BeginInvoke(
                () =>
            {
                loaded = true;
                firstBootgrid.Visibility = Visibility.Collapsed;

                App.ViewModel.ArticleName = App.ViewModel.wap.ArticleName;
                App.ViewModel.ArticleLink = App.ViewModel.wap.ArticleLink;

                try
                {
                    if (ContentStack.Children.Count == 3)
                    {
                        ContentStack.Children.RemoveAt(0);
                    }

                    TextBlock textBlock = (XamlReader.Load(App.ViewModel.wap.MainContent) as TextBlock);
                    ContentStack.Children.Insert(0, textBlock);
                }
                catch (Exception ex)
                {
                    int a = 1;
                }

                ImageStack.Children.Clear();
                int i = 0;
                foreach (var link in imageLinks)
                {
                    Image image1 = new Image();

                    image1.Stretch              = Stretch.Uniform;
                    image1.Width                = 150;
                    Uri uri                     = new Uri(link, UriKind.Absolute);
                    image1.Source               = new BitmapImage(uri);
                    image1.MouseLeftButtonDown += image1_MouseLeftButtonDown;

                    ImageStack.Children.Add(image1);
                    i++;

                    if (i == 10)
                    {
                        break;
                    }
                }
            });

            List <Article> articles = new List <Article>();

            try
            {
                articles = (List <Article>)userSettings["Articles"];
            }
            catch
            {
            }

            int maks = 15;

            if (articles.Count < maks)
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    WikiParser.WikiArticleParser wep = new WikiArticleParser(HelperMetjods.GetLanguage(), true);
                }
            }
        }