Beispiel #1
0
        private void onOptionButtonClick(object sender, EventArgs e)
        {
            var form = new OptionForm();

            form.OnExitHandler += onRestartProgram;
            if (form.ShowDialog() == DialogResult.OK)
            {
                HardwareManager.getInstance().restartTimer(OptionManager.getInstance().Interval);

                // start icon update
                if (OptionManager.getInstance().IsAnimation == true)
                {
                    mFanIconTimer.Start();
                }
                else
                {
                    mFanIconTimer.Stop();
                }
            }
        }
Beispiel #2
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();
                    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();

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