Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.SetStyle(
                System.Windows.Forms.ControlStyles.UserPaint |
                System.Windows.Forms.ControlStyles.AllPaintingInWmPaint |
                System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer,
                true);
            if (!IsProcessOpen("Core Temp"))
            {
                ProcessStartInfo startInfo = new ProcessStartInfo("Core Temp.exe");
                startInfo.WindowStyle = ProcessWindowStyle.Minimized;

                Process.Start(startInfo);
            }

            if (!IsProcessOpen("GPU-Z"))
            {
                ProcessStartInfo startInfo = new ProcessStartInfo("GPU-Z.0.7.1.exe");
                startInfo.Arguments = "-minimized";

                Process.Start(startInfo);
            }

            Thread.Sleep(5000);

            CTInfo = new CoreTempInfo();

            gpuz = new GpuzWrapper();
            gpuz.Open();

            port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
            button1.PerformClick();
        }
Beispiel #2
0
        public ClevoFanControlService()
        {
            InitializeComponent();

            //Initiate CoreTempInfo class.
            coreTempInfo = new CoreTempInfo();
            //Sign up for an event reporting errors
            coreTempInfo.ReportError += new ErrorOccured(CTInfo_ReportError);


            string      Namespace = @"root\WMI";
            string      className = "CLEVO_GET";
            CimInstance clevo     = new CimInstance(className, Namespace);

            CimSession  mySession      = CimSession.Create("localhost");
            CimInstance searchInstance = mySession.GetInstance(Namespace, clevo);

            // Set up a timer to trigger every minute.
            eventTimer = new Timer
            {
                Interval = 1000 // 60 seconds
            };
            eventTimer.Elapsed += new ElapsedEventHandler(this.OnTimer);
            eventTimer.Start();

            if (!Directory.Exists(clevoAppData))
            {
                Directory.CreateDirectory(clevoAppData);
            }
        }
        public Arduino_Main()
        {
            InitializeComponent();

            ACTnotf.BalloonTipText  = "Arduino conexion opened";
            ACTnotf.BalloonTipTitle = "Arduino CoreTemp Module";

            // ui

            this.WindowState   = FormWindowState.Minimized;
            this.ShowInTaskbar = false;

            // RAM

            totalRam = CI.TotalPhysicalMemory / 1048576;

            // Initiate CoreTempInfo class.
            CTInfo = new CoreTempInfo();

            // setup callbacks
            CTInfo.ReportError       += new ErrorOccured(CTInfo_ReportError);
            ACTnotf.MouseDoubleClick += new MouseEventHandler(ACTnotf_Click);
            this.FormClosing         += new FormClosingEventHandler(frm_FormClosing);
            this.Resize += new System.EventHandler(this.frmMain_Resize);

            // get stored com
            String comHold = Properties.Settings.Default.comPort;

            string[] ports = SerialPort.GetPortNames();

            // set the CB items
            cbCom.Items.AddRange(ports);

            // create and open com
            comPort = new SerialPort(comHold, 19200);
            try
            {
                comPort.Open();
            }
            #pragma warning disable 0168 //variable declared but not used
            catch (Exception expt)
            {
                // not avail main thread will deal with it
            }

            // set the combo box to the prev item
            cbCom.SelectedItem = comHold;

            // setup a timer.
            RefreshInfo          = new System.Timers.Timer();
            RefreshInfo.Interval = 600;
            // setup callback
            RefreshInfo.Elapsed += new ElapsedEventHandler(RefreshInfo_Elapsed);

            // Start Main thread.
            RefreshInfo.Start();
        }
Beispiel #4
0
        public Arduino_Main()
        {
            InitializeComponent();

            ACTnotf.BalloonTipText = "The Module is Still Running Find it Down Here!";
            ACTnotf.BalloonTipTitle = "Arduino CoreTemp Module";

            // ui

            // RAM

            totalRam = CI.TotalPhysicalMemory / 1048576;

            // Initiate CoreTempInfo class.
            CTInfo = new CoreTempInfo();

            // setup callbacks
            CTInfo.ReportError += new ErrorOccured(CTInfo_ReportError);
            ACTnotf.MouseDoubleClick += new MouseEventHandler(ACTnotf_Click);
            this.FormClosing += new FormClosingEventHandler(frm_FormClosing);
            this.Resize += new System.EventHandler(this.frmMain_Resize);

            // get stored com
            String comHold = Properties.Settings.Default.comPort;
            string[] ports = SerialPort.GetPortNames();

            // set the CB items
            cbCom.Items.AddRange(ports);

            // create and open com
            comPort = new SerialPort(comHold, 19200);
            try
            {
                comPort.Open();
            }
            catch (Exception expt)
            {
                // not avail main thread will deal with it
            }

            // set the combo box to the prev item
            cbCom.SelectedItem = comHold;

            // setup a timer.
            RefreshInfo = new System.Timers.Timer();
            RefreshInfo.Interval = 600;
            // setup callback
            RefreshInfo.Elapsed += new ElapsedEventHandler(RefreshInfo_Elapsed);

            // Start Main thread.
            RefreshInfo.Start();
        }
        public string FetchCoreTempInfoXml()
        {
            try
            {
                Trace.WriteLine(String.Format("{0} Fetch Core Temp Info", DateTime.Now.ToLongTimeString()));
                //Initiate CoreTempInfo class.
                CoreTempInfo CTInfo = new CoreTempInfo();

                if (!CTInfo.GetData())
                {
                    Trace.WriteLine(String.Format("\tNo CPU Data"));
                    return(null);
                }

                XDocument result = new XDocument(new XElement("CoreTemp",
                                                              new XAttribute("count", CTInfo.GetCoreCount * CTInfo.GetCPUCount),
                                                              new XAttribute("tjmax", CTInfo.GetTjMax[0]),
                                                              new XAttribute("units", CTInfo.IsFahrenheit ? "F" : "C")));

                for (int i = 0; i < CTInfo.GetCoreCount * CTInfo.GetCPUCount; i++)
                {
                    result.Root.Add(new XElement("Core",
                                                 new XAttribute("load", CTInfo.GetCoreLoad[i]),
                                                 new XAttribute("temp", CTInfo.GetTemp[i])));
                    Trace.WriteLine(String.Format("\tCore {0}: temp {1}; load {2}", i, CTInfo.GetCoreLoad[i], CTInfo.GetTemp[i]));
                }

                var gpuz = new GPUZ.GPUZ();

                if (gpuz.OpenView())
                {
                    var data = gpuz.GetData();

                    var gpu = new XElement("GPU");
                    result.Root.Add(gpu);
                    foreach (var sensor in data.sensors)
                    {
                        switch (sensor.name)
                        {
                        case "":
                            break;

                        case "GPU Load":
                            Trace.WriteLine(String.Format("\t{0} = {1}", sensor.name, sensor.value));
                            gpu.Add(new XAttribute("load", Convert.ToInt32(sensor.value)));
                            continue;

                        case "GPU Temperature":
                            Trace.WriteLine(String.Format("\t{0} = {1}", sensor.name, sensor.value));
                            gpu.Add(new XAttribute("temp", Convert.ToInt32(sensor.value)));
                            continue;

                        default:
                            continue;
                        }
                    }
                    gpuz.CloseView();
                }
                else
                {
                    Trace.WriteLine(String.Format("\tNo GPU Data"));
                }

                return(result.ToString());
            }
            catch (System.Exception)
            {
                return(null);
            }
        }