Пример #1
0
        public void TimeSpanTest()
        {
            var d = new DurationControl(1, 1, 1, 1);

            Assert.AreEqual(new TimeSpan(1, 1, 1, 1), d.Duration);

            d.DurationChanged += D_DurationChanged;
            d.MinutesChanged  += D_MinutesChanged;
            d.SecondsChanged  += D_SecondsChanged;;

            d.Duration = ts.Add(TimeSpan.FromMinutes(20));
        }
        private void InitializeMeasurementsParamsControls()
        {
            try
            {
                DurationControl           = new DurationControl();
                CheckedHeightArrayControl = new CheckedArrayControl <float?>(new float?[] { 2.5f, 5f, 10f, 20f })
                {
                    Name = "CheckedArrayControlHeights"
                };
                CheckedHeightArrayControl.checkedListBox.ColumnWidth = 70;

                buttonShowAcqQueue = new Button()
                {
                    AutoSize = false, Dock = DockStyle.Fill, Name = "buttonShowAcqQueue", Enabled = false
                };
                controlsMeasParams = new ControlsGroupBox(new Control[] { DurationControl, CheckedHeightArrayControl, buttonShowAcqQueue })
                {
                    Name = "controlsMeasParams"
                };
                controlsMeasParams._tableLayoutPanel.RowStyles[0].Height = 37.5F;
                controlsMeasParams._tableLayoutPanel.RowStyles[1].Height = 37.5F;
                controlsMeasParams._tableLayoutPanel.RowStyles[2].Height = 25F;
                mainForm.FunctionalLayoutPanel.Controls.Add(controlsMeasParams, 1, 0);

                DurationControl.DurationChanged            += (s, e) => mainForm.MainRDGV.FillDbSetValues("Duration", (int)DurationControl.Duration.TotalSeconds);
                CheckedHeightArrayControl.SelectionChanged += (s, e) => mainForm.MainRDGV.FillDbSetValues("Height", CheckedHeightArrayControl.SelectedItem);

                buttonShowAcqQueue.Click += ButtonShowAcqQueue_Click;
            }
            catch (Exception ex)
            {
                Report.Notify(new RCM.Message(Codes.ERR_UI_WF_INI_MEAS_PARAMS)
                {
                    DetailedText = ex.ToString()
                });
            }
        }
