Example #1
0
        public override void update()
        {
            try
            {
                var device = HWInfoManager.getInstance().getHWInfoDevice(mCategoryID, mDeviceID);
                if (device == null)
                {
                    return;
                }

                DoubleValue = device.Value;

                if (device.Unit.Equals("°C") == true || device.Unit.Equals("°F") == true)
                {
                    if (OptionManager.getInstance().IsFahrenheit == true && device.Unit.Equals("°C") == true)
                    {
                        int value = (int)Math.Round(DoubleValue);
                        DoubleValue = (double)Util.getFahrenheit(value);
                    }

                    else if (OptionManager.getInstance().IsFahrenheit == false && device.Unit.Equals("°F") == true)
                    {
                        int value = (int)Math.Round(DoubleValue);
                        DoubleValue = (double)Util.getCelsius(value);
                    }
                }
            }
            catch { }
        }
Example #2
0
        public override string getString()
        {
            this.update();

            try
            {
                var device = HWInfoManager.getInstance().getHWInfoDevice(mCategoryID, mDeviceID);
                if (device == null)
                {
                    return(Value.ToString());
                }

                // Voltage
                if (device.Unit.Equals("V") == true)
                {
                    return(string.Format("{0:0.00}", DoubleValue));
                }

                // Yes/No
                else if (device.Unit.Equals("Yes/No") == true)
                {
                    Value = (int)Math.Round(DoubleValue);
                    return((Value > 0) ? "Yes" : "No");
                }

                else
                {
                    Value = (int)Math.Round(DoubleValue);
                    return(Value.ToString());
                }
            }
            catch { }
            return("");
        }
Example #3
0
        public override void update()
        {
            try
            {
                var device = HWInfoManager.getInstance().getHWInfoDevice(mCategoryID, mDeviceID);
                if (device == null)
                {
                    return;
                }

                int value = (int)Math.Round(device.Value);
                if (device.Unit.Equals("°C") == true)
                {
                    if (Value != value)
                    {
                        Value = value;
                    }
                }
                else
                {
                    value = Util.getCelsius(value);
                    if (Value != value)
                    {
                        Value = value;
                    }
                }
            }
            catch { }
        }
Example #4
0
        private void onReloadButtonClick(object sender, EventArgs e)
        {
            HardwareManager.getInstance().stop();
            ControlManager.getInstance().reset();
            OSDManager.getInstance().reset();

            if (OptionManager.getInstance().IsHWInfo == false)
            {
                HWInfoManager.getInstance().reset();
                HWInfoManager.getInstance().write();
            }

            this.reload();
        }
Example #5
0
        public string getUnitString()
        {
            try
            {
                var device = HWInfoManager.getInstance().getHWInfoDevice(mCategoryID, mDeviceID);
                if (device == null)
                {
                    return("");
                }

                return(device.Unit);
            }
            catch { }
            return("");
        }
Example #6
0
        public override void update()
        {
            try
            {
                var device = HWInfoManager.getInstance().getHWInfoDevice(mCategoryID, mDeviceID);
                if (device == null)
                {
                    return;
                }

                int value = (int)Math.Round(device.Value);
                if (Value != value)
                {
                    Value = value;
                }
            }
            catch { }
        }
Example #7
0
        private void onOptionButtonClick(object sender, EventArgs e)
        {
            var form   = new OptionForm();
            var result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                HardwareManager.getInstance().restartTimer();

                // start icon update
                if (OptionManager.getInstance().IsAnimation == true)
                {
                    if (mFanIconTimer == null)
                    {
                        mFanIconTimer          = new System.Windows.Forms.Timer();
                        mFanIconTimer.Interval = 100;
                        mFanIconTimer.Tick    += onFanIconTimer;
                        mFanIconTimer.Start();
                    }
                }
                else
                {
                    if (mFanIconTimer != null)
                    {
                        mFanIconTimer.Stop();
                        mFanIconTimer.Dispose();
                        mFanIconTimer = null;
                    }

                    mTrayIcon.Icon = mFanIconList[0];
                    mFanIconIndex  = 0;
                }
            }

            // Changed option data
            else if (result == DialogResult.Yes)
            {
                this.BeginInvoke(new Action(delegate()
                {
                    HardwareManager.getInstance().stop();
                    ControlManager.getInstance().reset();
                    OSDManager.getInstance().reset();

                    if (OptionManager.getInstance().IsHWInfo == false)
                    {
                        HWInfoManager.getInstance().reset();
                        HWInfoManager.getInstance().write();
                    }

                    this.reload();
                }));
            }

            // Reset option data
            else if (result == DialogResult.No)
            {
                this.BeginInvoke(new Action(delegate()
                {
                    HardwareManager.getInstance().stop();
                    HardwareManager.getInstance().write();
                    ControlManager.getInstance().reset();
                    ControlManager.getInstance().write();
                    OSDManager.getInstance().reset();
                    OSDManager.getInstance().write();
                    HWInfoManager.getInstance().reset();
                    HWInfoManager.getInstance().write();

                    this.reload();
                }));
            }
        }