コード例 #1
0
 //Method for initialization of states of app
 private void BatteryLoad(object sender, EventArgs e)
 {
     //Getting the state of time of the battery
     _manager.Init();
     if (_manager.Charging == "Online")
     {
         timeoutBox.Enabled = false;
     }
     UpdateBattery(null, null);
     //Setting the event of timer
     UpdateTimer.Tick    += UpdateBattery;
     UpdateTimer.Interval = 2000;
     UpdateTimer.Start();
     if (_manager.PreviousScreenTime > 300)
     {
         _manager.PreviousScreenTime = 300;
     }
     if (_manager.PreviousScreenTime == 0)
     {
         _manager.PreviousScreenTime = 1;
     }
     timeoutBox.SelectedIndex = timeoutBox.FindString(_manager.PreviousScreenTime.ToString());
     timeoutSeconds.Text      = (Int32.Parse(_manager.PreviousScreenTime.ToString()) * 60).ToString();
     timeoutLabel.Text        = "Время отключения дисплея " + timeoutBox.SelectedItem.ToString() + " минут.";
 }
コード例 #2
0
        private void BatteryLoad(object sender, EventArgs e)
        {
            _batteryManager.Init();
            UpdateBattery(null, null);

            UpdateTimer.Tick    += UpdateBattery;
            UpdateTimer.Interval = 2000;
            UpdateTimer.Start();
        }
コード例 #3
0
ファイル: Battery.cs プロジェクト: Dhoine/Battery
        private void Battery_Load(object sender, EventArgs e)
        {
            _manager.Init();
            if (_manager.State == "Online")
            {
                timeoutBar.Enabled = false;
            }
            UpdateBatteryStatus(null, null);
            UpdateTimer.Tick    += UpdateBatteryStatus;
            UpdateTimer.Interval = 2000;
            UpdateTimer.Start();

            timeoutBar.Value  = _manager.PrevTimeout;
            timeoutLabel.Text = @"Screen timeout in minutes(only for battery) 
" + timeoutBar.Value + @" min now.";
        }
コード例 #4
0
        // Метод для инициализации состояния батареи.
        private void BatteryLoad(object sender, EventArgs e)
        {
            // Получаем состояние батареи.
            m_Manager.Init();
            if (m_Manager.Charging == "Online")
            {
                timeoutBox.Enabled = false;
            }
            UpdateBattery(null, null);
            // Установка события таймера.
            // Добавляем метод, который будет вызывать таймер.
            UpdateTimer.Tick    += UpdateBattery;
            UpdateTimer.Interval = 2000;
            UpdateTimer.Start();

            timeoutBox.SelectedIndex = timeoutBox.FindString(m_Manager.PreviousScreenTime.ToString());
            timeoutLabel.Text        = "Display time: ";
        }