Пример #1
0
        private void InitMenuStrip()
        {
            try
            {
                mainForm.LangItem.CheckedChanged += () => Settings <MeasurementsSettings> .CurrentSettings.CurrentLanguage = mainForm.LangItem.CheckedItem;
                mainForm.LangItem.CheckItem(Settings <MeasurementsSettings> .CurrentSettings.CurrentLanguage);

                AcquisitionModeItems.CheckItem(Settings <MeasurementsSettings> .CurrentSettings.AcquisitionMode);

                // NOTE: now we can use only two modes aCountToLiveTime or aCountToRealTime

                AcquisitionModeItems.CheckedChanged += () =>
                {
                    var currentMode = AcquisitionModeItems.CheckedItem switch
                    {
                        CanberraDeviceAccessLib.AcquisitionModes.aCountToLiveTime => CanberraDeviceAccessLib.AcquisitionModes.aCountToLiveTime,
                        _ => CanberraDeviceAccessLib.AcquisitionModes.aCountToRealTime
                    };
                    mainForm.MainRDGV.FillDbSetValues("AcqMode", (int)currentMode);
                    Settings <MeasurementsSettings> .CurrentSettings.AcquisitionMode = currentMode;
                    AcquisitionModeItems.CheckItem(currentMode);
                    Labels.SetControlsLabels(mainForm);
                };

                VerbosityItems.CheckItem(Settings <MeasurementsSettings> .CurrentSettings.Verbosity);

                VerbosityItems.CheckedChanged += () =>
                {
                    Settings <MeasurementsSettings> .CurrentSettings.Verbosity = VerbosityItems.CheckedItem;
                    Labels.SetControlsLabels(mainForm);
                };

                _scFlagMenuItem = new ToolStripMenuItem();
                _scFlagMenuItem.CheckOnClick    = true;
                _scFlagMenuItem.Name            = "scFlagMenuItem";
                _scFlagMenuItem.CheckedChanged += _scFlagMenuItem_CheckedChanged;

                _showDevCams        = new ToolStripMenuItem();
                _showDevCams.Name   = "showDevCams";
                _showDevCams.Click += (s, e) => Shell.ShowXemoDevicesCams();

                _scDropDownMenu      = new ToolStripMenuItem();
                _scDropDownMenu.Name = "scDropDownMenu";
                _scDropDownMenu.DropDownItems.Add(_scFlagMenuItem);
                _scDropDownMenu.DropDownItems.Add(_showDevCams);


                _SLIShowAlreadyAdded = new ToolStripMenuItem();
                _SLIShowAlreadyAdded.CheckOnClick    = true;
                _SLIShowAlreadyAdded.Name            = "SLIShowAlreadyAdded";
                _SLIShowAlreadyAdded.CheckedChanged += _SLIShowAlreadyAdded_CheckedChanged;

                _SLIMenuItem         = new ToolStripMenuItem();
                _SLIMenuItem.Name    = "SLIMenuItem";
                _SLIMenuItem.Visible = false;
                _SLIMenuItem.DropDownItems.Add(_SLIShowAlreadyAdded);

                _shareSpectraMenuItem        = new ToolStripMenuItem();
                _shareSpectraMenuItem.Name   = "ShareSpectraMenuItem";
                _shareSpectraMenuItem.Click += (s, e) => { var ss = new ShareSpectra(); ss.Show(); Labels.SetControlsLabels(ss); };

                mainForm.MenuStrip.Items.Insert(0, _shareSpectraMenuItem);
                mainForm.MenuStrip.Items.Insert(0, _scDropDownMenu);
                mainForm.MenuStrip.Items.Insert(0, VerbosityItems.EnumMenuItem);
                mainForm.MenuStrip.Items.Insert(0, _SLIMenuItem);
                mainForm.MenuStrip.Items.Insert(0, AcquisitionModeItems.EnumMenuItem);
                mainForm.MenuStrip.Items.Insert(0, MeasurementsTypeItems.EnumMenuItem);

                MeasurementsTypeItems.CheckedChanged += async() =>
                {
                    mainForm.TabsPane[0, 0].DataSource = null;
                    mainForm.TabsPane[1, 0].DataSource = null;
                    mainForm.TabsPane[0, 1].DataSource = null;
                    mainForm.TabsPane[1, 1].DataSource = null;


                    CurrentMeasurementsRegister.Type = (int)MeasurementsTypeItems.CheckedItem;

                    if (MeasurementsTypeItems.CheckedItem == Core.DataBase.Models.MeasurementsType.sli)
                    {
                        _SLIMenuItem.Visible = true;
                        mainForm.MainRDGV.Columns["DateTimeFinish"].Visible = false;
                        mainForm.MainRDGV.Columns["DiskPosition"].Visible   = false;
                        _scFlagMenuItem.Checked = false;
                    }
                    else
                    {
                        _SLIMenuItem.Visible = false;
                        mainForm.MainRDGV.Columns["DateTimeFinish"].Visible = true;
                        mainForm.MainRDGV.Columns["DiskPosition"].Visible   = true;
                        _scFlagMenuItem.Checked = true;
                    }

                    DurationControl.Duration = CurrentMeasurementsRegister.Type switch
                    {
                        0 => TimeSpan.FromSeconds(Settings <MeasurementsSettings> .CurrentSettings.DefaultSLITime),
                        1 => TimeSpan.FromSeconds(Settings <MeasurementsSettings> .CurrentSettings.DefaultLLI1Time),
                        2 => TimeSpan.FromSeconds(Settings <MeasurementsSettings> .CurrentSettings.DefaultLLI2Time),
                        _ => TimeSpan.FromSeconds(0),
                    };

                    var h = Settings <MeasurementsSettings> .CurrentSettings.DefaultSLIHeight switch
                    {
                        <= 2.5f => 2.5f,
                        <= 5 => 5f,
                        <= 10 => 10f,
                        _ => 20f
                    };

                    CheckedHeightArrayControl.SelectItem(h);

                    ClearCurrentRegister();

                    await FillIrradiationRegisters();
                    await FillMeasurementsRegisters();

                    Labels.SetControlsLabels(mainForm);

                    mainForm.buttonAddAllSamples.Enabled           = true;
                    mainForm.buttonAddSelectedSamplesToReg.Enabled = true;
                    mainForm.buttonRemoveSelectedSamples.Enabled   = true;
                };
            }
            catch (Exception ex)
            {
                Report.Notify(new RCM.Message(Codes.ERR_UI_WF_INI_MENU)
                {
                    DetailedText = string.Join("--", ex.Message, ex?.InnerException?.Message)
                });
            }
        }
