Beispiel #1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            computer.Accept(updateVisitor);
            treeView.Invalidate();
            plotPanel.InvalidatePlot();
            systemTray.Redraw();
            if (gadget != null)
            {
                gadget.Redraw();
            }

            if (wmiProvider != null)
            {
                wmiProvider.Update();
            }


            if (logSensors != null && logSensors.Value && delayCount >= 4)
            {
                logger.Log();
            }

            if (delayCount < 4)
            {
                delayCount++;
            }
        }
        private void timer_Tick(object sender, EventArgs e)
        {
            computer.Accept(updateVisitor);
            treeView.Invalidate();
            plotPanel.InvalidatePlot();
            systemTray.Redraw();
            if (gadget != null)
            {
                gadget.Redraw();
            }

            if (wmiProvider != null)
            {
                wmiProvider.Update();
            }


            if (logSensors != null && logSensors.Value && delayCount >= 4)
            {
                logger.Log();
            }

            if (delayCount < 4)
            {
                delayCount++;
            }

            if (this.emailNotificationManager.ChechIfNotificationShouldBeSend())
            {
                this.emailNotificationManager.SendReport();
            }
        }
Beispiel #3
0
        private void timer_Tick(object sender, EventArgs e)
        {
            // Stop the timer. Needed when an update is slower than the interval itself.
            timer.Enabled = false;
            if (firstTick == null)
            {
                firstTick = DateTime.Now;
            }
            computer.Accept(updateVisitor);
            treeView.Invalidate();
            plotPanel.InvalidatePlot();
            systemTray.Redraw();
            if (gadget != null)
            {
                gadget.Redraw();
            }

            if (wmiProvider != null)
            {
                wmiProvider.Update();
            }

            if (logSensors != null && logSensors.Value && DateTime.Now - firstTick >= warmup)
            {
                logger.Log();
            }

            timer.Enabled = true;
        }
 private void timer_Tick(object sender, EventArgs e)
 {
     computer.Accept(updateVisitor);
     treeView.Invalidate();
     plotPanel.Invalidate();
     systemTray.Redraw();
     if (gadget != null)
     {
         gadget.Redraw();
     }
 }
