private static void RegisterScheduledTask()
        {
            var taskName = "Kursna lista";

            PeriodicTask t;

            t = ScheduledActionService.Find(taskName) as PeriodicTask;
            bool found = (t != null);

            if (!found)
            {
                t = new PeriodicTask(taskName);
            }
            t.Description = "Periodično osvežava keširanu kursnu listu";
            if (!found)
            {
                ScheduledActionService.Add(t);
            }
            else
            {
                ScheduledActionService.Remove(taskName);
                ScheduledActionService.Add(t);
            }

# if DEBUG
Example #2
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            string taskName = "AroundMeLockScreenChanger";
            //string taskName = "AroundMeLockScreenChangerTask";

            PeriodicTask oldTask = ScheduledActionService.Find(taskName) as PeriodicTask;

            if (oldTask != null)
            {
                ScheduledActionService.Remove(taskName);
            }

            // IMPORTANT: You'll get an error in the very next line of code
            // unless you add this to the WMAppManifest.xml beneath <DefaultTask>
            // in the <Tasks> section:

            /*
             *    <ExtendedTask Name="AroundMeLockScreenChangerTask">
             *      <BackgroundServiceAgent Specifier="ScheduledTaskAgent" Name="AroundMeLockScreenChanger" Source="AroundMe.Scheduler" Type="AroundMe.Scheduler.ScheduledAgent" />
             *    </ExtendedTask>
             */

            PeriodicTask task = new PeriodicTask(taskName);

            task.Description = "Change lockscreen wallpaper";

            ScheduledActionService.Add(task);

            //ScheduledActionService.LaunchForTest(task.Name,TimeSpan.FromSeconds(10));
        }
Example #3
0
        public static void DefaultAllSettings()
        {
            IsolatedStorageSettings.ApplicationSettings["topup"]             = true;
            IsolatedStorageSettings.ApplicationSettings["defaultnumber"]     = string.Empty;
            IsolatedStorageSettings.ApplicationSettings["defaulttopupvalue"] = 15;
            IsolatedStorageSettings.ApplicationSettings["lastusedsim"]       = false;
            IsolatedStorageSettings.ApplicationSettings["sim"]             = string.Empty;
            IsolatedStorageSettings.ApplicationSettings["tileAccentColor"] = true;
            IsolatedStorageSettings.ApplicationSettings["oldtilestyle"]    = false;
            var newTile = new FlipTileData
            {
                BackContent         = string.Empty,
                Count               = 0,
                BackBackgroundImage = new Uri("/Assets/336x336empty.png", UriKind.Relative)
            };
            var firstOrDefault = ShellTile.ActiveTiles.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.Update(newTile);
            }
            ResetLiveTile();
            //remove all background tasks.
            foreach (var pt in ScheduledActionService.GetActions <PeriodicTask>())
            {
                ScheduledActionService.Remove(pt.Name);
            }
        }