Пример #2
0
        private void InitMenuStrip()
        {
            try
            {
                mainForm.LangItem.CheckedChanged += () => Settings <IrradiationSettings> .CurrentSettings.CurrentLanguage = mainForm.LangItem.CheckedItem;
                mainForm.LangItem.CheckItem(Settings <IrradiationSettings> .CurrentSettings.CurrentLanguage);

                VerbosityItems.CheckItem(Settings <IrradiationSettings> .CurrentSettings.Verbosity);

                VerbosityItems.CheckedChanged += () =>
                {
                    Settings <IrradiationSettings> .CurrentSettings.Verbosity = VerbosityItems.CheckedItem;
                };

                _changeRegisterDate        = new ToolStripMenuItem();
                _changeRegisterDate.Name   = "ChangeDateMenu";
                _changeRegisterDate.Click += _changeRegisterDate_Click;

                _samplesToDetectors        = new ToolStripMenuItem();
                _samplesToDetectors.Name   = "SamplesToDetectors";
                _samplesToDetectors.Click += _samplesToDetectors_Click;;

                _channelMenuStrip      = new ToolStripMenuItem();
                _channelMenuStrip.Name = "ChannelMenuStrip";

                var ch1 = new ToolStripMenuItem()
                {
                    Name = "1"
                };
                var ch2 = new ToolStripMenuItem()
                {
                    Name = "2"
                };

                ch1.Click += (s, e) => mainForm.MainRDGV.FillDbSetValues("Channel", short.Parse(ch1.Name));
                ch2.Click += (s, e) => mainForm.MainRDGV.FillDbSetValues("Channel", short.Parse(ch2.Name));


                _channelMenuStrip.DropDownItems.Add(ch1);
                _channelMenuStrip.DropDownItems.Add(ch2);

                _registerParametersMenu      = new ToolStripMenuItem();
                _registerParametersMenu.Name = "RegisterParametersMenu";

                _displaySetsParam = new ToolStripMenuItem()
                {
                    Name = "DisplaySetsParam", CheckOnClick = true
                };

                _displaySetsParam.CheckedChanged += DisplaySetsParam_CheckedChanged;

                _registerParametersMenu.DropDownItems.Add(_displaySetsParam);

                //mainForm.MenuStrip.Items.Insert(0, VerbosityItems.EnumMenuItem);
                mainForm.MenuStrip.Items.Insert(0, _channelMenuStrip);
                mainForm.MenuStrip.Items.Insert(0, _samplesToDetectors);
                mainForm.MenuStrip.Items.Insert(0, _registerParametersMenu);
                mainForm.MenuStrip.Items.Insert(0, _changeRegisterDate);
            }
            catch (Exception ex)
            {
                Report.Notify(new RCM.Message(Codes.ERR_UI_WF_INI_MENU)
                {
                    DetailedText = string.Join("--", ex.Message, ex?.InnerException?.Message)
                });
            }
        }
