Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            fan = new ClevoEcInfo();

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);

            computer = new Computer()
            {
                CPUEnabled = true,
                GPUEnabled = true
            };

            maxFanTable.Fan40 = 100;
            maxFanTable.Fan45 = 100;
            maxFanTable.Fan50 = 100;
            maxFanTable.Fan55 = 100;
            maxFanTable.Fan60 = 100;
            maxFanTable.Fan65 = 100;
            maxFanTable.Fan70 = 100;
            maxFanTable.Fan75 = 100;
            maxFanTable.Fan80 = 100;
            maxFanTable.Fan85 = 100;

            defaultCpuFanTable.Fan40 = 40;
            defaultCpuFanTable.Fan45 = 40;
            defaultCpuFanTable.Fan50 = 40;
            defaultCpuFanTable.Fan55 = 40;
            defaultCpuFanTable.Fan60 = 50;
            defaultCpuFanTable.Fan65 = 50;
            defaultCpuFanTable.Fan70 = 60;
            defaultCpuFanTable.Fan75 = 60;
            defaultCpuFanTable.Fan80 = 70;
            defaultCpuFanTable.Fan85 = 70;

            defaultGpuFanTable.Fan40 = 40;
            defaultGpuFanTable.Fan45 = 40;
            defaultGpuFanTable.Fan50 = 40;
            defaultGpuFanTable.Fan55 = 40;
            defaultGpuFanTable.Fan60 = 50;
            defaultGpuFanTable.Fan65 = 50;
            defaultGpuFanTable.Fan70 = 60;
            defaultGpuFanTable.Fan75 = 60;
            defaultGpuFanTable.Fan80 = 70;
            defaultGpuFanTable.Fan85 = 70;

            cpuFanTable = defaultCpuFanTable;
            gpuFanTable = defaultGpuFanTable;

            LoadFanTableAndConfig();

            SetSliderValuesFromTable();

            prgCPUFan.Width = 0;
            prgGPUFan.Width = 0;

            computer.Open();
            tmrMain.Interval = SLEEP_TIME_BETWEEN_MEASUREMENTS;
            tmrMain.Enabled  = true;
        }
Ejemplo n.º 2
0
 private void btnProfileMax_CheckedChanged(object sender, EventArgs e)
 {
     if (btnProfileMax.Checked)
     {
         cpuFanTable               = maxFanTable;
         gpuFanTable               = maxFanTable;
         tabFanCurves.Enabled      = false;
         mnuProfileManual.Checked  = false;
         mnuProfileDefault.Checked = false;
         mnuProfileMax.Checked     = true;
     }
 }
Ejemplo n.º 3
0
 private void btnProfile50_CheckedChanged(object sender, EventArgs e)
 {
     if (btnProfile50.Checked)
     {
         cpuFanTable = halfFanTable;
         gpuFanTable = halfFanTable;
         //tabFanCurves.Enabled = false;
         mnuProfileManual.Checked  = false;
         mnuProfileDefault.Checked = false;
         mnuProfileMax.Checked     = false;
         mnuProfile50.Checked      = true;
         clevoAutoFans             = false;
     }
 }
Ejemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            fan = new ClevoEcInfo();

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);

            //computer = new Computer() {
            //    CPUEnabled = true,
            //    GPUEnabled = true
            //};

            maxFanTable.Fan40 = 100;
            maxFanTable.Fan45 = 100;
            maxFanTable.Fan50 = 100;
            maxFanTable.Fan55 = 100;
            maxFanTable.Fan60 = 100;
            maxFanTable.Fan65 = 100;
            maxFanTable.Fan70 = 100;
            maxFanTable.Fan75 = 100;
            maxFanTable.Fan80 = 100;
            maxFanTable.Fan85 = 100;

            halfFanTable.Fan40 = 50;
            halfFanTable.Fan45 = 50;
            halfFanTable.Fan50 = 50;
            halfFanTable.Fan55 = 50;
            halfFanTable.Fan60 = 50;
            halfFanTable.Fan65 = 50;
            halfFanTable.Fan70 = 50;
            halfFanTable.Fan75 = 50;
            halfFanTable.Fan80 = 50;
            halfFanTable.Fan85 = 50;

            defaultCpuFanTable.Fan40 = 40;
            defaultCpuFanTable.Fan45 = 40;
            defaultCpuFanTable.Fan50 = 40;
            defaultCpuFanTable.Fan55 = 40;
            defaultCpuFanTable.Fan60 = 50;
            defaultCpuFanTable.Fan65 = 50;
            defaultCpuFanTable.Fan70 = 60;
            defaultCpuFanTable.Fan75 = 60;
            defaultCpuFanTable.Fan80 = 70;
            defaultCpuFanTable.Fan85 = 70;

            defaultGpuFanTable.Fan40 = 40;
            defaultGpuFanTable.Fan45 = 40;
            defaultGpuFanTable.Fan50 = 40;
            defaultGpuFanTable.Fan55 = 40;
            defaultGpuFanTable.Fan60 = 50;
            defaultGpuFanTable.Fan65 = 50;
            defaultGpuFanTable.Fan70 = 60;
            defaultGpuFanTable.Fan75 = 60;
            defaultGpuFanTable.Fan80 = 70;
            defaultGpuFanTable.Fan85 = 70;

            cpuFanTable = defaultCpuFanTable;
            gpuFanTable = defaultGpuFanTable;

            LoadFanTableAndConfig();

            SetSliderValuesFromTable();

            prgCPUFan.Width = 0;
            prgGPUFan.Width = 0;

            //computer.Open();
            //cpuHardware = computer.Hardware[0];
            //gpuHardware = computer.Hardware[1];

            tmrMain.Interval = EC_POLL_INTERVAL;
            tmrMain.Enabled  = true;

            WindowState     = FormWindowState.Minimized;
            ShowInTaskbar   = false;
            FormBorderStyle = FormBorderStyle.None;
            Visible         = false;
        }
