예제 #1
0
        /// <summary>
        /// Changes states of the Preset Control
        /// </summary>
        /// <param name="value"></param>
        private void ChangeState(PresetStates value)
        {
            PresetStates prevState = m_state;

            m_state = value;

            switch (m_state)
            {
            case PresetStates.Selected:
            {
                ShowSelectedLed();

                presetIdLabel.ForeColor    = LABEL_ACTIVE_COLOR;
                presetIdLabel.RegularColor = LABEL_ACTIVE_COLOR;

                // Don't fire event in case this is a Cancel of WaitForSave
                if (prevState == PresetStates.WaitForSave)
                {
                    break;
                }

                if (PresetSelected != null)
                {
                    PresetSelected(this, EventArgs.Empty);
                }

                break;
            }

            case PresetStates.WaitForSave:
            {
                ledPictureBox.Image = Resources.amber_on_16;


                break;
            }

            case PresetStates.Saving:
            {
                BlinkLed(Resources.red_off_16, Resources.amber_on_16, 2, 200);

                if (PresetSaveSelected != null)
                {
                    PresetSaveSelected(this, EventArgs.Empty);
                }

                this.State = PresetControl.PresetStates.Selected;

                break;
            }

            default:
                ShowRegularLed();
                presetIdLabel.ForeColor    = LABEL_INACTIVE_COLOR;
                presetIdLabel.RegularColor = LABEL_INACTIVE_COLOR;

                break;
            }
        }
예제 #2
0
        /// <summary>
        /// Changes states of the Preset Control
        /// </summary>
        /// <param name="value"></param>
        private void ChangeState(PresetStates value)
        {
            PresetStates prevState = m_state;
            m_state = value;

            switch (m_state)
            {
                case PresetStates.Selected:
                    {
                        ShowSelectedLed();

                        // Don't fire event in case this is a Cancel of WaitForSave
                        if (prevState == PresetStates.WaitForSave)
                        {
                            break;
                        }

                        if (PresetSelected != null)
                        {
                            PresetSelected(this, EventArgs.Empty);
                        }

                        break;
                    }
                case PresetStates.WaitForSave:
                    {
                        ledPictureBox.Image = Resources.amber_on_16;

                        break;
                    }
                case PresetStates.Saving:
                    {
                        BlinkLed(Resources.red_off_16, Resources.amber_on_16, 2, 200);

                        if (PresetSaveSelected != null)
                        {
                            PresetSaveSelected(this, EventArgs.Empty);
                        }

                        this.State = PresetControl.PresetStates.Selected;

                        break;
                    }

                default:
                    ShowRegularLed();
                    break;
            }
        }