• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ScheduledTask类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ScheduledTask的典型用法代码示例。如果您正苦于以下问题:C# ScheduledTask类的具体用法?C# ScheduledTask怎么用?C# ScheduledTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ScheduledTask类属于命名空间,在下文中一共展示了ScheduledTask类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            var tile = (from t in ShellTile.ActiveTiles select t).FirstOrDefault();
            var common = new Common();
            var startHour = new DateTime(2014, 05, 13, 08, 50, 00).Hour;
            var startMinute = new DateTime(2014, 05, 13, 08, 50, 00).Minute;
            var currentHour = DateTime.Now.Hour;
            var currentMinute = DateTime.Now.Minute;
            var callReport = (currentHour == startHour && currentMinute >= startMinute) || currentHour >= startHour;
            if (callReport)
            {
                var isUpdated = common.IsUpdated();

                if (tile != null && isUpdated.Result)
                {
                    var newTile = new IconicTileData
                        {
                            Count = 1
                        };
                    tile.Update(newTile);
                }
            }

            // Call NotifyComplete to let the system know the agent is done working.
            NotifyComplete();
        }
开发者ID:codermee,项目名称:pollenkoll,代码行数:35,代码来源:ScheduledAgent.cs


示例2: OnInvoke

        /// <summary>
        /// 运行计划任务的代理
        /// </summary>
        /// <param name="task">
        /// 调用的任务
        /// </param>
        /// <remarks>
        /// 调用定期或资源密集型任务时调用此方法
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            string taskType="";
            //TODO: 添加用于在后台执行任务的代码
            if (task is PeriodicTask)
                taskType = "PeriodicTask";
            if (task is ResourceIntensiveTask)
                taskType = "ResourceIntensiveTask";

            ShellToast shellToast = new ShellToast();
            shellToast.Title = taskType;
            shellToast.Content = "测试";
            shellToast.NavigationUri=new System.Uri("/MainPage.xaml?taskType="+taskType, System.UriKind.Relative);
            shellToast.Show();

            ShellTile shellTile=ShellTile.ActiveTiles.First();
            shellTile.Update
                (new StandardTileData{
             Count=5
                } );

            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(15));

            NotifyComplete(); 
        }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:34,代码来源:ScheduledAgent.cs


示例3: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            if (FBDataAccess.Current.IsLoggedIn())
            {
                // wait handler for the end of task processing
                var lcklist = new List<ManualResetEvent>();

                // toast notifications
                lcklist.Add(NotifyLatestNotifications(task.LastScheduledTime));

                // update live tiles
                var tileMapping = new Dictionary<string, ShellTile>(); // user id, tile
                for (int i = 0; i < ShellTile.ActiveTiles.Count(); i++)
                {
                    var tile = ShellTile.ActiveTiles.ElementAt(i);
                    var id = i == 0 ? "me" : tile.NavigationUri.GetQueryString("id");
                    tileMapping.Add(id, tile);
                }
                foreach (var tilemap in tileMapping)
                {
                    lcklist.Add(UpdateUserLiveTile(tilemap.Key, tilemap.Value));
                }

                // wait for the handler
                foreach (var lck in lcklist)
                {
                    lck.WaitOne();
                }
            }

            // Call NotifyComplete to let the system know the agent is done working.
            NotifyComplete();
        }
开发者ID:mvalipour,项目名称:WP7Facefeed,代码行数:42,代码来源:NotificationTask.cs


示例4: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        //protected override void OnInvoke(ScheduledTask task)
        //{
        //    //TODO: Add code to perform your task in background
        //    NotifyComplete();
        //}
        protected override void OnInvoke(ScheduledTask task)
        {
            // some random number
            Random random = new Random();
            // get application tile
            ShellTile tile = ShellTile.ActiveTiles.First();
            if (null != tile)
            {
                // creata a new data for tile
                StandardTileData data = new StandardTileData();
                // tile foreground data
                data.Title = "Title text here";
                data.BackgroundImage = new Uri("/Images/Blue.jpg", UriKind.Relative);
                data.Count = random.Next(99);
                // to make tile flip add data to background also
                data.BackTitle = "Secret text here";
                data.BackBackgroundImage = new Uri("/Images/Green.jpg", UriKind.Relative);
                data.BackContent = "Back Content Text here...";
                // update tile
                tile.Update(data);
            }
            #if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(30));
            System.Diagnostics.Debug.WriteLine("Periodic task is started again: " + task.Name);
            #endif

            NotifyComplete();
        }
