Пример #1
0
        /* ----------------------------------------------------------------- */
        /// SaveSetting
        /* ----------------------------------------------------------------- */
        private void SaveSetting(PowerSetting dest)
        {
            if (dest == null) return;

            dest.MonitorTimeout = Translator.ExpireTypeToSecond(
                Translator.IndexToExpireType(this.MonitorComboBox.SelectedIndex));
            dest.DiskTimeout = Translator.ExpireTypeToSecond(
                Translator.IndexToExpireType(this.DiskComboBox.SelectedIndex));
            dest.StandByTimeout = Translator.ExpireTypeToSecond(
                Translator.IndexToExpireType(this.StandByComboBox.SelectedIndex));
            dest.HibernationTimeout = Translator.ExpireTypeToSecond(
                Translator.IndexToExpireType(this.HibernationComboBox.SelectedIndex));
            dest.ThrottlePolicy = Translator.IndexToPowerThrottlePolicy(
                this.PowerThrottleComboBox.SelectedIndex);
            dest.MinThrottle = (uint)this.MinPowerThrottleNumericUpDown.Value;
            dest.MaxThrottle = (uint)this.MaxPowerThrottleNumericUpDown.Value;
            dest.DimTimeout = Translator.ExpireTypeToSecond(
                Translator.IndexToExpireType(this.DimComboBox.SelectedIndex));
            dest.Brightness = (uint)this.BrightnessNumericUpDown.Value;
            dest.DimBrightness = (uint)this.DimBrightnessNumericUpDown.Value;
        }
Пример #2
0
 /* ----------------------------------------------------------------- */
 /// GetPowerSetting
 /* ----------------------------------------------------------------- */
 private PowerSetting GetPowerSetting(XmlNode root)
 {
     PowerSetting dest = new PowerSetting();
     for (XmlNode child = root.FirstChild; child != null; child = child.NextSibling) {
         if (child.Name == XML_MONITOR_TIMEOUT && child.HasChildNodes) dest.MonitorTimeout = UInt32.Parse(child.ChildNodes[0].Value);
         else if (child.Name == XML_DISK_TIMEOUT && child.HasChildNodes) dest.DiskTimeout = UInt32.Parse(child.ChildNodes[0].Value);
         else if (child.Name == XML_STANDBY_TIMEOUT && child.HasChildNodes) dest.StandByTimeout = UInt32.Parse(child.ChildNodes[0].Value);
         else if (child.Name == XML_HIBERNATION_TIMEOUT && child.HasChildNodes) dest.HibernationTimeout = UInt32.Parse(child.ChildNodes[0].Value);
         else if (child.Name == XML_DIM_TIMEOUT && child.HasChildNodes) dest.DimTimeout = UInt32.Parse(child.ChildNodes[0].Value);
         else if (child.Name == XML_BRIGHTNESS && child.HasChildNodes) dest.Brightness = UInt32.Parse(child.ChildNodes[0].Value);
         else if (child.Name == XML_DIM_BRIGHTNESS && child.HasChildNodes) dest.DimBrightness = UInt32.Parse(child.ChildNodes[0].Value);
         else if (child.Name == XML_PROCESSOR_POLICY && child.HasChildNodes) {
             dest.ThrottlePolicy = (PowerThrottlePolicy)UInt32.Parse(child.ChildNodes[0].Value);
             foreach (XmlAttribute attr in child.Attributes) {
                 if (attr.Name == "min") dest.MinThrottle = UInt32.Parse(attr.Value);
                 else if (attr.Name == "max") dest.MaxThrottle = UInt32.Parse(attr.Value);
             }
         }
     }
     return dest;
 }
Пример #3
0
        /* ----------------------------------------------------------------- */
        /// LoadSetting
        /* ----------------------------------------------------------------- */
        private void LoadSetting(PowerSetting src)
        {
            if (src == null) return;

            bool prev = this._EnableComboEvents;
            this._EnableComboEvents = false;
            this.MonitorComboBox.SelectedIndex = Translator.ExpireTypeToIndex(
                Translator.SecondToExpireType(src.MonitorTimeout));
            this.DiskComboBox.SelectedIndex = Translator.ExpireTypeToIndex(
                Translator.SecondToExpireType(src.DiskTimeout));
            this.StandByComboBox.SelectedIndex = Translator.ExpireTypeToIndex(
                Translator.SecondToExpireType(src.StandByTimeout));
            this.HibernationComboBox.SelectedIndex = Translator.ExpireTypeToIndex(
                Translator.SecondToExpireType(src.HibernationTimeout));
            this.PowerThrottleComboBox.SelectedIndex = Translator.PowerThrottlePolicyToIndex(src.ThrottlePolicy);
            this.MinPowerThrottleNumericUpDown.Value = src.MinThrottle;
            this.MaxPowerThrottleNumericUpDown.Value = src.MaxThrottle;
            this.DimComboBox.SelectedIndex = Translator.ExpireTypeToIndex(
                Translator.SecondToExpireType(src.DimTimeout));
            this.BrightnessNumericUpDown.Value = src.Brightness;
            this.DimBrightnessNumericUpDown.Value = src.DimBrightness;
            this._EnableComboEvents = prev;

            this.ProfileComboBox.SelectedIndex = this.ProfileComboBox.Items.Count - 1;
            this._DetailGroupBox.Text = "[" + CUSTOM_PROFILE + "] の電源設定";
        }