Beispiel #5
0
        private void timer_Tick(object sender, EventArgs e)
        {
            computer.Accept(updateVisitor);
            treeView.Invalidate();
            plotPanel.InvalidatePlot();
            systemTray.Redraw();
            if (gadget != null)
            {
                gadget.Redraw();
            }

            if (wmiProvider != null)
            {
                wmiProvider.Update();
            }


            if (logSensors != null)
            {
                if (logSensors.Value && delayCount >= 4)
                {
                    logger.Log();
                }

                if (delayCount < 4)
                {
                    delayCount++;
                }
            }
            else
            {
                logSensors = new UserOption("logSensorsMenuItem", false, logSensorsMenuItem,
                                            settings);

                if (logSensors.Value && delayCount >= 4)
                {
                    logger.Log();
                }

                if (delayCount < 4)
                {
                    delayCount++;
                }
            }
        }
        public void SendData(bool hardwareOnly)
        {
            computer.Accept(updateVisitor);

            if (sendSerialData)
            {
                var gpuMaxTemp = Math.Max(
                    (int)MaxTemp(computer, HardwareType.GpuNvidia),
                    (int)MaxTemp(computer, HardwareType.GpuAti)
                    );
                var gpuMaxUsage = Math.Max(
                    (int)UsageInPercent(computer, HardwareType.GpuAti, "GPU Core"),
                    (int)UsageInPercent(computer, HardwareType.GpuNvidia, "GPU Core")
                    );
                var gpuMaxMemory = Math.Max(
                    (int)UsageInPercent(computer, HardwareType.GpuAti, "GPU Memory"),
                    (int)UsageInPercent(computer, HardwareType.GpuNvidia, "GPU Memory")
                    );

                List <float> data = new List <float>
                {
                    (int)MaxTemp(computer, HardwareType.CPU),
                    gpuMaxTemp,
                    (int)MaxTemp(computer, HardwareType.Mainboard),
                    (int)MaxTemp(computer, HardwareType.HDD),
                    (int)UsageInPercent(computer, HardwareType.CPU, "CPU Total"),
                    gpuMaxUsage,
                    (int)UsageInPercent(computer, HardwareType.RAM, "Memory"),
                    gpuMaxMemory
                };

                for (int i = 1; i < 17; i++)
                {
                    data.Add((int)MaxTemp(computer, HardwareType.CPU, $"CPU Core #{i}"));
                    data.Add((int)UsageInPercent(computer, HardwareType.CPU, $"CPU Core #{i}"));
                }

                if (!hardwareOnly)
                {
                    data.AddRange(new float[] {
                        // Right group.
                        settings.GetValue("nMaxFan", 100),
                        settings.GetValue("nMinFan", 20),
                        settings.GetValue("nMaxTemp", 100),
                        settings.GetValue("nMinTemp", 10),

                        // Flags
                        settings.GetValue("chkManualFan", false) ? 1 : 0,
                        settings.GetValue("chkManualColor", false) ? 1 : 0,

                        // Sliders.
                        settings.GetValue("sldManualFan", 50),
                        settings.GetValue("sldManualColor", 500),
                        settings.GetValue("sldLedBrightness", 50),
                        settings.GetValue("sldPlotInterval", 5),

                        settings.GetValue("cboMaxTempSource", 0),
                    });
                }
                ;

                string tmp = string.Join(";", data.Select(T => T.ToString()).ToArray());

                serial.Write(Encoding.ASCII.GetBytes(tmp));
                serial.Write(Encoding.ASCII.GetBytes("E"));
            }

            treeView.Invalidate();
            plotPanel.InvalidatePlot();
            systemTray.Redraw();

            if (gadget != null)
            {
                gadget.Redraw();
            }

            if (wmiProvider != null)
            {
                wmiProvider.Update();
            }

            if (logSensors.Value && delayCount >= 4)
            {
                logger.Log();
            }

            if (delayCount < 4)
            {
                delayCount++;
            }
        }
        private void timer_Tick(object sender, EventArgs e)
        {
            computer.Accept(updateVisitor);

            {
                string tmp = "";
                tmp += string.Format("GPU: {0}C\r", (int)MaxTemp(computer, HardwareType.GpuAti) + AvgTemp(computer, HardwareType.GpuNvidia));
                tmp += string.Format("CPU: {0}C\r", (int)MaxTemp(computer, HardwareType.CPU));
                tmp += string.Format("Mainboard: {0}C\r", (int)MaxTemp(computer, HardwareType.Mainboard));
                tmp += string.Format("HDD: {0}C\r", (int)MaxTemp(computer, HardwareType.HDD));
                serial.Write(new byte[] { 0 });
                serial.Write(Encoding.ASCII.GetBytes(tmp));
                serial.Write(new byte[] { 1 });


                /*var gpus = computer.Hardware.Where(x => x.HardwareType == HardwareType.GpuAti || x.HardwareType == HardwareType.GpuNvidia).ToArray();
                 * if (gpus.Any())
                 * {
                 *  var gpu = gpus.First();
                 *  var temps = gpu.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("gpu: {0}C\r", (int)temp);
                 *  }
                 * }
                 *
                 * var cpus = computer.Hardware.Where(x => x.HardwareType == HardwareType.CPU).ToArray();
                 *
                 * if (cpus.Any())
                 * {
                 *  var cpu = cpus.First();
                 *  var temps = cpu.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("cpu: {0}C\r", (int)temp);
                 *  }
                 * }
                 *
                 * var mainboard = computer.Hardware.Where(x => x.HardwareType == HardwareType.Mainboard).Single();
                 * {
                 *  var temps = mainboard.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("mainboard: {0}C\r", (int)temp);
                 *  }
                 * }
                 *
                 * var hdds = computer.Hardware.Where(x => x.HardwareType == HardwareType.CPU).ToArray();
                 *
                 * if (hdds.Any())
                 * {
                 *  var cpu = cpus.First();
                 *  var temps = cpu.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("hdd: {0}C\r", (int)temp);
                 *  }
                 * }*/
            }

            treeView.Invalidate();
            plotPanel.InvalidatePlot();
            systemTray.Redraw();
            if (gadget != null)
            {
                gadget.Redraw();
            }

            if (wmiProvider != null)
            {
                wmiProvider.Update();
            }


            if (logSensors.Value && delayCount >= 4)
            {
                logger.Log();
            }

            if (delayCount < 4)
            {
                delayCount++;
            }
        }
