Esempio n. 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);
                }
            }
        }
Esempio n. 2
0
        public async Task TestWPGetListUpdate()
        {
            WPSite        site = new WPSite("Максимум", "http://maximum-kirov.ru/");
            WPListUpdate  wplu = new WPListUpdate(site, "wp_update.php");
            List <string> res  = await wplu.GetPluginsWithUpdate();

            Assert.IsNotNull(res);
        }
Esempio n. 3
0
        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();
        }