Beispiel #1
0
 private void FadeCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (PowerType.Text == "Battery")
     {
         fadeCombo.IsEnabled = true;
         ComboBoxItem item = (ComboBoxItem)fadeCombo.SelectedItem;
         PowerManagement.SetNewVideoTimeoutDC(Convert.ToUInt32((string)item.Content, 10));
     }
 }
Beispiel #2
0
        /*private static void initBrightness()
         * {
         *  if (Battery.getPowerType() == "AC")
         *  {
         *      Monitor.SetBrightness(100);
         *  }
         *  else
         *  {
         *      Monitor.SetBrightness(20);
         *  }
         * }*/



        void SystemEvents_PowerModeChanged(object sender, Microsoft.Win32.PowerModeChangedEventArgs e)
        {
            if (e.Mode == PowerModes.StatusChange)
            {
                if (Battery.GetPowerType() == "Battery")
                {
                    fadeCombo.IsEnabled = true;
                    ComboBoxItem item = (ComboBoxItem)fadeCombo.SelectedItem;
                    PowerManagement.SetNewVideoTimeoutDC(Convert.ToUInt32((string)item.Content, 10));
                }
                else
                {
                    fadeCombo.IsEnabled = false;
                    PowerManagement.SetNewVideoTimeoutDC(oldFadeTime);
                }
            }
        }
Beispiel #3
0
 public MainWindow()
 {
     oldFadeTime = PowerManagement.GetVideoTimeoutDC();
     InitializeComponent();
     InitText();
     CreateTimer();
     if (PowerType.Text == "Battery")
     {
         ComboBoxItem item = (ComboBoxItem)fadeCombo.SelectedItem;
         PowerManagement.SetNewVideoTimeoutDC(Convert.ToUInt32((string)item.Content, 10));
     }
     else
     {
         fadeCombo.IsEnabled = false;
     }
     //initBrightness();
     SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
 }