Beispiel #8
0
        public void timer_Tick(object sender, EventArgs e)
        {
            computer.Accept(updateVisitor);

            {
                /*string tmp = "";
                 * tmp += string.Format("{0};", (int)MaxTemp(computer, HardwareType.GpuAti) + AvgTemp(computer, HardwareType.GpuNvidia));
                 * tmp += string.Format("{0};", (int)MaxTemp(computer, HardwareType.CPU));
                 * tmp += string.Format("{0};", (int)MaxTemp(computer, HardwareType.Mainboard));
                 * tmp += string.Format("{0};", (int)MaxTemp(computer, HardwareType.HDD));
                 * tmp += string.Format("{0};", (int)(UsageInPercent(computer, HardwareType.GpuAti, "GPU Core") + UsageInPercent(computer, HardwareType.GpuNvidia, "GPU Core")));
                 * tmp += string.Format("{0};", (int)UsageInPercent(computer, HardwareType.CPU, "CPU Total"));
                 * tmp += string.Format("{0};", (int)UsageInPercent(computer, HardwareType.RAM, "Memory"));
                 * tmp += string.Format("{0};", (int)UsageInPercent(computer, HardwareType.GpuAti, "GPU Memory") + UsageInPercent(computer, HardwareType.GpuNvidia, "GPU Memory"));*/

                var gpuMaxTemp = Math.Max(
                    (int)MaxTemp(computer, HardwareType.GpuNvidia),
                    (int)MaxTemp(computer, HardwareType.GpuAti)
                    );
                var gpuMaxUsage = Math.Max(
                    (int)UsageInPercent(computer, HardwareType.GpuAti, "GPU Core"),
                    (int)UsageInPercent(computer, HardwareType.GpuNvidia, "GPU Core")
                    );
                var gpuMaxMemory = Math.Max(
                    (int)UsageInPercent(computer, HardwareType.GpuAti, "GPU Memory"),
                    (int)UsageInPercent(computer, HardwareType.GpuNvidia, "GPU Memory")
                    );

                List <float> data = new List <float>
                {
                    (int)MaxTemp(computer, HardwareType.CPU),
                    gpuMaxTemp,
                    (int)MaxTemp(computer, HardwareType.Mainboard),
                    (int)MaxTemp(computer, HardwareType.HDD),
                    (int)UsageInPercent(computer, HardwareType.CPU, "CPU Total"),
                    (int)gpuMaxUsage,
                    (int)UsageInPercent(computer, HardwareType.RAM, "Memory"),
                    (int)gpuMaxMemory,

                    // Right group.
                    settings.GetValue("nMaxFan", 100),
                    settings.GetValue("nMinFan", 20),
                    settings.GetValue("nMaxTemp", 100),
                    settings.GetValue("nMinTemp", 10),

                    // Flags
                    settings.GetValue("chkManualFan", false) ? 1 : 0,
                    settings.GetValue("chkManualColor", false) ? 1 : 0,

                    // Sliders.
                    settings.GetValue("sldManualFan", 50),
                    settings.GetValue("sldManualColor", 500),
                    settings.GetValue("sldLedBrightness", 50),
                    settings.GetValue("sldPlotInterval", 5),

                    settings.GetValue("cboMaxTempSource", 0),
                };

                string tmp = string.Join(";", data.Select(T => T.ToString()).ToArray());

                serial.Write(Encoding.ASCII.GetBytes(tmp));
                serial.Write(Encoding.ASCII.GetBytes("E"));

                /*var gpus = computer.Hardware.Where(x => x.HardwareType == HardwareType.GpuAti || x.HardwareType == HardwareType.GpuNvidia).ToArray();
                 * if (gpus.Any())
                 * {
                 *  var gpu = gpus.First();
                 *  var temps = gpu.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("gpu: {0}C\r", (int)temp);
                 *  }
                 * }
                 *
                 * var cpus = computer.Hardware.Where(x => x.HardwareType == HardwareType.CPU).ToArray();
                 *
                 * if (cpus.Any())
                 * {
                 *  var cpu = cpus.First();
                 *  var temps = cpu.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("cpu: {0}C\r", (int)temp);
                 *  }
                 * }
                 *
                 * var mainboard = computer.Hardware.Where(x => x.HardwareType == HardwareType.Mainboard).Single();
                 * {
                 *  var temps = mainboard.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("mainboard: {0}C\r", (int)temp);
                 *  }
                 * }
                 *
                 * var hdds = computer.Hardware.Where(x => x.HardwareType == HardwareType.CPU).ToArray();
                 *
                 * if (hdds.Any())
                 * {
                 *  var cpu = cpus.First();
                 *  var temps = cpu.Sensors.Where(x => x.SensorType == SensorType.Temperature).ToArray();
                 *  if (temps.Any())
                 *  {
                 *      var temp = temps.Average(x => x.Value.Value);
                 *      tmp += string.Format("hdd: {0}C\r", (int)temp);
                 *  }
                 * }*/
            }

            treeView.Invalidate();
            plotPanel.InvalidatePlot();
            systemTray.Redraw();
            if (gadget != null)
            {
                gadget.Redraw();
            }

            if (wmiProvider != null)
            {
                wmiProvider.Update();
            }

            if (logSensors.Value && delayCount >= 4)
            {
                logger.Log();
            }

            if (delayCount < 4)
            {
                delayCount++;
            }
        }