Beispiel #1
0
        private async Task GetSession()
        {
            //with this, the log is coming in the output window when we debug.
            Log.ApplicationLogging.LoggerFactory.AddOutputLogger();

            //find the device
            var device = BayerUsbDevice.FindMeter();

            //getting a cancellation token for the tasks
            var _tokenSource = new CancellationTokenSource();
            var _token       = _tokenSource.Token;



            //unit of work to get information
            //using (CgmUnitOfWork uow = new CgmUnitOfWork())
            //{
            //    //Check sqlite database version, should be done at the begin of every run to make sure database is aval and correct version.
            //    uow.CheckDatabaseVersion(AppContext.BaseDirectory);

            //    //Getting info from pump. The session class contain all info necessary for communicating with the pump and all the results.
            //    //Common.Serialize.SerializerSession session = await uow.Pump.GetPumpSessionAsync(device, _token);

            //}
        }
Beispiel #2
0
 public void Disconnect(BayerUsbDevice device)
 {
     if (!device.IsConnected)
     {
         if (this._tokenSource != null)
         {
             this._tokenSource.Cancel();
             NetworkChange.NetworkAddressChanged -= NetworkChange_NetworkAddressChanged;
             this.Stop();
         }
     }
 }
Beispiel #3
0
 public async void StatusChanged(BayerUsbDevice device)
 {
     await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                   () =>
     {
         this.IsConnected = device.IsConnected;
         Setting settings;
         using (CGM.Communication.Data.Repository.CgmUnitOfWork uow = new Communication.Data.Repository.CgmUnitOfWork())
         {
             settings = uow.Setting.GetSettings();
             if (this.IsConnected && settings.OtherSettings.AutoStartTask)
             {
                 this.On = true;
             }
             else
             {
                 this.On = false;
             }
         }
     });
 }