Esempio n. 1
0
        private void UpdatePagesFromSRAM()
        {
            Trace.Assert(UCCom.IsOpen, "UCCom has no connection at the moment!");

            byte[] sram;

            try
            {
                sram = UCCom.SendCommand(2, 0, 0);
            }
            catch (UCComException ex)
            {
                MessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, StringRes.StringRes.CantUpdatePages,
                                                    ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            this.SCREEN.SetValues(sram[Constants.CONFIG_OFFSET_BRIGHTNESS], sram[Constants.CONFIG_OFFSET_BRIGHTNESS_DRIVE], sram[Constants.CONFIG_OFFSET_CONTRAST]);

            this.COLORS.SetValues(
                sram[Constants.CONFIG_OFFSET_RED_CUTOFF], sram[Constants.CONFIG_OFFSET_GREEN_CUTOFF], sram[Constants.CONFIG_OFFSET_BLUE_CUTOFF],
                sram[Constants.CONFIG_OFFSET_RED_DRIVE], sram[Constants.CONFIG_OFFSET_GREEN_DRIVE], sram[Constants.CONFIG_OFFSET_BLUE_DRIVE]);

            this.GEOMETRY.SetValues(sram[Constants.CONFIG_OFFSET_HORIZONTAL_POS], sram[Constants.CONFIG_OFFSET_HEIGHT],
                                    sram[Constants.CONFIG_OFFSET_VERTICAL_POS], sram[Constants.CONFIG_OFFSET_KEYSTONE], sram[Constants.CONFIG_OFFSET_PINCUSHION],
                                    sram[Constants.CONFIG_OFFSET_PINCUSHION_BALANCE], sram[Constants.CONFIG_OFFSET_S_CORRECTION], sram[Constants.CONFIG_OFFSET_WIDTH],
                                    sram[Constants.CONFIG_OFFSET_PARALLELOGRAM], sram[Constants.CONFIG_OFFSET_ROTATION]);
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        private void cancelButton_Click(object sender, EventArgs e)
        {
            if (UCCom.IsOpen)
            {
                try
                {
                    UCCom.SendCommand(4, 0, 0);
                }
                catch (UCComException ex)
                {
                    MessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, StringRes.StringRes.CantUndoChanges,
                                                        ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
            }

            Close();
        }
Esempio n. 4
0
        private void SCREEN_BrightnessDriveChanged(object sender, ScreenPageEventArgs e)
        {
            if (!UCCom.IsOpen)
            {
                return;
            }

            try
            {
                UCCom.SendCommand(3, Constants.IVAD_SETTING_BRIGHTNESS_DRIVE, (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;
        }
Esempio n. 5
0
        private void refreshButton_Click(object sender, EventArgs e)
        {
            Trace.Assert(UCCom.IsOpen, "UCCom has no connection at the moment!");

            this.refreshButton.Enabled = false;
            this.UseWaitCursor         = true;
            this.listView.BeginUpdate();
            Application.DoEvents();

            byte[] sram;

            try
            {
                sram = UCCom.SendCommand(2, 0, 0);
            }
            catch (UCComException ex)
            {
                MessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, StringRes.StringRes.CantUpdatePages,
                                                    ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                for (int i = 0; i < this.listView.Items.Count; i++)
                {
                    this.listView.Items[i].SubItems[1].Text = "?";
                    this.listView.Items[i].SubItems[2].Text = "?";
                }

                goto end;
            }

            for (int i = 0; i < sram.Length; i++)
            {
                this.listView.Items[i].SubItems[1].Text = string.Format(CultureInfo.InvariantCulture, "0x{0:X2}", sram[i]);
                this.listView.Items[i].SubItems[2].Text = string.Format(CultureInfo.InvariantCulture, "{0}", sram[i]);
            }

end:
            this.refreshButton.Enabled = true;
            this.UseWaitCursor         = false;
            this.listView.EndUpdate();
        }
Esempio n. 6
0
        private void defaultsButton_Click(object sender, EventArgs e)
        {
            if (!UCCom.IsOpen)
            {
                return;
            }

            try
            {
                UCCom.SendCommand(5, 0, 0);
            }
            catch (UCComException ex)
            {
                MessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, StringRes.StringRes.CantResetDefaults,
                                                    ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            UpdatePagesFromSRAM();
            this.applyButton.Enabled = false;
        }
Esempio n. 7
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            Settings.Save();

            if (!UCCom.IsOpen)
            {
                goto end;
            }

            try
            {
                UCCom.SendCommand(6, 0, 0);
            }
            catch (UCComException ex)
            {
                MessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, StringRes.StringRes.CantApplyChanges,
                                                    ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                return; // Not "goto end;" to allow trying again
            }

end:
            this.applyButton.Enabled = false;
        }
Esempio n. 8
0
        private void GEOMETRY_GeometryChanged(object sender, GeometryPageEventArgs e)
        {
            if (!UCCom.IsOpen)
            {
                return;
            }

            byte what;

            switch (e.What)
            {
            case GeometryPageEventArgs.ChangedGemoetry.Height:
                what = Constants.IVAD_SETTING_HEIGHT;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.Horizontal:
                what = Constants.IVAD_SETTING_HORIZONTAL_POS;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.Keystone:
                what = Constants.IVAD_SETTING_KEYSTONE;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.Parallelogram:
                what = Constants.IVAD_SETTING_PARALLELOGRAM;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.Pincushion:
                what = Constants.IVAD_SETTING_PINCUSHION;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.PincushionBalance:
                what = Constants.IVAD_SETTING_PINCUSHION_BALANCE;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.SCorrection:
                what = Constants.IVAD_SETTING_S_CORRECTION;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.Rotation:
                what = Constants.IVAD_SETTING_ROTATION;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.Vertical:
                what = Constants.IVAD_SETTING_VERTICAL_POS;
                break;

            case GeometryPageEventArgs.ChangedGemoetry.Width:
                what = Constants.IVAD_SETTING_WIDTH;
                break;

            default:
                Trace.Fail("Unknown geometry 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;
        }