Пример #3
0
        private void InitializeIrradiationsParamsControls()
        {
            try
            {
                DurationControl       = new DurationControl();
                TimePicker            = new DateTimePicker();
                TimePicker.Format     = DateTimePickerFormat.Time;
                TimePicker.ShowUpDown = true;
                TimePicker.Dock       = DockStyle.Fill;
                TimePicker.Font       = new Font("Microsoft Sans Serif", 14F, FontStyle.Regular, GraphicsUnit.Point);
                controlsTimeChanged   = new ControlsGroupBox(new Control[] { TimePicker })
                {
                    Name = "controlsTimeChanged"
                };
                CheckedContainerArrayControl = new CheckedArrayControl <short?>(new short?[] { 1, 2, 3, 4, 5, 6, 7, 8 }, multiSelection: false)
                {
                    Name = "CheckedArrayControlContainers"
                };
                buttonAssingNowDateTime = new Button()
                {
                    AutoSize = false, Dock = DockStyle.Fill, Name = "buttonAssingNowDateTime"
                };
                CheckedContainerArrayControl.SelectItem(1);
                CheckedContainerArrayControl.checkedListBox.ColumnWidth = 70;
                controlsIrrParams = new ControlsGroupBox(new Control[] { DurationControl, controlsTimeChanged, buttonAssingNowDateTime, CheckedContainerArrayControl })
                {
                    Name = "controlsIrrParams"
                };

                controlsIrrParams._tableLayoutPanel.RowStyles[0].Height = 30F;
                controlsIrrParams._tableLayoutPanel.RowStyles[1].Height = 25F;
                controlsIrrParams._tableLayoutPanel.RowStyles[2].Height = 30F;
                //controlsIrrParams._tableLayoutPanel.RowStyles[3].Height = 15F;

                buttonMoveUpInContainer = new Button()
                {
                    AutoSize = false, Dock = DockStyle.Fill, Name = "buttonMoveUpInContainer"
                };
                buttonMoveDownInContainer = new Button()
                {
                    AutoSize = false, Dock = DockStyle.Fill, Name = "buttonMoveDownInContainer"
                };

                buttonMoveUpInContainer.Click   += (s, e) => { ChangeIrraditionPositionInContainer(mainForm.MainRDGV.SelectedCells, Direction.Negative); };
                buttonMoveDownInContainer.Click += (s, e) => { ChangeIrraditionPositionInContainer(mainForm.MainRDGV.SelectedCells, Direction.Positive); };

                controlsMovingInContainer = new ControlsGroupBox(new Control[] { buttonMoveUpInContainer, buttonMoveDownInContainer })
                {
                    Name = "controlsMovingInContainer"
                };

                controlsMovingInContainer._tableLayoutPanel.RowStyles[0].Height = 10F;
                controlsMovingInContainer._tableLayoutPanel.RowStyles[1].Height = 10F;

                _comboBoxRepackers = new ComboBox()
                {
                    Name = "comboBoxRepackers"
                };
                _comboBoxRepackers.Dock = DockStyle.Fill;
                _comboBoxRepackers.Font = new Font("Microsoft Sans Serif", 16F, FontStyle.Regular, GraphicsUnit.Point);
                _comboBoxRepackers.SelectedIndexChanged += (s, e) => { mainForm.MainRDGV.FillDbSetValues("Rehandler", _logId[_comboBoxRepackers.SelectedItem.ToString()]); };

                controlsRepack = new ControlsGroupBox(new Control[] { _comboBoxRepackers })
                {
                    Name = "controlsRepack"
                };


                mainForm.FunctionalLayoutPanel.Controls.Add(controlsIrrParams, 1, 0);
                mainForm.FunctionalLayoutPanel.Controls.Add(controlsRepack, 2, 0);

                mainForm.buttonsRegForm._tableLayoutPanel.Controls.RemoveAt(3);;
                mainForm.buttonsRegForm._tableLayoutPanel.Controls.Add(controlsMovingInContainer);

                DurationControl.DurationChanged += (s, e) =>
                {
                    mainForm.MainRDGV.FillDbSetValues("Duration", (int)DurationControl.Duration.TotalSeconds);
                    FillDateTimeFinish();
                };


                CheckedContainerArrayControl.SelectionChanged += CheckedContainerArrayControl_SelectionChanged;
#if NETFRAMEWORK
                switch (_irrType)
                {
                case IrradiationType.sli:
                    DurationControl.Duration = TimeSpan.FromSeconds(Settings <IrradiationSettings> .CurrentSettings.DefaultSLITime);
                    break;

                case IrradiationType.lli:
                    DurationControl.Duration = TimeSpan.FromSeconds(Settings <IrradiationSettings> .CurrentSettings.DefaultLLITime);
                    break;

                default:
                    DurationControl.Duration = TimeSpan.FromSeconds(0);
                    break;
                }
                ;
#else
                DurationControl.Duration = _irrType switch
                {
                    IrradiationType.sli => TimeSpan.FromSeconds(Settings <IrradiationSettings> .CurrentSettings.DefaultSLITime),
                    IrradiationType.lli => TimeSpan.FromSeconds(Settings <IrradiationSettings> .CurrentSettings.DefaultLLITime),
                    _ => TimeSpan.FromSeconds(0),
                };
#endif

                CheckedContainerArrayControl.SelectItem(1);

                // TODO: add rehandler column and mapping from name to int
                buttonAssingNowDateTime.Click += (s, e) =>
                {
                    mainForm.MainRDGV.FillDbSetValues("DateTimeStart", DateTime.Now);
                    FillDateTimes(null);
                    mainForm.MainRDGV.FillDbSetValues("Assistant", _uid);
                    //FillDateTimeFinish();
                };
            }
            catch (Exception ex)
            {
                Report.Notify(new RCM.Message(Codes.ERR_UI_WF_INI_MEAS_PARAMS)
                {
                    DetailedText = ex.ToString()
                });
            }
        }