Example #4
0
 public void RemovePeriodicTask(string name)
 {
     if (ScheduledActionService.Find(name) != null)
     {
         ScheduledActionService.Remove(name);
     }
 }
        private bool Start()
        {
            bool result = false;

            try
            {
                PeriodicTask task = new PeriodicTask(TaskName);
                task.Description = "Service to update Trivia Buff live tile";
                ScheduledActionService.Add(task);
                result = true;
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show(
                    AppResources.ErrorCouldNotEnableLiveTileDescription,
                    AppResources.ErrorCouldNotEnableLiveTileTitle,
                    MessageBoxButton.OK);
            }
            catch (Exception)
            {
                // still show the main UI
            }

            return(result);
        }
        private void alarmInfo_panel_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            Alarm existingAlarm = (Alarm)ScheduledActionService.Find(ALARM_NAME);

            if (existingAlarm != null)
            {
                String   alarmInfo;
                TimeSpan remainingTime = existingAlarm.BeginTime.Subtract(DateTime.Now);

                if (remainingTime.Hours > 0)
                {
                    alarmInfo = String.Format("Alarm will sound in {0} hours and {1} minutes.", remainingTime.Hours, remainingTime.Minutes);
                }
                else if (remainingTime.Minutes > 0)
                {
                    alarmInfo = String.Format("Alarm will sound in {0} minutes.", remainingTime.Minutes);
                }
                else
                {
                    alarmInfo = "Alarm will sound in less than one minute.";
                }

                MessageBox.Show(alarmInfo);
            }
        }
        private void ApplicationBarSaveButton_Click(object sender, EventArgs e)
        {
            DateTime beginTime = (DateTime)alarmTimePicker.Value;

            if (beginTime < DateTime.Now)
            {
                beginTime = beginTime.AddDays(1);
            }
            DateTime expirationTime = beginTime.AddSeconds(1);

            RecurrenceInterval recurrence = RecurrenceInterval.None;

            Alarm alarm = new Alarm(ALARM_NAME);

            alarm.Content        = ALARM_CONTENT;
            alarm.Sound          = new Uri("/Assets/Sounds/Alarm-06.wma", UriKind.Relative);
            alarm.BeginTime      = beginTime;
            alarm.ExpirationTime = expirationTime;
            alarm.RecurrenceType = recurrence;

            if (ScheduledActionService.Find(ALARM_NAME) != null)
            {
                ScheduledActionService.Remove(ALARM_NAME);
            }
            ScheduledActionService.Add(alarm);

            updateUI();
        }
Example #8
0
        /// <summary>
        /// Sample code for handling a periodic agent.
        /// </summary>
        private void StartPeriodicAgent()
        {
            AgentsAreEnabled = true;
            _periodicTask    = ScheduledActionService.Find(PeriodicTaskName) as PeriodicTask;

            if (_periodicTask != null)
            {
                RemoveAgent(PeriodicTaskName);
            }

            _periodicTask = new PeriodicTask(PeriodicTaskName)
            {
                Description = AppResources.NotificationsHeader
            };

            try
            {
                ScheduledActionService.Add(_periodicTask);
#if (DEBUG_AGENT)
                ScheduledActionService.LaunchForTest(PeriodicTaskName, TimeSpan.FromSeconds(60));
#endif
            }
            catch (InvalidOperationException exception)
            {
                if (exception.Message.Contains("BNS Error: The Action is disabled"))
                {
                    MessageBox.Show("Background Agents have been disabled!");
                    AgentsAreEnabled = false;
                }
            }
        }
Example #9
0
        private void SetUpNotifications()
        {
            // Update live title anyway:
            UpdateTile.Start();

            periodicTask = ScheduledActionService.Find(periodicTaskName) as PeriodicTask;

            // If the task already exists and background agents are enabled for the
            // application, you must remove the task and then add it again to update
            // the schedule
            if (periodicTask != null)
            {
                RemoveAgent(periodicTaskName);
            }

            try
            {
                periodicTask = new PeriodicTask(periodicTaskName);
                // The description is required for periodic agents. This is the string that the user
                // will see in the background services Settings page on the device.
                periodicTask.Description = "This is the Live Tile support for the Days Until Xmas application. Live tiles will not work without this running.";

                ScheduledActionService.Add(periodicTask);
            }
            catch (InvalidOperationException exception)
            {
                if (exception.Message.Contains("BNS Error: The action is disabled"))
                {
                    MessageBox.Show(
                        "Background agents for this application have been disabled by the user. Please enable for Live Tiles.",
                        "Whoops!", MessageBoxButton.OK);
                }
            }
        }
Example #10
0
        private static void GetValue()
        {
            var task = new PeriodicTask("CanucksNewsScheduler")
            {
                Description = "Updates a Live Tile with schedule information"
            };


            try
            {
                ScheduledActionService.Remove("CanucksNewsScheduler");
            }
            catch (InvalidOperationException)
            {
                // ignore
            }

            try
            {
                ScheduledActionService.Add(task);
            }
            catch (SchedulerServiceException)
            {
                // No user action required.
            }
        }
