private void DisconnectButton_Clicked(object sender, EventArgs e)
 {
     try
     {
         connection.Disconect();
         devicesList.IsEnabled = true;
         connection            = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        private async void Switch_Toggled(object sender, ToggledEventArgs e)
        {
            try
            {
                _control.TurnOnTheLight(Lights.IsToggled);
                if (AutoSwitch.IsToggled)
                {
                    AutoSwitch.IsToggled = false;
                }
            }
            catch (Exception)
            {
                await Navigation.PopModalAsync();

                CrossToastPopUp.Current.ShowToastMessage("Lost Connection");
                _connection.Disconect();
                _connection = null;
                _control    = null;
            }
        }