private async void CharacteristicPageViewModel_PropertyChanged()

in BluetoothLEExplorer/BluetoothLEExplorer/ViewModels/CharacteristicPageViewModel.cs [519:605]


        private async void CharacteristicPageViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Notify")
            {
                if (Notify == true)
                {
                    NotifyProgress = true;
                    bool success = await Characteristic.SetNotify();
                    NotifyProgress = false;
                    if (success == true)
                    {
                        if (settingErrorMessage == true)
                        {
                            settingErrorMessage = false;
                        }
                        else
                        {
                            NotifyError = false;
                        }
                    }
                    else
                    {
                        settingErrorMessage = true;
                        Notify = false;
                        NotifyError = true;
                    }
                }
                else
                {
                    NotifyProgress = true;
                    bool success = await Characteristic.StopNotify();
                    NotifyProgress = false;
                    if (success == true)
                    {
                        if (settingErrorMessage == true)
                        {
                            settingErrorMessage = false;
                        }
                        else
                        {
                            NotifyError = false;
                        }
                    }
                    else
                    {
                        settingErrorMessage = true;
                        NotifyError = true;
                        Notify = true;
                    }
                }
            }

            if (e.PropertyName == "Indicate")
            {
                if (Indicate == true)
                {
                    IndicateProgress = true;
                    bool success = await Characteristic.SetIndicate();
                    IndicateProgress = false;
                    if (success == true)
                    {
                        IndicateError = false;
                    }
                    else
                    {
                        Indicate = false;
                        IndicateError = true;
                    }
                }
                else
                {
                    IndicateProgress = true;
                    bool success = await Characteristic.StopIndicate();
                    IndicateProgress = false;

                    if (success == true)
                    {
                        IndicateError = false;
                    }
                    else
                    {
                        IndicateError = true;
                        Indicate = true;
                    }
                }
            }
        }