Example #11
0
        // Constructor
        public MainPage()
        {
            IScheduler scheduler = Scheduler.Dispatcher;

            scheduler.Schedule(() =>
            {
                InitializeComponent();
                SystemTray.SetOpacity(this, 0.0);
                SetRefreshImage();
                if (!(App.isoSettings.Contains("UpComing")))
                {
                    App.isoSettings.Add("UpComing", "");
                }
                if (!(App.isoSettings.Contains("FinalKey")))
                {
                    App.isoSettings.Add("FinalKey", "");
                }

                RefreshTileTask();
            });
            DataContext = App.MainViewModel;



#if DEBUG
            ScheduledAction action = ScheduledActionService.Find("CanucksNewsScheduler");
            if (action != null)
            {
                ScheduledActionService.LaunchForTest("CanucksNewsScheduler", TimeSpan.FromSeconds(1));
            }
            #endif
        }
        public void CreateReminder(PlannerSearch search, int?index, DateTime dateTime, string spoor, DateTime reminderTime)
        {
            try
            {
                string url = string.Format("/Views/Reisadvies.xaml?id={0}&index={1}", search.Id, index);

                ScheduledAction oldReminder = ScheduledActionService.Find(url);
                if (oldReminder != null)
                {
                    ScheduledActionService.Remove(url);
                }

                Reminder newReminder = new Reminder(url)
                {
                    BeginTime      = reminderTime,
                    RecurrenceType = RecurrenceInterval.None,
                    NavigationUri  = new Uri(url, UriKind.Relative),
                    Title          = AppResources.ReminderAppTitle,
                    Content        = string.Format(AppResources.ReminderServiceFormat, search.NaarStation.Name, dateTime.ToString("HH:mm", CultureInfo.InvariantCulture), search.VanStation.Name, spoor),
                };;

                ScheduledActionService.Add(newReminder);
            }
            catch { }
        }
Example #13
0
 public void RemoveTask()
 {
     if (TaskExists)
     {
         ScheduledActionService.Remove(Constants.PhotoUploadBackgroundTaskName);
     }
 }
Example #14
0
        private void StartPeriodicAgent(int uid)
        {
            getUserNoticeTask = ScheduledActionService.Find(periodicTaskName) as PeriodicTask;
            if (getUserNoticeTask != null)
            {
                RemoveAgent(periodicTaskName);
            }
            getUserNoticeTask = new PeriodicTask(periodicTaskName);
            string cookie = TakeFromCookie(Config.Cookie);

            if (cookie.IsNullOrWhitespace( ))
            {
                return;
            }
            else
            {
                cookie = string.Format("{0}@{1}", cookie, uid);
            }
            getUserNoticeTask.Description = cookie;
            try
            {
                ScheduledActionService.Add(getUserNoticeTask);
                ScheduledActionService.LaunchForTest(periodicTaskName, TimeSpan.FromMinutes(20));
            }
            catch (InvalidOperationException exception)
            {
                if (exception.Message.Contains("BNS Error: The action is disabled"))
                {
                    MessageBox.Show("Background agents for this application have been disabled by the user.");
                }
            }
        }
        private void StartPeriodicTask()
        {
            PeriodicTask periodicTask = new PeriodicTask("PeriodicTaskDemo");

            periodicTask.Description = "Are presenting a periodic task";
            try
            {
                ScheduledActionService.Add(periodicTask);
                ScheduledActionService.LaunchForTest("PeriodicTaskDemo", TimeSpan.FromSeconds(3));
                Dispatcher.BeginInvoke(() => MessageBox.Show("Open the background agent success"));
            }
            catch (InvalidOperationException exception)
            {
                if (exception.Message.Contains("exists already"))
                {
                    //Dispatcher.BeginInvoke(() => MessageBox.Show("Since then the background agent success is already running"));
                }
                if (exception.Message.Contains("BNS Error: The action is disabled"))
                {
                    Dispatcher.BeginInvoke(() => MessageBox.Show("Background processes for this application has been prohibited. Enable it in settings to enjoy all features."));
                }
                if (exception.Message.Contains("BNS Error: The maximum number of ScheduledActions of this type has already been added."))
                {
                    //Dispatcher.BeginInvoke(() => MessageBox.Show("You open the daemon has exceeded the hardware limitations"));
                }
            }
            catch (SchedulerServiceException)
            {
            }
        }
