public MainPage() { InitializeComponent(); devStat = this.FindByName <Label>("devstatus"); devStat.Text = "Init"; mod = new BackgroundApplicationRelay.M2MQTTMod(this); mod.init(); }
public void Run(IBackgroundTaskInstance taskInstance) { //DateTimeOffset local = DateTime.SpecifyKind(new DateTime(2018, 5, 18, 0, 21, 0), DateTimeKind.Local); //Windows.System.DateTimeSettings.SetSystemDateTime(local); // controll = GpioController.GetDefault(); // pin = controll.OpenPin(gpioPin); // pin.SetDriveMode(GpioPinDriveMode.Output); // // TODO: Insert code to perform background work // // If you start any asynchronous methods here, prevent the task // from closing prematurely by using BackgroundTaskDeferral as // described in http://aka.ms/backgroundtaskdeferral // _deferral = taskInstance.GetDeferral(); //snapmod = new SnapshotMod(); // snapmod.TakePic(); startime = DateTime.Today.AddMinutes(50); //=28800 +1800 // watch = new PlantySlot(TimeSpan.FromSeconds(15), DateTime.Now.Add(TimeSpan.FromSeconds(2)).Subtract(DateTime.Now.Date), io); watch = new PlantySlot(TimeSpan.FromMinutes(15), TimeSpan.FromHours(8).Add(TimeSpan.FromMinutes(30)), io); (eng.WatcherList as List <PlantySlot>).Add(watch); // restart = new PlantySlot(TimeSpan.FromMinutes(5), TimeSpan.FromHours(23).Add(TimeSpan.FromMinutes(30)), new SleepModule()); // restart = new PlantySlot(TimeSpan.FromMinutes(4), DateTime.Now.Add(TimeSpan.FromSeconds(50)).Subtract(DateTime.Now.Date), new SleepModule()); // (eng.WatcherList as List<PlantySlot>).Add(restart); this.timer = ThreadPoolTimer.CreatePeriodicTimer(Timer_Tick, TimeSpan.FromMinutes(2)); //Snapshot timer uncomment to enable and flip the bool variable //snapshottimer= ThreadPoolTimer.CreatePeriodicTimer(TakeSnapshot, TimeSpan.FromMinutes(5)); // this.timer = ThreadPoolTimer.CreatePeriodicTimer(Timer_Tick, TimeSpan.FromSeconds(10)); ledblb.TestModule(); //BluetoothServ = new BlueTServer(); eng.Initialize(); mqttmodd.init(this); mqttTimer = ThreadPoolTimer.CreatePeriodicTimer(MQTTTick, TimeSpan.FromMinutes(2)); }