Ejemplo n.º 5
0
        private void LoadFanTableAndConfig()
        {
            var fanCurveFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\userfancurve.cfg";

            if (!File.Exists(fanCurveFile))
            {
                SaveFanTableAndConfig();
            }

            using (var sw = new StreamReader(fanCurveFile)) {
                userCpuFanTable.Fan40 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan45 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan50 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan55 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan60 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan65 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan70 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan75 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan80 = Convert.ToInt32(sw.ReadLine());
                userCpuFanTable.Fan85 = Convert.ToInt32(sw.ReadLine());
                cpuFanTable           = userCpuFanTable;

                userGpuFanTable.Fan40 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan45 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan50 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan55 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan60 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan65 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan70 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan75 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan80 = Convert.ToInt32(sw.ReadLine());
                userGpuFanTable.Fan85 = Convert.ToInt32(sw.ReadLine());
                gpuFanTable           = userGpuFanTable;
            }

            var configFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\ClevoFanControl.cfg";

            if (!File.Exists(configFile))
            {
                SaveFanTableAndConfig();
            }

            int wLeft = 0, wTop = 0;

            try {
                using (var sw = new StreamReader(configFile)) {
                    var profile = sw.ReadLine();
                    if (profile == "1")
                    {
                        btnProfileManual.Checked  = true;
                        mnuProfileManual.Checked  = true;
                        mnuProfileDefault.Checked = false;
                        mnuProfileMax.Checked     = false;
                        mnuProfile50.Checked      = false;
                    }
                    else if (profile == "2")
                    {
                        btnProfileDefault.Checked = true;
                        mnuProfileManual.Checked  = false;
                        mnuProfileDefault.Checked = true;
                        mnuProfileMax.Checked     = false;
                        mnuProfile50.Checked      = false;
                    }
                    else if (profile == "3")
                    {
                        btnProfileMax.Checked     = true;
                        mnuProfileManual.Checked  = false;
                        mnuProfileDefault.Checked = false;
                        mnuProfileMax.Checked     = true;
                        mnuProfile50.Checked      = false;
                    }
                    else if (profile == "4")
                    {
                        btnProfile50.Checked      = true;
                        mnuProfileManual.Checked  = false;
                        mnuProfileDefault.Checked = false;
                        mnuProfileMax.Checked     = true;
                        mnuProfile50.Checked      = true;
                    }

                    wLeft = Convert.ToInt32(sw.ReadLine());
                    wTop  = Convert.ToInt32(sw.ReadLine());

                    lastWLeft = wLeft;
                    lastWTop  = wTop;

                    btnAlwaysOnTop.Checked    = Convert.ToBoolean(sw.ReadLine());
                    btnACFans.Checked         = Convert.ToBoolean(sw.ReadLine());
                    txtCpuSafetyTemp.Value    = Convert.ToInt32(sw.ReadLine());
                    cpuSafetyTemp             = Convert.ToInt32(txtCpuSafetyTemp.Value);
                    txtGpuSafetyTemp.Value    = Convert.ToInt32(sw.ReadLine());
                    gpuSafetyTemp             = Convert.ToInt32(txtGpuSafetyTemp.Value);
                    btnGpuBattMonitor.Checked = Convert.ToBoolean(sw.ReadLine());
                }
            } catch { }

            Left = wLeft;
            Top  = wTop;

            if (!IsOnScreen(this))
            {
                wLeft     = (Screen.PrimaryScreen.Bounds.Width / 2) - (619 / 2);
                wTop      = (Screen.PrimaryScreen.Bounds.Height / 2) - (641 / 2);
                lastWLeft = wLeft;
                lastWTop  = wTop;
                Left      = wLeft;
                Top       = wTop;
            }
        }