Пример #1
0
        private void COLORS_ColorChanged(object sender, ColorsPageEventArgs e)
        {
            if (!UCCom.IsOpen)
            {
                return;
            }

            byte what;

            switch (e.Setting)
            {
            case ColorsPageEventArgs.ChangedSetting.RedCutoff:
                what = Constants.IVAD_SETTING_RED_CUTOFF;
                break;

            case ColorsPageEventArgs.ChangedSetting.GreenCutoff:
                what = Constants.IVAD_SETTING_GREEN_CUTOFF;
                break;

            case ColorsPageEventArgs.ChangedSetting.BlueCutoff:
                what = Constants.IVAD_SETTING_BLUE_CUTOFF;
                break;

            case ColorsPageEventArgs.ChangedSetting.RedDrive:
                what = Constants.IVAD_SETTING_RED_DRIVE;
                break;

            case ColorsPageEventArgs.ChangedSetting.GreenDrive:
                what = Constants.IVAD_SETTING_GREEN_DRIVE;
                break;

            case ColorsPageEventArgs.ChangedSetting.BlueDrive:
                what = Constants.IVAD_SETTING_BLUE_DRIVE;
                break;

            default:
                Trace.Fail("Unknown setting changed.");
                return;
            }

            try
            {
                UCCom.SendCommand(3, what, (byte)e.NewValue);
            }
            catch (UCComException ex)
            {
                MessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, StringRes.StringRes.CantPerformChange,
                                                    ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            this.applyButton.Enabled = true;
        }
Пример #2
0
 protected virtual void OnColorChanged(ColorsPageEventArgs e)
 {
     ColorChanged?.Invoke(this, e);
 }