Beispiel #1
0
        /// <summary>
        /// UpdateGUI delegate. Processes and display the power information
        /// provided by the power management on the system.
        /// </summary>
        private void UpdateGUI(object sender, EventArgs e)
        {
            // Get the information
            PowerManagement.PowerInfo powerInfo = base.PowerMgr.GetNextPowerInfo();

            // Determine if we are on battery or AC
            if (powerInfo.Message == PowerManagement.MessageTypes.Status)
            {
                if (powerInfo.ACLineStatus == PowerManagement.ACLineStatus.OnLine)
                {
                    powerTypeLabel.Text = "AC";
                }
                else
                {
                    powerTypeLabel.Text = "Battery";
                }
                // Update Main Battery information
                batteryProgressBar.Value = powerInfo.BatteryLifePercent;
                batteryPercentLabel.Text = powerInfo.BatteryLifePercent.ToString() + "%";

                // Update Backup Battery information
                //batteryProgressBar2.Value = powerInfo.BackupBatteryLifePercent;
                //batteryPercentLabel2.Text = powerInfo.BackupBatteryLifePercent.ToString() + "%";
            }
            else if (powerInfo.Flags == PowerManagement.SystemPowerStates.Suspend)
            {
                // The notification of the loss of power does not actually occur
                // until immediately after it is back.
                lblErrorMessageStatus.Text = "Device resumed from a suspend. ";
            }
        }
Beispiel #2
0
        private void UpdateGUI(object sender, EventArgs e)
        {
            // Check Connection
            this.imgConnect.Image = HTN.BITS.MSC.SCN.UIL.Properties.Resources.Icon_Connect;
            //connect = CheckConnection(MobileConfiguration.Configuration.Settings["RMS_SCN_API"].ToString());

            //if (connect)
            //{
            //    this.imgConnect.Image = Properties.Resources.Icon_Connect;
            //}
            //else
            //{
            //    this.imgConnect.Image = Properties.Resources.Icon_Disconnect;
            //}

            // Check Battery
            PowerManagement.PowerInfo powerInfo = base.PowerMgr.GetNextPowerInfo();

            // Determine if we are on battery or AC
            if (powerInfo.Message == PowerManagement.MessageTypes.Status)
            {
                if (powerInfo.ACLineStatus == PowerManagement.ACLineStatus.OnLine)
                {
                    this.imgMode.Image = HTN.BITS.MSC.SCN.UIL.Properties.Resources.Icon_AC;
                }
                else
                {
                    this.imgMode.Image = HTN.BITS.MSC.SCN.UIL.Properties.Resources.Icon_Battery;
                }

                this.checkBattery(Convert.ToInt32(powerInfo.BatteryLifePercent));
            }
            else if (powerInfo.Flags == PowerManagement.SystemPowerStates.Suspend)
            {
                lblErrorMessageStatus.Text = "Device resumed from a suspend. ";
            }
        }
Beispiel #3
0
        /// <summary>
        /// UpdateGUI delegate. Processes and display the power information
        /// provided by the power management on the system.
        /// </summary>
        private void UpdateGUI(object sender, EventArgs e)
        {
            try
            {
                // Get the information

                PowerManagement.PowerInfo powerInfo = base.PowerMgr.GetNextPowerInfo();

                this.ShowBattery();

                this.IP_ADDRESS = string.Format("IP: {0}", GlobalVariable.GetIPAddress());
                // Determine if we are on battery or AC
                //if (powerInfo.Message == PowerManagement.MessageTypes.Status)
                //{
                //    //if (powerInfo.ACLineStatus == PowerManagement.ACLineStatus.OnLine)
                //    //{
                //    //    this.imgMode.Image = Properties.Resources.Icon_AC;
                //    //}
                //    //else
                //    //{
                //    //    this.imgMode.Image = Properties.Resources.Icon_Battery;
                //    //}

                //    //this.checkBattery(Convert.ToInt32(powerInfo.BatteryLifePercent));

                //}
                //else if (powerInfo.Flags == PowerManagement.SystemPowerStates.Suspend)
                //{
                //    lblErrorMessageStatus.Text = "Device resumed from a suspend. ";
                //}
            }
            catch (Exception ex)
            {
                //
            }
        }