开发者ID:Nordic-T,项目名称:Nordic-T-WP,代码行数:42,代码来源:ScheduledAgent.cs


示例5: FireExitingTask

        public void FireExitingTask(ScheduledTask scheduledTask)
        {
            var jobKey = scheduledTask.GetJob().Key;

            if (_scheduler.CheckExists(jobKey))
                _scheduler.TriggerJob(jobKey);
        }
开发者ID:mamluka,项目名称:SpeedyMailer,代码行数:7,代码来源:ScheduledTaskManager.cs


示例6: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {

            string toastMessage;

            if(task is PeriodicTask)
            {

                toastMessage = "Periodic task running.";

            }
            else
            {
                toastMessage = "Resource-intensive task running.";
            }

            var toast = new ShellToast {Title = "Background Agent Sample", Content = toastMessage};

            toast.Show();

#if DEBUG_AGENT

            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds((60)));

#endif

            NotifyComplete();
        }
开发者ID:IgorCandido,项目名称:NodeTests,代码行数:37,代码来源:ScheduledAgent.cs


示例7: OnInvoke

        protected override void OnInvoke(ScheduledTask task)
        {
            if (LockScreenManager.IsProvidedByCurrentApplication)
            {
                try
                {
                    var currentImage = LockScreen.GetImageUri();
                    string Imagename = string.Empty;
                    IsolatedStorageFile isoStorageFile = IsolatedStorageFile.GetUserStoreForApplication();
                    string[] totalImags = isoStorageFile.GetFileNames("/Shared/ShellContent/");
                    

                    string imgCount = currentImage.ToString().Substring(currentImage.ToString().IndexOf('_') + 1, currentImage.ToString().Length - (currentImage.ToString().IndexOf('_') + 1)).Replace(".jpg", "");
                    Random miIdRand = new Random();
                    Imagename = string.Format("Img{0}.jpg", miIdRand.Next(1, totalImags.Length));
                    LockScreenChange(Imagename);

                    //ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(5));
                    Thread.Sleep(6000);
                    OnInvoke(task);
                }
                catch
                {
                    NotifyComplete();
                }
            }
            else
            {
                
                ScheduledActionService.Remove(task.Name);
            }            
        }
开发者ID:rubone,项目名称:wp.photodisplay,代码行数:32,代码来源:ScheduledAgent.cs


示例8: AddTask

        public ActionResult AddTask(string name = "", string runtime = "", int interval = 0,string url = "")
        {
            try {
                if (url.Trim() == "") {
                    throw new Exception("Task must have a path.");
                }
                if (runtime.Trim() == "" && interval < 1) {
                    throw new Exception("Task must have a run time or an interval greater than 5 minutes.");
                }

                ScheduledTask s = new ScheduledTask {
                    name = name,
                    url = url
                };
                if (runtime.Trim() != "") {
                    DateTime rtime = Convert.ToDateTime(runtime).ToUniversalTime();
                    s.runtime = rtime;
                } else if(interval > 1) {
                    s.interval = interval;
                }
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                db.ScheduledTasks.InsertOnSubmit(s);
                db.SubmitChanges();
            } catch {}
            return RedirectToAction("index");
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:26,代码来源:SchedulerController.cs


示例9: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {

            //TODO: Add code to perform your task in background

            /// If application uses both PeriodicTask and ResourceIntensiveTask
            if (task is PeriodicTask)
            {
                // Execute periodic task actions here.
                ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("TileID=2"));
                if (TileToFind != null)
                {
                     StandardTileData NewTileData = new StandardTileData
                        {
                            Title= "updated by scheduled task",
                            Count = System.DateTime.Now.Minute
                        };
                     TileToFind.Update(NewTileData);
                }
            }
            else
            {
                // Execute resource-intensive task actions here.
            }

            NotifyComplete();
           
        }
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:37,代码来源:TaskScheduler.cs


