public void Remove(PumpModel pumpModel)
        {
            Pump pump = _knownPumps.Where(p => Guid.Parse(p.Identifier) == pumpModel.Id).FirstOrDefault();

            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {
                if (_pairedPumps.Contains(pumpModel))
                {
                    _pairedPumps.Remove(pumpModel);
                }
            });

            if (pump != null)
            {
                DataManager dataManager = DataManager.Instance;
                dataManager.DeletePump(pump);
                _knownPumps.Remove(pump);
            }

            _bluetoothManager.Disconnect();
        }
Esempio n. 2
0
        public async void OnSignOutTapped(object sender, EventArgs e)
        {
            try
            {
                this.IsPresented = false;
                if (Application.Current.Properties.ContainsKey("Current_User"))
                {
                    Application.Current.Properties.Remove("Current_User");
                }

                await Navigation.PushModalAsync(new NavigationPage(new MainPage()));

                CacheManager.RemoveAllSyncEvaluations();
                if (CrossConnectivity.Current.IsConnected)
                {
                    await StepOutManager.SyncAllFichesBO();
                }
                await Application.Current.SavePropertiesAsync();

                StepOutManager.CurrentUser = "";

                BluetoothManager bluetoothManager = new BluetoothManager();
                IDevice          device           = CacheProvidor.Get <IDevice>("device");
                if (device != null)
                {
                    await bluetoothManager.Disconnect(device, CrossBluetoothLE.Current.Adapter);
                }
                //await Navigation.PushModalAsync(new NavigationPage(new MainPage()));
                //detailPage.Title = "Profile";
                //detailPage.Content = new ProfileView();
            }
            catch (Exception ex)
            {
                await StepOutManager.Writelog(ex);
                await DisplayAlert("Fout", "Er is iets misgelopen bij het uitloggen, als deze fout zich blijft voordoen neemt men best contact op met de support.", "OK");
            }
        }