コード例 #1
0
        public void ScheduleTask <TPage>(int intervalTimeInMs, Action <TPage> action, int delay = 0, bool preExecute = false) where TPage : Page
        {
            if (State.PeriodicTaskEntries == null)
            {
                State.PeriodicTaskEntries = new List <IPeriodicTaskEntry>();
            }
            var taskEntry = new PortablePeriodicTaskEntry <TPage>(Page, action, intervalTimeInMs);

            State.PeriodicTaskEntries.Add(taskEntry);
            taskEntry.Task.Run(delay, preExecute);
        }
コード例 #2
0
        public void ScheduleTaskEveryMinute <TPage>(Action <TPage> action) where TPage : Page
        {
            if (State.PeriodicTaskEntries == null)
            {
                State.PeriodicTaskEntries = new List <IPeriodicTaskEntry>();
            }
            var taskEntry = new PortablePeriodicTaskEntry <TPage>(Page, action);

            State.PeriodicTaskEntries.Add(taskEntry);
            taskEntry.Task.RunEveryMinute();
        }