示例10: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            specifics = task.Description.Split(new string[] { "split" }, StringSplitOptions.None);
            StartHour = int.Parse(specifics[0]);
            StartMin = int.Parse(specifics[1]);
            LateHour = int.Parse(specifics[2]);
            LateMin = int.Parse(specifics[3]);
            Tune = specifics[4];
            DateTime LateAlarmTime = new DateTime(2013, 1, 1, LateHour, LateMin, 0);
            IEnumerable<ScheduledNotification> notifications = ScheduledActionService.GetActions<ScheduledNotification>();
            AlarmsSet = 0;
            if (notifications != null)
            {
                for (int i = 0; i < notifications.Count(); i++)
                {
                    if (notifications.ElementAt(i).ExpirationTime.TimeOfDay > notifications.ElementAt(i).BeginTime.AddSeconds(1).TimeOfDay && notifications.ElementAt(i).ExpirationTime.TimeOfDay < notifications.ElementAt(i).BeginTime.AddSeconds(5).TimeOfDay && notifications.ElementAt(i).BeginTime.TimeOfDay < LateAlarmTime.TimeOfDay)
                    {
                        AlarmsSet++;
                    }
                }
            }

            Appointments appts = new Appointments();

            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted_Background);

            DateTime start = DateTime.Now;
            start = start.AddHours(-start.Hour);
            start = start.AddMinutes(-start.Minute);
            DateTime end = DateTime.Now.AddDays(7);

            appts.SearchAsync(start, end, "Appointments Test #1");
        }
开发者ID:JStonevalley,项目名称:AutoAlarm,代码行数:42,代码来源:ScheduledAgent.cs


示例11: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            //TODO: Add code to perform your task in background

            string toastMessage = "";

            // If your application uses both PeriodicTask and ResourceIntensiveTask
            // you can branch your application code here. Otherwise, you don't need to.
            if (task is PeriodicTask)
            {
                // Execute periodic task actions here.
                toastMessage = "Periodic task running.";
            }
            else
            {  
                // Execute resource-intensive task actions here.
                toastMessage = "Resource-intensive task running.";
            }

            // Launch a toast to show that the agent is running.
            // The toast will not be shown if the foreground application is running.
            ShellToast toast = new ShellToast();
            toast.Title = "Background Agent Sample";
            toast.Content = toastMessage;
            toast.Show();

            // If debugging is enabled, launch the agent again in one minute.
            #if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(60));
            #endif

            // Call NotifyComplete to let the system know the agent is done working.
            NotifyComplete();
        }
开发者ID:dmourainatel,项目名称:Windows-Phone-Projects,代码行数:43,代码来源:ScheduledAgent.cs


示例12: OnInvoke

        /// <summary>
        ///     Method called when PeriodicTask is invoked.
        /// </summary>
        /// <param name="task">Periodic task invoked.</param>
        protected override void OnInvoke(ScheduledTask task)
        {
            if (!new SettingsController().CatURLExists())
            {
                // Cat URL doesn't exist, so parse RSS.
                this.ParseRSSFeed();
            }
            else
            {
                // Cat URL exists, so perform date check.
                SettingsController settingsController = new SettingsController();

                if (settingsController.LastUpdatedExists())
                {
                    // lastUpdated setting exists, so check.
                    DateTime lastUpdated = new SettingsController().GetLastUpdated();
                    DateTime now = DateTime.Now;

                    if (lastUpdated.Date.CompareTo(now.Date) < 0)
                    {
                        // lastUpdated date is before Today, so parse RSS Feed to get a new image.
                        this.ParseRSSFeed();
                    }
                }
                else
                {
                    // lastUpdated setting doesn't exist, so parse RSS.
                    this.ParseRSSFeed();
                }
            }
        }
开发者ID:JonJam,项目名称:lolcatcalendar,代码行数:35,代码来源:ScheduledAgent.cs


