示例#1
0
 public void LogOut()
 {
     _statusProvider.Stop();
     _statusUpdater.Stop();
     _sessionProvider.ClearSession();
     State = NestViewModelState.LoggingIn;
 }
示例#2
0
        private async Task RaiseTemperatureAsync(TemperatureMode temperatureMode)
        {
            double temperature = GetTemperatureValue(temperatureMode);

            if (temperature >= MaxTemperature)
            {
                return;
            }

            try {
                _statusProvider.Stop();

                var thermostat = GetFirstThermostat();

                double desiredTemperature = temperature + 1.0d;
                SetTemperatureValue(temperatureMode, desiredTemperature);
                SetThermostatTemperatureValue(temperatureMode, thermostat, desiredTemperature);

                var result = await _nestWebService.ChangeTemperatureAsync(thermostat, desiredTemperature, temperatureMode);

                if (_exceptionHandler.IsErrorHandled(result.Error, result.Exception))
                {
                    return;
                }

                await _statusUpdater.UpdateStatusAsync();
            }
            finally {
                _statusProvider.Start();
            }
        }