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;
 }
Пример #2
0
        private void layoutRoot_MouseMove(object sender, MouseEventArgs e)
        {
            SensorTile tile = sender as SensorTile;

            if (tile != null && e.LeftButton == MouseButtonState.Pressed)
            {
                DataObject dragData = new DataObject("Tile", this);
                DragDrop.DoDragDrop(tile, dragData, DragDropEffects.Move);
            }
        }
Пример #3
0
 public SensorTileDeletedEventArgs(SensorTile deletedSensorTile)
 {
     this.DeletedSensorTile = deletedSensorTile;
 }
Пример #4
0
        /// <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);
        }
Пример #5
0
        /// <summary>
        /// Property changed callback
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void OnHardwareSensorChangedPropertyCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            SensorTile instance = (SensorTile)sender;

            instance.HardwareSensorChangedPropertyCallback(e); // Call non-static
        }
Пример #6
0
        /// <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);
        }