Пример #3
0
        private void InitMenuStrip()
        {
            try
            {
                mainForm.LangItem.CheckedChanged += () => Settings <MeasurementRegisterSettings> .CurrentSettings.CurrentLanguage = mainForm.LangItem.CheckedItem;
                mainForm.LangItem.CheckItem(Settings <MeasurementRegisterSettings> .CurrentSettings.CurrentLanguage);

                VerbosityItems.CheckItem(Settings <MeasurementRegisterSettings> .CurrentSettings.Verbosity);

                VerbosityItems.CheckedChanged += () =>
                {
                    Settings <MeasurementRegisterSettings> .CurrentSettings.Verbosity = VerbosityItems.CheckedItem;
                    Labels.SetControlsLabels(mainForm);
                };

                _goToLLI2 = new ToolStripMenuItem()
                {
                    Name = "GoToLLI2"
                };
                _goToLLI2.Click += _goToLLI2_Click;

                _folderDialog = new FolderBrowserDialog();

                _downloadpectraMenuItem        = new ToolStripMenuItem();
                _downloadpectraMenuItem.Name   = "DownloadpectraMenuItem";
                _downloadpectraMenuItem.Click += _downloadpectraMenuItem_Click;

                if (MeasurementsTypeItems.CheckedItem == Core.DataBase.Models.MeasurementsType.lli1)
                {
                    mainForm.MenuStrip.Items.Insert(0, _goToLLI2);
                }
                mainForm.MenuStrip.Items.Insert(0, _downloadpectraMenuItem);
                //mainForm.MenuStrip.Items.Insert(0, VerbosityItems.EnumMenuItem);

                MeasurementsTypeItems.CheckedChanged += () =>
                {
                    if (MeasurementsTypeItems.CheckedItem == Core.DataBase.Models.MeasurementsType.sli)
                    {
                        mainForm.MainRDGV.Columns["DateTimeFinish"].Visible = false;
                        mainForm.MainRDGV.Columns["DiskPosition"].Visible   = false;
                    }
                    else
                    {
                        mainForm.MainRDGV.Columns["DateTimeFinish"].Visible = true;
                        mainForm.MainRDGV.Columns["DiskPosition"].Visible   = true;
                    }


                    Labels.SetControlsLabels(mainForm);

                    mainForm.buttonAddAllSamples.Enabled           = true;
                    mainForm.buttonAddSelectedSamplesToReg.Enabled = true;
                    mainForm.buttonRemoveSelectedSamples.Enabled   = true;
                };
            }
            catch (Exception ex)
            {
                Report.Notify(new RCM.Message(Codes.ERR_UI_WF_INI_MENU)
                {
                    DetailedText = string.Join("--", ex.Message, ex?.InnerException?.Message)
                });
            }
        }