Example #16
0
 public static void Remove(string name)
 {
     if (Exists(name))
     {
         ScheduledActionService.Remove(name);
     }
 }
 private void EnsureScheduledUpdate()
 {
     this._periodicTask = ScheduledActionService.Find(this._periodicTaskName) as PeriodicTask;
     if (this._periodicTask != null)
     {
         try
         {
             ScheduledActionService.Remove(this._periodicTaskName);
         }
         catch (Exception)
         {
         }
     }
     this._periodicTask = new PeriodicTask(this._periodicTaskName);
     ((ScheduledTask)this._periodicTask).Description      = ("VK LiveTile update agent.");
     ((ScheduledAction)this._periodicTask).ExpirationTime = (DateTime.Now.AddDays(14.0));
     try
     {
         ScheduledActionService.Add((ScheduledAction)this._periodicTask);
     }
     catch (InvalidOperationException ex)
     {
         ex.Message.Contains("BNS Error: The action is disabled");
         ex.Message.Contains("BNS Error: The maximum number of ScheduledActions of this type have already been added.");
     }
     catch (SchedulerServiceException)
     {
     }
 }
Example #18
0
        /// <summary>
        /// スケジュールされたタスクを実行するエージェント
        /// </summary>
        /// <param name="task">
        /// 呼び出されたタスク
        /// </param>
        /// <remarks>
        /// このメソッドは、定期的なタスクまたはリソースを集中的に使用するタスクの呼び出し時に呼び出されます
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            var liveId       = IOManagerForAgent.GetManager().LoadLivedId();
            var count        = IOManagerForAgent.GetManager().LoadLiveCount();
            var manifests    = IOManagerForAgent.GetManager().LoadLiveTitles();
            var checkedTitle = IOManagerForAgent.GetManager().LoadSpecified(liveId);
            var message      = "";

            if (liveId.Equals(Guid.Empty))
            {
                var random = new Random();
                message = manifests[random.Next(2)];
            }
            else
            {
                message = checkedTitle;
            }

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

            NotifyComplete();
        }
        private void updateUI()
        {
            Alarm existingAlarm = (Alarm)ScheduledActionService.Find(ALARM_NAME);

            if (existingAlarm != null && existingAlarm.BeginTime > DateTime.Now)
            {
                DateTime beginTime = existingAlarm.BeginTime;
                String   alarmInfo = String.Format("Alarm will sound at {0:t}.", beginTime);

                alarmInfo_textBlock.Text   = alarmInfo;
                alarmInfo_panel.Visibility = Visibility.Visible;
                setAlarm_panel.Visibility  = Visibility.Collapsed;
                ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = false;
                ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true;
            }
            else
            {
                if (existingAlarm != null)
                {
                    alarmTimePicker.Value = existingAlarm.BeginTime;
                }
                alarmInfo_panel.Visibility = Visibility.Collapsed;
                setAlarm_panel.Visibility  = Visibility.Visible;
                ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true;
                ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = false;
            }
        }
Example #20
0
        /// <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 async void OnInvoke(ScheduledTask task)
        {
            ShellTile tile = ShellTile.ActiveTiles.First();

            if (tile != null)
            {
                StorageFolder shared = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Shared", CreationCollisionOption.OpenIfExists);

                StorageFolder shellContent = await shared.CreateFolderAsync("ShellContent", CreationCollisionOption.OpenIfExists);

                var files = await shellContent.GetFilesAsync();

                if (files.Count == 0)
                {
                    return;
                }
                var random = new Random();

                var file = files[random.Next(0, files.Count)] as StorageFile;

                var tileData = new StandardTileData();

                tileData.BackTitle           = file.Name.Replace(".jpeg", "");
                tileData.BackBackgroundImage = new Uri("isostore:/Shared/ShellContent/" + file.Name, UriKind.RelativeOrAbsolute);

                tile.Update(tileData);
            }
#if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(30));
            System.Diagnostics.Debug.WriteLine("Periodic task is started again: " + task.Name);
#endif

            NotifyComplete();
        }