示例13: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            // TODO: see when last prompted & if time for next prompt

            var data = new MainViewModel();

            var nextLesson = data.Lessons.FirstOrDefault(l => !l.Completed);

            var toast = new ShellToast
            {
                Title = "Time for",
                Content = nextLesson.Name
            };
            toast.Show();

            var mainTile = ShellTile.ActiveTiles.First();

            mainTile.Update(new IconicTileData
            {
                WideContent1 = "Time for more",
                WideContent2 = "watch " + nextLesson.Name
            });

            #if DEBUG
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(60));
            #endif

            NotifyComplete();
        }
开发者ID:ramhemasri,项目名称:Pusher,代码行数:38,代码来源:ScheduledAgent.cs


示例14: OnInvoke

 /// <summary>
 /// Agent zum Ausführen einer geplanten Aufgabe
 /// </summary>
 /// <param name="task">
 /// Die aufgerufene Aufgabe
 /// </param>
 /// <remarks>
 /// Diese Methode wird aufgerufen, wenn eine regelmäßige oder ressourcenintensive Aufgabe aufgerufen wird
 /// </remarks>
 protected override void OnInvoke(ScheduledTask task)
 {
     _curTask = task;
     //TODO: Code zum Ausführen der Aufgabe im Hintergrund hinzufügen
     if (_settingsFile.Contains("mode") != true)
     {
         NotifyComplete();
     }
     if ((int)_settingsFile["mode"] == 0) {
         _dayStr = " heute ";
     }
     else if ((int)_settingsFile["mode"] == 1)
     {
         _dayStr = " morgen ";
     }
     _fetcher = new Fetcher((int)_settingsFile["mode"]);
     _fetcher.RaiseErrorMessage += (sender, e) =>
     {
         Stop();
     };
     _fetcher.RaiseRetreivedScheduleItems += (sender, e) =>
     {
         Proceed(e.Schedule);
     };
     if (_settingsFile.Contains("group"))
     {
         _fetcher.GetTimes((int)_settingsFile["group"] + 1);
     }
     else
     {
         Stop();
     }
 }
开发者ID:reknih,项目名称:informant-wp,代码行数:42,代码来源:ScheduledAgent.cs


示例15: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            try
            {
                //TODO: Add code to perform your task in background
                // 更新应用程序磁贴
                int lastDay = task.LastScheduledTime.Day;
                int today = DateTime.Today.Day;

                if (task.LastScheduledTime.Year > 1 && today != lastDay)
                {
                    RefreshTile();
                }

                //toast
                // 弹出 Toast
                LoadSetting();
                DateTime now = DateTime.Now;
                if (now.TimeOfDay.CompareTo(ALARM_TIME.TimeOfDay) >= 0 //alarm time is arrived  .fix on 2013-6-1, add "time of the day"
                    && !HASALARMED //alarm is not triggered today
                    && ALARM_SWITCH //alarm is on
                    && (ALARM_THRESHOLD + LEFTGLASSES > 8)) //threshold is not reached
                    //if (now.TimeOfDay.CompareTo(ALARM_TIME.TimeOfDay) >= 0  && ALARM_SWITCH && (ALARM_THRESHOLD + LEFTGLASSES > 8))  //for TEST
                {
                    ShowToast();
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                NotifyComplete();
            }
        }
开发者ID:juyingnan,项目名称:VS,代码行数:44,代码来源:ScheduledAgent.cs


示例16: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            UpdateTile.Start();

            // Call NotifyComplete to let the system know the agent is done working.
            NotifyComplete();
        }
开发者ID:prashantvc,项目名称:DaysUntilXmas,代码行数:16,代码来源:TaskScheduler.cs


示例17: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            try
            {
                //rcFetcher.BeginFetchRecentChanges(new ChangesFetcher.RecentChangesFetched(OnFetched));
                rcFetcher.BeginFetchWatchlistChanges(Settings.Instance.Username, Settings.Instance.WatchlistToken,
                    new ChangesFetcher.RecentChangesFetched(OnFetched));
                changesFetchedEvent.WaitOne(20000); //20s timeout

                //we should have changes now, provided there was no error
                if (changes != null && changes.Count > 0 && TileManager.Instance.TileExists())
                {
                    DateTime? lastRead = Settings.Instance.LastRead;
                    int howManyNew = RecentChange.HowManyNewerThanTimestamp(changes, lastRead);
                    TileManager.Instance.UpdateCount(howManyNew);
                }

            #if(DEBUG_AGENT)
                //if we're in the debugging mode, relaunch soon
                TileUpdaterManager taskManager = new TileUpdaterManager();
                taskManager.LaunchForTest();
            #endif
            }
            catch (Exception) //just in case
            { }
            NotifyComplete();
        }
