/// <summary> /// Add sensor tile /// </summary> /// <param name="gridRow"></param> /// <param name="gridCol"></param> private void AddSensorTile(ISensor sensor, int gridRow, int gridCol, string sensorCategory) { var s = new SensorTile(); Color backgroundColor = Colors.White; switch (sensorCategory) { case "CPU": backgroundColor = ColorHelper.GetColorFromString(this.applicationConfigFile.Sections["TileSettings"].Settings["CpuTilesColor"].Value); break; case "GPU": backgroundColor = ColorHelper.GetColorFromString(this.applicationConfigFile.Sections["TileSettings"].Settings["GpuTilesColor"].Value); break; case "Mainboard": backgroundColor = ColorHelper.GetColorFromString(this.applicationConfigFile.Sections["TileSettings"].Settings["MainboardTilesColor"].Value); break; } s.HardwareSensor = sensor; s.TileBackground = new SolidColorBrush(backgroundColor); s.SetValue(Grid.RowProperty, gridRow); s.SetValue(Grid.ColumnProperty, gridCol); this.MainGrid.Children.Add(s); }
/// <summary> /// CTOR /// </summary> public MainboardInformationViewModel() { this.MainboardInformation = DependencyFactory.Resolve <IHardwareInformationService>(ServiceNames.WmiHardwareInformationService).GetMainboardInformation(); this.openHardwareMonitorManagementService = DependencyFactory.Resolve <IOpenHardwareMonitorManagementService>(ServiceNames.OpenHardwareMonitorManagementService); if (this.openHardwareMonitorManagementService != null) { if (this.openHardwareMonitorManagementService.MainboardVoltageSensorsWithName != null) { foreach (var vs in this.openHardwareMonitorManagementService.MainboardVoltageSensorsWithName) { SensorTile st = new SensorTile(); st.HardwareSensor = vs; this.MainboardVoltageSensors.Add(st); } } if (this.openHardwareMonitorManagementService.MainboardTemperatureSensors != null) { foreach (var ts in this.openHardwareMonitorManagementService.MainboardTemperatureSensors) { SensorTile st = new SensorTile(); st.HardwareSensor = ts; this.MainboardTemperatureSensors.Add(st); } } } // Register for events DependencyFactory.Resolve <IEventAggregator>(GeneralConstants.EventAggregator).GetEvent <OpenHardwareMonitorManagementServiceTimerTickEvent>().Subscribe(this.OpenHardwareMonitorManagementServiceTimerTickEventHandler, ThreadOption.UIThread); }
public SensorTilePositionChangedEventArgs(int oldGridRow, int oldGridColumn, int newGridRow, int newGridColumn, SensorTile tile) { this.OldGridRow = oldGridRow; this.OldGridColumn = oldGridColumn; this.NewGridRow = newGridRow; this.NewGridColumn = newGridColumn; this.SensorTile = tile; }
public SensorTileDeletedEventArgs(SensorTile deletedSensorTile) { this.DeletedSensorTile = deletedSensorTile; }