Example #21
0
        public void CreatePeriodicTask(string name)
        {
            var task = new PeriodicTask(name)
            {
                Description    = "Live tile updater for Weeker",
                ExpirationTime = DateTime.Now.AddDays(14)
            };

            // If the agent is already registered, remove it and then add it again
            RemovePeriodicTask(task.Name);

            try
            {
                // Can only be called when application is running in foreground
                ScheduledActionService.Add(task);
            }
            catch (InvalidOperationException exception)
            {
                if (exception.Message.Contains("BNS Error: The action is disabled"))
                {
                    MessageBox.Show(Resource.BackgroundAgentsDisabled);
                }
                if (exception.Message.Contains("BNS Error: The maximum number of ScheduledActions of this type have already been added."))
                {
                    // No user action required.
                    // The system prompts the user when the hard limit of periodic tasks has been reached.
                }
            }
                        #if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(60));
                        #endif
        }
Example #22
0
        private void StartPeriodicAgent()
        {
            AgentIsEnabled = true;

            // If this task already exists, remove it
            periodicTask = ScheduledActionService.Find(periodicTaskName) as PeriodicTask;
            if (periodicTask != null)
            {
                RemoveAgent(periodicTaskName);
            }

            periodicTask             = new PeriodicTask(periodicTaskName);
            periodicTask.Description = "This demonstrates a periodic task.";

            // Place the call to Add in a try block in case the user has disabled agents.
            try
            {
                ScheduledActionService.Add(periodicTask);
                PeriodicStackPanel.DataContext = periodicTask;

                // If debugging is enabled, use LaunchForTest to launch the agent in one minute.
#if (DEBUG_AGENT)
                ScheduledActionService.LaunchForTest(periodicTaskName, TimeSpan.FromSeconds(20));
#endif
            }
            catch (InvalidOperationException exception)
            {
                if (exception.Message.Contains("BNS Error: The action is disabled"))
                {
                    MessageBox.Show("Background agents for this application have been disabled by the user.");
                    AgentIsEnabled             = false;
                    PeriodicCheckBox.IsChecked = false;
                }
            }
        }
        private static void IfDebug(ScheduledTask task)
        {
            // If debugging is enabled, launch the agent again in one minute.
#if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(60));
#endif
        }
Example #24
0
        private void StopPomodoro()
        {
            _timer.Stop();
            _timerIsRunning = false;

            BackgroundAudioPlayer.Instance.Pause();

            // Todo - dialog box to test user wants to stop
            _currentPomodoro = null;
            // todo - switch between timer and break timer?
            ToggleButton.Content = "Start";



            if (ScheduledActionService.Find("Break_Over") != null)
            {
                ScheduledActionService.Remove("Break_Over");
            }

            Reminder r = new Reminder("Break_Over");

            r.Title         = "Back To Work";
            r.Content       = "Break's Over!";
            r.BeginTime     = DateTime.Now.AddSeconds(10);
            r.NavigationUri = NavigationService.CurrentSource;
            ScheduledActionService.Add(r);
        }
