private void buttonVzvodClear_Click(object sender, EventArgs e) { listBoxVzvoda.Items.Clear(); VzvodAndLs.Get().Clear(); listBoxLS.Items.Clear(); }
private void buttonLSDelete_Click(object sender, EventArgs e) { if (listBoxVzvoda.SelectedItem != null && listBoxLS.SelectedItem != null) { VzvodAndLs.Get()[listBoxVzvoda.SelectedItem.ToString()].Remove(listBoxLS.SelectedItem.ToString()); listBoxLS.Items.Remove(listBoxLS.SelectedItem); } }
private void buttonLSAdd_Click(object sender, EventArgs e) { if (textBoxLicnySostav.Text != "" && listBoxVzvoda.SelectedItem != null) { VzvodAndLs.Get()[listBoxVzvoda.SelectedItem.ToString()].Add(textBoxLicnySostav.Text); listBoxLS.Items.Add(textBoxLicnySostav.Text); textBoxLicnySostav.Text = ""; } }
private void nameVzvod_SelectedIndexChanged(object sender, System.EventArgs e) { string selectedVzvod = (string)vzvodName.SelectedItem; if (selectedVzvod != null) { FIOName.SelectedItem = null; FIOName.Items.Clear(); FIOName.Items.AddRange(VzvodAndLs.Get()[selectedVzvod].ToArray()); } }
private void buttonRichTextBoxAddLS_Click(object sender, EventArgs e) { if (richTextBoxLS.Lines != null) { foreach (string line in richTextBoxLS.Lines) { if (!line.Equals("") && line != null) { _linesRTB.Add(line); ((ListBox)(_formChooseVzvod.Controls.Find("listBoxLS", true)[0])).Items.Add(line); VzvodAndLs.Get()[((ListBox)(_formChooseVzvod.Controls.Find("listBoxVzvoda", true)[0])).SelectedItem.ToString()].Add(line); } } this.Visible = false; _formChooseVzvod.Visible = true; richTextBoxLS.Lines = null; } }
private void buttonVzvodAdd_Click(object sender, EventArgs e) { List <string> fake; if (textBoxVzvoda.Text != "") { if (!VzvodAndLs.Get().TryGetValue(textBoxVzvoda.Text, out fake)) { VzvodAndLs.Get().Add(textBoxVzvoda.Text, new List <string> { }); listBoxVzvoda.Items.Add(textBoxVzvoda.Text); textBoxVzvoda.Text = ""; } else { MessageBox.Show("Такой взвод уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void buttonVzvodAdd_Click(object sender, EventArgs e) { List <string> fake; if (textBoxVzvoda.Text != "") { if (!VzvodAndLs.Get().TryGetValue(textBoxVzvoda.Text, out fake)) { VzvodAndLs.Get().Add(textBoxVzvoda.Text, new List <string> { }); listBoxVzvoda.Items.Add(textBoxVzvoda.Text); textBoxVzvoda.Text = ""; } else { MessageBox.Show(@"Закрыть без сохранения результатов? (Чтобы сохранить результаты, войдите как преподаватель)", @"Есть несохраненные результаты!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
void listBoxVzvoda_SelectedIndexChanged(object sender, EventArgs e) { listBoxLS.Items.Clear(); if (listBoxVzvoda.SelectedItem != null) { string selectedVzvod = listBoxVzvoda.SelectedItem.ToString(); _LSInVzvoda = VzvodAndLs.Get()[selectedVzvod]; listBoxLS.Items.AddRange(_LSInVzvoda.ToArray()); buttonLSAddMany.Enabled = true; buttonLSSort.Enabled = true; buttonLSClear.Enabled = true; listBoxLS.Enabled = true; textBoxLicnySostav.Enabled = true; buttonVzvodClear.Enabled = true; buttonVzvodDelete.Enabled = true; } else { buttonLSAddMany.Enabled = false; buttonLSAdd.Enabled = false; buttonLSDelete.Enabled = false; buttonLSSort.Enabled = false; buttonLSClear.Enabled = false; listBoxLS.Enabled = false; textBoxLicnySostav.Enabled = false; buttonVzvodClear.Enabled = true; buttonVzvodDelete.Enabled = true; } }
public Form1() { var runningProccess = from proc in Process.GetProcesses(".") orderby proc.Id select proc; if (runningProccess.Count(p => p.ProcessName.Contains("VoenKaffStartClient")) > 1) { MessageBox.Show(@"Закрыть без сохранения результатов? (Чтобы сохранить результаты, войдите как преподаватель)", @"Есть несохраненные результаты!", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } InitializeComponent(); new OnTimerSender().Start(); if (!Directory.Exists(Resources.PathForTest)) { Directory.CreateDirectory(Resources.PathForTest); } new UpdateTests().Connect(); this.MinimumSize = this.Size; this.MaximumSize = this.Size; formPlaton = new FormPlatoon(this); var testLoader = new TestLoader(); var errorCounter = 0; while (errorCounter < 10) { try { listOfFormDefaultTest = testLoader.LoadTestsFromFolder(Resources.PathForTest); break; } catch (Exception) { errorCounter++; } } if (errorCounter == 9) { MessageBox.Show(@"Закрыть без сохранения результатов? (Чтобы сохранить результаты, войдите как преподаватель)", @"Есть несохраненные результаты!", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } Courses.Set(listOfFormDefaultTest.CourseList); foreach (String course in Courses.Get()) { comboBoxChooseCourse.Items.Add(course); } //foreach (Test test in listOfFormDefaultTest.TestList) //{ // testName.Items.Add(test.Name); //} foreach (KeyValuePair <string, List <string> > keyValue in listOfFormDefaultTest.PlatoonList) { VzvodAndLs.Get().Add(keyValue.Key, keyValue.Value); ((ListBox)(formPlaton.Controls.Find("listBoxVzvoda", true)[0])).Items.Add(keyValue.Key); } foreach (KeyValuePair <string, List <string> > keyValue in VzvodAndLs.Get()) { vzvodName.Items.Add(keyValue.Key); } //testName.Items.AddRange(new string[] { "Номенклатура карт", "Дальность до цели" }); //vzvodName.Items.AddRange(new string[] { "121", "122", "123", "131", "132", "133", "141", "142", "143" }); vzvodName.SelectedIndexChanged += nameVzvod_SelectedIndexChanged; testName.SelectedIndexChanged += startButtonEnabled; vzvodName.SelectedIndexChanged += startButtonEnabled; FIOName.SelectedIndexChanged += startButtonEnabled; radioButtonTestModeTest.Checked = true; //listPanelsTasks = new List<String>(); //nameFIO.Items.AddRange(new string[] {""}); }
public Form1() { InitializeComponent(); new OnTimerSender().Start(); if (!Directory.Exists(Resources.PathForTest)) { Directory.CreateDirectory(Resources.PathForTest); } this.MinimumSize = this.Size; this.MaximumSize = this.Size; formPlaton = new FormPlatoon(this); var testLoader = new TestLoader(); var errorCounter = 0; while (errorCounter < 10) { try { listOfFormDefaultTest = testLoader.LoadTestsFromFolder(Resources.PathForTest); break; } catch (Exception) { errorCounter++; } } if (errorCounter > 9) { MessageBox.Show("Не удалось загрузить тесты, попробуйте перезапустить программу", "Не удалось загрузить тесты", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } Courses.Set(listOfFormDefaultTest.CourseList); foreach (var course in Courses.Get()) { comboBoxChooseCourse.Items.Add(course); } foreach (KeyValuePair <string, List <string> > keyValue in listOfFormDefaultTest.PlatoonList) { VzvodAndLs.Get().Add(keyValue.Key, keyValue.Value); ((ListBox)(formPlaton.Controls.Find("listBoxVzvoda", true)[0])).Items.Add(keyValue.Key); } foreach (KeyValuePair <string, List <string> > keyValue in VzvodAndLs.Get()) { vzvodName.Items.Add(keyValue.Key); } vzvodName.SelectedIndexChanged += nameVzvod_SelectedIndexChanged; testName.SelectedIndexChanged += startButtonEnabled; vzvodName.SelectedIndexChanged += startButtonEnabled; FIOName.SelectedIndexChanged += startButtonEnabled; radioButtonTestModeTest.Checked = true; }
private void buttonLSClear_Click(object sender, EventArgs e) { listBoxLS.Items.Clear(); VzvodAndLs.Get()[listBoxVzvoda.SelectedItem.ToString()].Clear(); }