private void onEditSwConfigClicked(object sender, RoutedEventArgs e) { FanConfig cfg = new FanConfig(this.Controller.SoftwareFanConfig); FanConfigEditor editor = new FanConfigEditor(cfg); if (editor.ShowDialog() == true) { this.Controller.SoftwareFanConfig = cfg; } }
private void onEditSwCurveClicked(object sender, RoutedEventArgs e) { FanConfig cfg = new FanConfig(this.Controller.SoftwareFanConfig); List <FanPoint> curve = new List <FanPoint>(cfg.Curve); FanCurveEditor editor = new FanCurveEditor(curve, FanCurveKind.Linear); editor.CurveApplied += (s, e2) => { cfg.Curve = curve.ToImmutableArray(); this.Controller.SoftwareFanConfig = cfg; }; editor.ShowDialog(); }
/// <summary> /// Lists current registration information (global). /// </summary> /// <returns>Fan automation configurataion object with global registration status.</returns> public async Task <List <FanAutomationConfig> > ListFanAutomationConfig() { List <FanAutomationConfig> registeredSensors = new List <FanAutomationConfig>(); //Call Worker. IRestResponse restResponse = await RESTWorker("/MooseBox/API/v1.0/automation/fan/list", Method.GET); //Parse results; from MooseBox's FanAutomation.js: // // { // "RegisteredSensors": [ // { // "SerialNumber": 1234, // "FansConfig": [ // { // "FanNumber": 1, // "PowerOnThresholdCelsius": 42 // }, // // { // "FanNumber": 2, // "PowerOnThresholdCelsius": 23 // }, // ] // }, // // { // "SerialNumber": 4321, // "FansConfig": [ // { // "FanNumber": 3, // "PowerOnThresholdCelsius": -5 // } // ] // } // ] // } dynamic jsonResult = JsonConvert.DeserializeObject(restResponse.Content); foreach (var registeredSensor in jsonResult.RegisteredSensors) { FanAutomationConfig fanAutomationConfig = new FanAutomationConfig(); fanAutomationConfig.SerialNumber = registeredSensor.SerialNumber; fanAutomationConfig.FansConfig = new List <FanConfig>(); foreach (var fc in registeredSensor.FansConfig) { FanConfig fanConfig = new FanConfig(); fanConfig.FanNumber = fc.FanNumber; fanConfig.PowerOnThresholdCelsius = fc.PowerOnThresholdCelsius; fanAutomationConfig.FansConfig.Add(fanConfig); } registeredSensors.Add(fanAutomationConfig); } return(registeredSensors); }
public FanConfigEditor(FanConfig config) { this.Config = config; this.InitializeComponent(); }