Example #1
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)
        {
            if (!System.IO.File.Exists(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "flag")))
            {
                Sincronizacao.Sincronizacao sinc = new Sincronizacao.Sincronizacao();
                sinc.Sincronizar();
                while (sinc.concluiu == false)
                {
                }

                if (!sinc.erro)
                {
                    ShellToast toast = new ShellToast();
                    toast.Title   = "TCCWP";
                    toast.Content = "Sincronizou";
                    toast.Show();
                }
            }
#if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, System.TimeSpan.FromSeconds(60));
#endif


            NotifyComplete();
        }
Example #2
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)
        {
            if (!System.IO.File.Exists(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "flag")))
            {
                Sincronizacao.Sincronizacao sinc = new Sincronizacao.Sincronizacao();
                sinc.Sincronizar();
                while (sinc.concluiu == false) { }

                if (!sinc.erro)
                {
                    ShellToast toast = new ShellToast();
                    toast.Title = "TCCWP";
                    toast.Content = "Sincronizou";
                    toast.Show();
                }
            }
#if DEBUG_AGENT
  ScheduledActionService.LaunchForTest(task.Name, System.TimeSpan.FromSeconds(60));
#endif

            
            NotifyComplete();
        }