public void Stop() { if (!this.disposed && fanControl != null) { SettingsService.Settings.Autostart = false; SaveSettings(); fanControl.Stop(); } }
public void Stop() { if (!this.disposed && fanControl != null) { try { ServiceSettings.Default.Autostart = false; ServiceSettings.Save(); } catch { } fanControl.Stop(); } }
public void Stop() { if (!this.disposed && fanControl != null) { try { ServiceSettings.Default.Autostart = false; ServiceSettings.Default.TargetFanSpeeds = GetTargetFanSpeeds(this.fanControl.FanInformation); ServiceSettings.Save(); } catch { } fanControl.Stop(); } }
public void Stop() { if (!this.disposed && fanControl != null) { try { SettingsService.Settings.Autostart = false; SettingsService.Save(); } catch (Exception e) { logger.Error(e, "Failed to save settings"); } fanControl.Stop(); } }
public void ResetsRegisterWriteConfigurations() { var fanCfg = new FanConfiguration(); var regWriteCfg = new RegisterWriteConfiguration() { Register = 123, Value = 12, ResetRequired = true, ResetValue = 24 }; var cfg = new FanControlConfigV2() { EcPollInterval = 100, FanConfigurations = { fanCfg }, RegisterWriteConfigurations = { regWriteCfg } }; var filter = A.Fake <ITemperatureFilter>(); A.CallTo(() => filter.FilterTemperature(A <double> .Ignored)).ReturnsLazily((double x) => x); var ec = A.Fake <IEmbeddedController>(); A.CallTo(() => ec.IsInitialized).Returns(true); A.CallTo(() => ec.AcquireLock(A <int> .Ignored)).Returns(true); A.CallTo(() => ec.ReadByte(A <byte> .Ignored)).Returns((byte)0); var tempMon = A.Fake <ITemperatureMonitor>(); A.CallTo(() => tempMon.IsInitialized).Returns(true); using (var fanControl = new FanControl(cfg, filter, ec, tempMon)) { fanControl.Start(false); fanControl.Stop(); A.CallTo(() => ec.WriteByte((byte)regWriteCfg.Register, (byte)regWriteCfg.ResetValue)) .MustHaveHappened(); } }
public void CallsResetOnFans() { var fanCfg = new FanConfiguration() { ResetRequired = true }; var cfg = new FanControlConfigV2() { EcPollInterval = 100, FanConfigurations = { fanCfg } }; var filter = A.Fake <ITemperatureFilter>(); A.CallTo(() => filter.FilterTemperature(A <double> .Ignored)).ReturnsLazily((double x) => x); var ec = A.Fake <IEmbeddedController>(); A.CallTo(() => ec.IsInitialized).Returns(true); A.CallTo(() => ec.AcquireLock(A <int> .Ignored)).Returns(true); var tempMon = A.Fake <ITemperatureMonitor>(); A.CallTo(() => tempMon.IsInitialized).Returns(true); var fan = A.Fake <Fan>(opt => opt.WithArgumentsForConstructor( new object[] { ec, fanCfg, 70, false })); A.CallTo(() => fan.GetCurrentSpeed()).Returns(0); using (var fanControl = new FanControl(cfg, filter, ec, tempMon, new[] { fan })) { fanControl.Start(false); fanControl.Stop(); A.CallTo(() => fan.Reset()).MustHaveHappened(); } }