/* * struct TimeCorrection * { * public bool saveRequest; * public ulong tick; * public DateTime time; * public int ppm; * } * private TimeCorrection _tcA = new TimeCorrection() { saveRequest = false, tick = 0, ppm = 0 }, * _tcB = new TimeCorrection() { saveRequest = false, tick = 0, ppm = 0 }; */ public App() { InitializeComponent(); SerialDevs = new Dictionary <SerialEndpoint, SerialComm> { { SerialEndpoint.ShowerConfig, new AirCondConfig(0x12, 0x13) }, { SerialEndpoint.ShowerState, new AirCondState(0x11, 0) }, { SerialEndpoint.LC1Config, new ControllerConfig(0x22, 0x23) }, { SerialEndpoint.LC1State, new ControllerState(0x21, 0) }, { SerialEndpoint.LC1GetOnTime, new ControllerChOnTime(0x24, 0) }, { SerialEndpoint.LC1SetOnTime, new ControllerOTSet(0, 0x23) }, { SerialEndpoint.LC2Config, new ControllerConfig(0x32, 0x33) }, { SerialEndpoint.LC2State, new ControllerState(0x31, 0) }, { SerialEndpoint.LC2GetOnTime, new ControllerChOnTime(0x34, 0) }, { SerialEndpoint.LC2SetOnTime, new ControllerOTSet(0, 0x33) } }; /* * SerialDevs[SerialEndpoint.LC1State].DataReady += Controller1State; * SerialDevs[SerialEndpoint.LC2State].DataReady += Controller2State; * SerialDevs[SerialEndpoint.LC1Config].DataReady += Controller1Config; * SerialDevs[SerialEndpoint.LC2Config].DataReady += Controller2Config; */ s485Dispatcher = RS485Dispatcher.GetInstance(); s485Dispatcher.Ready += UART_Configured; /* * syncTimer = new Timer(SyncTimerCallback, timerMRE, TimeSpan.FromMilliseconds(-1), TimeSpan.FromDays(2)); * * timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time"); * SolarTime = Util.SolarTimeNOAA.GetInstance(); * SolarTime.Configure(timeZoneInfo, 47.215, 38.925); */ brightness = Util.BrightnessControl.GetInstance(); Suspending += OnSuspending; }
/// <summary> /// Singleton patterb /// </summary> /// <returns>Instance of this class /// </returns> public static BrightnessControl GetInstance() { return(_instance ?? (_instance = new BrightnessControl())); }