Example #25
0
 public void DeleteReminder()
 {
     if (Long.SelectedItems.Count == 1)
     {
         if (MessageBox.Show("Do you want to remove this reminder?", "Confirmation", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
         {
             ScheduledNotification remind = Notifications.First(r => r.Name == ((ScheduledNotification)(Long.SelectedItems[0])).Name);
             ScheduledActionService.Remove(remind.Name);
             MessageBox.Show("Reminder removed");
             NavigationService.GoBack();
         }
     }
     else
     {
         if (MessageBox.Show("Do you want to remove these reminders?", "Confirmation", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
         {
             foreach (ScheduledNotification item in Long.SelectedItems)
             {
                 ScheduledNotification remind = Notifications.First(r => r.Name == item.Name);
                 ScheduledActionService.Remove(remind.Name);
             }
             MessageBox.Show("Reminders removed");
             NavigationService.GoBack();
         }
     }
 }
        private void simpan_Click(object sender, EventArgs e)
        {
            DateTime saiki = DateTime.Now;

            if (timeX.Value.Value <= saiki)
            {
                MessageBox.Show("Pastikan jam sudah di set lebih dari jam sekarang");
            }
            else
            {
                string   reminderName = Guid.NewGuid().ToString();
                Reminder reminder     = new Reminder(reminderName);
                reminder.Title   = this.txtTitle.Text;
                reminder.Content = this.txtContent.Text;

                reminder.BeginTime      = new DateTime(saiki.Year, saiki.Month, saiki.Day, timeX.Value.Value.Hour, timeX.Value.Value.Minute, timeX.Value.Value.Second);
                reminder.RecurrenceType = RecurrenceInterval.Daily;
                reminder.ExpirationTime = reminder.BeginTime.AddSeconds(5.0);
                reminder.RecurrenceType = RecurrenceInterval.Daily;

                ScheduledActionService.Add(reminder);

                this.NavigationService.GoBack();
            }
        }
Example #27
0
        void StartBackgroundAgent()
        {
            try
            {
                if (IsLowMemDevice)
                {
                    return;
                }
                var taskName = "BinDays.Agent";

                if (ScheduledActionService.Find(taskName) is PeriodicTask)
                {
                    ScheduledActionService.Remove(taskName);
                }

                ScheduledActionService.Add(new PeriodicTask(taskName)
                {
                    Description = "Updates whether it's a recycling week or not"
                });
            }
            catch
            {
            }

            //ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(15));
        }
Example #28
0
        //락스크린 초기화
        private void MainPageLockscreen()
        {
            //앱바 생성
            CreateLockscreenAppBar();

            //잠금화면 공급자 설정
            //LockscreenHelper.SetLockscreenProvider();

            //락스크린 사용여부 설정
            ignoreCheckBoxEvents = true;
            if (SettingHelper.ContainsKey(Constants.LOCKSCREEN_USE_ROTATOR))
            {
                //잠금화면 공급자가 아니면 스케쥴러 및 락스크린 사용여부 삭제
                if (!LockScreenManager.IsProvidedByCurrentApplication)
                {
                    NoUseLockscreen();
                }
                else
                {
                    //잠금화면 공급자인데 스케쥴러가 없으면 시작시킴
                    UseLockscreen.IsChecked = true;
                    //로딩시 락스크린 사용인데 스케줄러에 없으면 시작시킴
                    if (ScheduledActionService.Find(Constants.PERIODIC_TASK_NAME) == null)
                    {
                        StartPeriodicAgent();
                    }
                }
            }
            ignoreCheckBoxEvents = false;
            //경고 숨김
            LockscreenEditWarnning = false;
        }
Example #29
0
        /// <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)
        {
            // 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           = "";
                data.BackgroundImage = new Uri("/Images/logo.jpg", UriKind.Relative);


                //: new Uri("/Images/white.png", UriKind.Relative);

                AgentStarter.CheckTileTextUpdate(NotifyComplete);
                // take just TITLE from description
                // 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();
        }
Example #30
0
        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            int val = Convert.ToInt32(Math.Round(slider1.Value));

            if (val < 400)
            {
                val = (int)((60) * ((double)val / 400));
            }
            else
            {
                val -= 340;
            }

            try
            {
                System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Remove("timespan");
                System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Remove("timespan_raw");
                System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Remove("lastrun");
            }
            catch
            {
            }
            System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Add("timespan", val);
            System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Add("timespan_raw", slider1.Value);
            System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Save();


            ScheduledActionService.LaunchForTest("task", TimeSpan.FromMilliseconds(120));
        }