开发者ID:kamilk,项目名称:WikipediaSentinel,代码行数:36,代码来源:ScheduledAgent.cs


示例18: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            var tileToFind = ShellTile.ActiveTiles.FirstOrDefault();

            if(tileToFind != null)
            {
                var tileData = new StandardTileData
                                   {
                                       BackTitle = "Jeg lever!",
                                       BackBackgroundImage = new Uri(_pictureUrl, UriKind.Absolute)
                                   };

                tileToFind.Update(tileData);
            }

            /*

            var toast = new ShellToast
                            {
                                Title = "Toast!",
                                Content = "Backgrond agent says hello!",
                            };
            toast.Show();

            */

            NotifyComplete();
        }
开发者ID:estien,项目名称:WP7Data,代码行数:37,代码来源:ScheduledAgent.cs


示例19: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected async override void OnInvoke(ScheduledTask task) {
            if(NetworkInterface.GetIsNetworkAvailable()) {
                try {
                    var comic = await XkcdInterface.GetCurrentComic();
                    
                    var tileData = new FlipTileData {
                       BackgroundImage = new Uri(comic.ImageUri),
                       WideBackgroundImage = new Uri(comic.ImageUri)
                    };
                    ShellTile tile = ShellTile.ActiveTiles.First();
                    if(tile != null) {
                        tile.Update(tileData);
                    }

                    //var settings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
                    //if(!(bool)settings["IsAppRunning"]) {
                    //    var list = (ObservableCollection<Comic>)settings["ComicList"];
                    //    if(list[0].Number != comic.Number) {
                    //        list.Insert(0, comic);
                    //    }
                    //}
                } catch(WebException) { } catch(InvalidOperationException) { }
            }
            //NotifyComplete();
        }
开发者ID:jonstodle,项目名称:wpcd,代码行数:34,代码来源:ScheduledAgent.cs


示例20: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            try
            {
                if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
                    return;

                IAppSettingsStore settings = new AppSettingsStore(IsolatedStorageCacheManager.Instance);
                IFalconService fService = new FalconWebServiceClient(ServiceLoginUrl);
                using (var updatesService = new CheckUpdatesService(settings, new RaptorService(fService, AESCipherManager.Instance), AESCipherManager.Instance))
                {
                    var updates = updatesService.Updates();

                    UpdateTile(updatesService.GetUpdateCount());

                    if (updates.Count() == 0)
                    {
            #if DEBUG
                        ShellToast toast2 = new ShellToast();
                        toast2.Title = "DEBUG: ";
                        toast2.Content = "No updates";
                        toast2.Show();
            #endif
                    }
                    else
                    {
                        string message =
                            updates.Count() == 1
                            ? string.Format("Torrent {0} downloaded", updates.First())
                            : string.Format("{0} favorite torrents were downloaded", updates.Count());

                        ShellToast toast = new ShellToast();
                        toast.Title = "Torrents: ";
                        toast.Content = message;
                        toast.Show();
                    }
                }

            }
            catch (Exception ex)
            {
            #if DEBUG
                ShellToast toast = new ShellToast();
                toast.Title = "Error:";
                toast.Content = ex.Message;
                toast.Show();
            #endif
            }
            finally
            {

            #if DEBUG_AGENT
                ScheduledActionService.LaunchForTest(
                    task.Name, TimeSpan.FromSeconds(30));
            #endif

                NotifyComplete();
            }
        }
开发者ID:IvanKuzavkov,项目名称:gitfoot,代码行数:68,代码来源:ScheduledAgent.cs



注:本文中的ScheduledTask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Scheduler类代码示例发布时间:2022-05-24
下一篇:
C# ScheduleDefinitionOrReference类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap