コード例 #1
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            listView.Items.Clear();
            ConnectionProfile profile = NetworkInformation.GetInternetConnectionProfile();
            bool isinternet = (profile != null) && profile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess;
            List<string> sites = new List<string>();
            if (isinternet)
            {
                var sf = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync("sites.txt", Windows.Storage.CreationCollisionOption.OpenIfExists);
                using (var stream = await sf.OpenStreamForReadAsync())
                {
                    using (StreamReader sr = new StreamReader(stream))
                    {
                        while (!sr.EndOfStream)
                        {
                            string[] s = sr.ReadLine().Split(',');
                            if (s.Length > 1)
                            {
                                
                                WPSite wps = new WPSite(s[0], s[1]);
                                WPListUpdate wplu = new WPListUpdate(wps);
                                List<string> plugins = await wplu.GetPluginsWithUpdate();
                                plugins.Insert(0, "Сайт " + s[0] + ":");
                                plugins.Add(string.Empty);
                                foreach (string ss in plugins)
                                {
                                    if (ss != "none" && ss != String.Empty)
                                    {
                                        listView.Items.Add(ss);
                                        if (!sites.Contains(s[0]) && ss != "Сайт " + s[0] + ":")
                                        {
                                            sites.Add(s[0]);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (sites.Count > 0)
                {
                    var tiledoc = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Text04);
                    var nodes = tiledoc.SelectNodes("tile/visual/binding/text");


                    string allsites = string.Empty;
                    foreach (string s in sites)
                    {
                        allsites += s + ", ";
                    }
                    nodes[0].InnerText = "Обновление от " + DateTime.Now + ". Имеются обновления плагинов на следующих сайтах: " + allsites.TrimEnd(new char[] { ',', ' ' });

                    TileNotification tile = new TileNotification(tiledoc);
                    TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);
                }
            }
        }
 public async void Run(IBackgroundTaskInstance taskInstance)
 {
     Debug.WriteLine("Task.Run");
     var _deferal = taskInstance.GetDeferral();
     WPSite WPSite = new WPSite("Maximum", new Uri("http://maximum-kirov.ru/"));
     WPListUpdate wplu = new WPListUpdate(WPSite);
     string PluginsWithUpdate = await wplu.GetPluginsWithUpdate();
     Debug.WriteLine(PluginsWithUpdate);
     _deferal.Complete();
 }
コード例 #3
0
        public WPListUpdate(WPSite site, string pathToScript)
        {
            if (!TestURL(site.SiteURi + pathToScript))
            {
                throw new ArgumentOutOfRangeException("pathToScript", "Указан неверный путь");
            }
            else
            {
                this.Site = site;
                this.PathToScripts = pathToScript;
            }

        }
コード例 #4
0
 private async void Page_Loaded(object sender, RoutedEventArgs e)
 {
     //var sf = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("sites.txt");
     var sf = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync("sites.txt", Windows.Storage.CreationCollisionOption.OpenIfExists);
     using (var stream = await sf.OpenStreamForReadAsync())
     {
         using (StreamReader sr = new StreamReader(stream))
         {
             while (!sr.EndOfStream)
             {
                 string[] site = sr.ReadLine().Split(',');
                 if (site.Length > 1)
                 {
                     WPSite wps = new WPSite(site[0], site[1]);
                     listView.Items.Add(wps);
                 }
             }
         }
     }
 }
コード例 #5
0
 public WPListUpdate(WPSite site) : this(site, "/wp_update.php") { }