예제 #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // добавляем список единиц
            tscombUnits.Items.Clear();
            int[] enumP = (int[])Enum.GetValues(typeof(PressureUnits));
            for (int i = 0; i < enumP.Length; i++)
            {
                if ((PressureUnits)enumP[i] == PressureUnits.NA)
                {
                    continue;
                }
                tscombUnits.Items.Add(PUnitConverter.PUnitToString((PressureUnits)enumP[i]));
            }


            FindDPIInstruments();

            progState.CurrentMode    = 0;
            tsbtnGeneralMode.Checked = true;

            basicModeControl = new BasicModeControl(this);
            tblpControl.Controls.Add(basicModeControl);
            basicModeControl.Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            basicModeControl.Location = new Point(3, 3);

            // график
            zgGraph.GraphPane.Title.Text       = "P(t)";
            zgGraph.GraphPane.XAxis.Title.Text = "t, сек";
            zgGraph.GraphPane.YAxis.Title.Text = string.Format("P, {0}", PUnitConverter.PUnitToString(progState.CurrentPUnits));
        }
예제 #2
0
        private void основнойToolStripMenuItem_Click(object sender, EventArgs e)
        {
            progState.CurrentMode = 0;

            // если режим уже выбран
            if (!tsbtnGeneralMode.Checked)
            {
                tsbtnGeneralMode.Checked  = true;
                tsbtnSetpointMode.Checked = false;
                tsbtnSplitterMode.Checked = false;
                return;
            }
            else
            {
                CurrentModeChanged?.Invoke(this);

                // оставляем отмеченным только его
                tsbtnSetpointMode.Checked = false;
                tsbtnSplitterMode.Checked = false;

                // уничтожаем контрол
                Control tmp = tblpControl.GetControlFromPosition(0, 0);
                if (tmp != null)
                {
                    if (tmp != basicModeControl)
                    {
                        tblpControl.Controls.Remove(tmp);
                    }
                    else
                    {
                        return;
                    }
                }

                // создаём контрол
                basicModeControl = new BasicModeControl(this);
                tblpControl.Controls.Add(basicModeControl);
                basicModeControl.Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                basicModeControl.Location = new Point(3, 3);
            }
        }