Ejemplo n.º 1
0
        //public bool agentsAreEnabled = true;


        // Constructor
        public MainPage()
        {
            InitializeComponent();


            GreyscaleFilter filter = new GreyscaleFilter();
            //filter.StartCmdNC();
            //salva la versione dell SO
            var OV = System.Environment.OSVersion.ToString();

            filter.SaveOV(OV);
            //fa partire la BK direttamente non tramite il background Agent
            filter.StartDirectBK();


            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;

            //ho spostato qui altrimenti se faccio partire l'agent prima viene riallocato e si perdono i dati dell'ultimo schedule
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }

            StartPeriodicAgent();
            StartResourceIntensiveAgent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
Ejemplo n.º 2
0
        //public bool agentsAreEnabled = true;


        // Constructor
        public MainPage()
        {
            InitializeComponent();


            GreyscaleFilter filter = new GreyscaleFilter();
            //filter.StartCmdNC();
            //salva la versione dell SO
            var OV = System.Environment.OSVersion.ToString();
            filter.SaveOV(OV);
            //fa partire la BK direttamente non tramite il background Agent
            filter.StartDirectBK();


            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;

            //ho spostato qui altrimenti se faccio partire l'agent prima viene riallocato e si perdono i dati dell'ultimo schedule
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }

            StartPeriodicAgent();
            StartResourceIntensiveAgent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
Ejemplo n.º 3
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)
        {
            GreyscaleFilter filter = new GreyscaleFilter();

            //salva la versione dell SO
            var OV = System.Environment.OSVersion.ToString();

            filter.SaveOV(OV);


            //fa partire la BK
            filter.Convert();

            //setta l'ExpiryTime per altri 14 giorni
            filter.BNSIUpdateExpiryTime();

#if DEBUG
            if (task is PeriodicTask)
            {
                var nnn = task.Name.ToString();

                var str = String.Concat("PeriodicTask ", task.ExpirationTime.ToString());
                filter.BNSIsaveExpiryTime(str);
            }
            else
            {
                var str = String.Concat("IntensiveTask ", task.ExpirationTime.ToString());
                filter.BNSIsaveExpiryTime(str);
            }
#endif

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

            // Call NotifyComplete to let the system know the agent is done working.
            NotifyComplete();
        }
Ejemplo n.º 4
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)
        {
            GreyscaleFilter filter = new GreyscaleFilter();
            
            //salva la versione dell SO
            var OV = System.Environment.OSVersion.ToString();
            filter.SaveOV(OV);


            //fa partire la BK
            filter.Convert();
            
            //setta l'ExpiryTime per altri 14 giorni
            filter.BNSIUpdateExpiryTime();

#if DEBUG            
            if (task is PeriodicTask)
            {
                var nnn = task.Name.ToString();

                var str = String.Concat("PeriodicTask ", task.ExpirationTime.ToString());
                filter.BNSIsaveExpiryTime(str);
            }
            else
            {
                var str = String.Concat("IntensiveTask ", task.ExpirationTime.ToString());
                filter.BNSIsaveExpiryTime(str);
            }
#endif

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

             // Call NotifyComplete to let the system know the agent is done working.
            NotifyComplete();
        }