Ejemplo n.º 1
0
 public MainForm()
 {
     InitializeComponent();
     this.PowerStatus = (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online);
     this.adlt        = new ADLTemperature();
     try
     {
         int status = ADL.ADL_Main_Control_Create(1);
         if (status == ADL.ADL_OK)
         {
             this.adlp = new ADLPMActivity();
             int numberOfAdapters = 0;
             ADL.ADL_Adapter_NumberOfAdapters_Get(ref numberOfAdapters);
             if (numberOfAdapters > 0)
             {
                 ADLAdapterInfo[] adapterInfo = new ADLAdapterInfo[numberOfAdapters];
                 if (ADL.ADL_Adapter_AdapterInfo_Get(adapterInfo) == ADL.ADL_OK)
                 {
                     for (int i = 0; i < numberOfAdapters; i++)
                     {
                         int isActive;
                         ADL.ADL_Adapter_Active_Get(adapterInfo[i].AdapterIndex,
                                                    out isActive);
                         if (isActive == 1)
                         {
                             this.gpuAdapterIndex = adapterInfo[i].AdapterIndex;
                         }
                     }
                 }
             }
         }
         else
         {
             throw new Exception("Az adapter kiolvasása nem volt sikeres!");
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Az alkalmazás indítása nem sikerült: " + e.ToString());
         Environment.Exit(-1);
     }
     this.chbAutomatic.Checked = true;
 }
Ejemplo n.º 2
0
        private void refreshTimer_Tick(object sender, EventArgs e)
        {
            if (ADL.ADL_Overdrive5_CurrentActivity_Get(gpuAdapterIndex, ref adlp) == ADL.ADL_OK)
            {
                EngineClock = adlp.EngineClock;
                MemoryClock = adlp.MemoryClock;
                GpuLoad     = (byte)Math.Min(adlp.ActivityPercent, 100);
            }


            if (ADL.ADL_Overdrive5_Temperature_Get(gpuAdapterIndex, 0, ref adlt)
                == ADL.ADL_OK)
            {
                GpuTemp = adlt.Temperature;
            }

            PowerStatus = (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online);
            if (automaticHandling)
            {
                byte actualValue = GpuLoad;
                if (actualValue == 0)
                {
                    nullacounter++;
                }
                if (actualValue != 0 || nullacounter > 5)
                {
                    if (counter == 1)
                    {
                        gpuLoad1 = actualValue;
                    }
                    if (counter % 5 == 0)
                    {
                        gpuLoad2 = actualValue;
                        counter  = 0;
                    }
                    counter++;
                    nullacounter = 0;
                }

                if (PowerStatus)
                {
                    if (((gpuLoad1 + gpuLoad2) / 2) > 40)
                    {
                        ModifyVideoCardClock(500, 800);
                    }
                    else
                    {
                        if (counter == 1)
                        {
                            ModifyVideoCardClock(300, 350);
                        }
                    }
                }
                else
                {
                    ModifyVideoCardClock(300, 300);
                }
            }
            else
            {
                if (radioButton1.Checked)
                {
                    ModifyVideoCardClock(300, 300);
                }
                else
                {
                    ModifyVideoCardClock(500, 800);
                }
            }
        }