public AddProtocol(NewVipAvtoSet set) { _set = set; Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Language); InitializeComponent(); _gbo = GBOSTATE.None; _rows = new List<VisualRow>(); }
private void UnlockFields() { if (comboBox1.SelectedIndex == -1) return; if (!maskedTextBox1.MaskCompleted) return; panel1.Enabled = true; CleanFields(); visualCheck.BackColor = SystemColors.Control; if (_set.GroupWithGasEngine(comboBox1.SelectedItem.ToString())) { switch (_gbo) { case GBOSTATE.None: if (MessageBox.Show(_rm.GetString("IsGBOActive"), _rm.GetString("warning"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { _gbo = GBOSTATE.Active; GBO.Enabled = true; GBO.BackColor = Color.Gold; } else { _gbo = GBOSTATE.NonActive; GBO.Enabled = false; GBO.BackColor = SystemColors.Control; } break; case GBOSTATE.Active: _gbo = GBOSTATE.Active; GBO.Enabled = true; GBO.BackColor = Color.Gold; break; default: _gbo = GBOSTATE.NonActive; GBO.Enabled = false; GBO.BackColor = SystemColors.Control; break; } } else { _gbo = GBOSTATE.NonActive; GBO.Enabled = false; GBO.BackColor = SystemColors.Control; } PreviewBtn.Enabled = true; SaveBtn.Enabled = true; PrintBtn.Enabled = true; _rows = new List<VisualRow>(); _normatives = _set.GetNormativesFromGroup(comboBox1.SelectedItem.ToString()); foreach (NewVipAvtoSet.NormativesRow normative in _normatives) { var row = new VisualRow(normative, _random); var lables = new List<Label>(); foreach (Control control2 in panel1.Controls) { if (!(control2 is GroupBox)) continue; foreach (Control control3 in control2.Controls) { if (!(control3 is TableLayoutPanel)) continue; foreach (Control control in control3.Controls) { if (control.Tag == null) continue; int tag = Convert.ToInt32(control.Tag); if (tag != row.Id) continue; if (tag == 3 && numericUpDown1.Value == 1) continue; if (tag == 4 && (numericUpDown1.Value == 2 || numericUpDown1.Value == 1)) continue; if (tag == 23 && (numericUpDown1.Value == 1 || numericUpDown1.Value == 2 || numericUpDown1.Value == 3)) continue; if (control is TextBox) { row.TextBox = (control as TextBox); } else if (control is Label) { lables.Add((control as Label)); } } } } if (lables.Count == 0) continue; if (lables[0].Location.X > lables[1].Location.X) { row.MaxLabel = lables[0]; row.MinLabel = lables[1]; } else { row.MaxLabel = lables[1]; row.MinLabel = lables[0]; } _rows.Add(row); visualCheck.BackColor = Color.Gold; groupBox10.BackColor = Color.Gold; panel2.BackColor = Color.Gold; } timer1.Start(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { _gbo = GBOSTATE.None; UnlockFields(); }