private void AddPlanetButton_Click(object sender, EventArgs e) { try { string _namePlanet = FormsUtils.Enter("Укажите название планеты", "Информация планеты"); int _massPlanet = Convert.ToInt32(FormsUtils.Enter("Укажите массу планеты", "Информация планеты")); int _period = Convert.ToInt32(FormsUtils.Enter("Укажите период вращения планеты", "Информация планеты")); int _count = Convert.ToInt32(FormsUtils.Enter("Укажите кол-во спутников планеты", "Информация планеты")); string SatelliteInf = null; if (_count > 0) { for (int i = 0; i < _count; i++) { string _nameSatellite = FormsUtils.Enter("Укажите название спутника", "Информация спутника"); string _massSatellite = FormsUtils.Enter("Укажите массу спутника", "Информация спутника"); string _People = FormsUtils.Enter("Укажите открываателя", "Информация спутника"); string _Year = FormsUtils.Enter("Укажите год открытия", "Информация спутника"); SatelliteInf += " " + _nameSatellite + " " + _massSatellite + " " + _People + " " + _Year; } } SpaceObjects.AddPlanet(_massPlanet, _namePlanet, _count, _period, SatelliteInf); } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void CountPlanetButton_Click(object sender, EventArgs e) { try { string count = Convert.ToString(SpaceObjects.CountPlanets()); FormsUtils.ShowMessage(count); } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void AddStarButton_Click(object sender, EventArgs e) { try { string _nameStar = FormsUtils.Enter("Укажите название звезды", "Информация звезды"); int _massStar = Convert.ToInt32(FormsUtils.Enter("Укажите массу звезды", "Информация звезды")); SpaceObjects.AddStar(_massStar, _nameStar); } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void Go_Click(object sender, EventArgs e) { try { int[,] arr2 = DataGridViewUtils.GridToArray2 <int>(arr2FromDataGridView); Nine logic = new Nine(arr2); DataGridViewUtils.ArrayToGrid(arr2ToDataGridView, logic.Process()); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } }
private void FileChooseButton_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { Logic.ReadFile(openFileDialog.FileName, stack); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void ReadButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { io.Text = io.ReadFromFile(inputOpenFileDialog.FileName); DataGridViewUtils.ArrayToGrid(InDGV, io.Text); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void inputButton_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { Logic.ReadFile(openFileDialog.FileName, list); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } PrintListToListTextBox(); }
private void RunButton_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { saveFileDialog.InitialDirectory = Path.GetDirectoryName(saveFileDialog.FileName); Logic.WriteFile(saveFileDialog.FileName, stack); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void SerializeButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { inputOpenFileDialog.InitialDirectory = Path.GetDirectoryName(inputOpenFileDialog.FileName); io.WriteForSerialization(inputOpenFileDialog.FileName); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void Info_btn_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] phonesInfo = phones.PrintInfo(); for (int i = 0; i < phonesInfo.Length; i++) { InfoTextBox.AppendText(phonesInfo[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void RandomButton_Click(object sender, EventArgs e) { if (outputSaveFileDialog.ShowDialog() == DialogResult.OK) { try { outputSaveFileDialog.InitialDirectory = Path.GetDirectoryName(outputSaveFileDialog.FileName); int size = Convert.ToInt32(SizeBox.Text); io.WriteToFile(outputSaveFileDialog.FileName, size); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void NameStarButton_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] name = SpaceObjects.PrintNameStars(); for (int i = 0; i < name.Length; i++) { InfoTextBox.AppendText(name[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void FileButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { inputOpenFileDialog.InitialDirectory = Path.GetDirectoryName(inputOpenFileDialog.FileName); mv.numbers = io.ReadFromFile(inputOpenFileDialog.FileName, mv.numbers); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } FileBox.Text = io.Text; }
private void Go_Click(object sender, EventArgs e) { try { int[,] arr2 = DataGridViewUtils.GridToArray2 <int>(arr2FromDataGridView); Nine logic = new Nine(arr2); logic.Process2(out int[,] res, out int resmin); DataGridViewUtils.ArrayToGrid(arr2ToDataGridView, res); labelres.Text = resmin.ToString(); label3.Show(); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } }
private void PlanetsInfoButton_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] planetsInfo = SpaceObjects.PrintInfoPlanets(); for (int i = 0; i < planetsInfo.Length; i++) { InfoTextBox.AppendText(planetsInfo[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void inputToFileButton_Click(object sender, EventArgs e) { if (inputSaveFileDialog.ShowDialog() == DialogResult.OK) { try { inputSaveFileDialog.InitialDirectory = Path.GetDirectoryName(inputSaveFileDialog.FileName); int[,] input = DataGridViewUtils.GridToArray2 <int>(arr2FromDataGridView); UtilsW.WriteInputIntoFile(inputSaveFileDialog.FileName, input); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void inputFromFileButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { inputOpenFileDialog.InitialDirectory = Path.GetDirectoryName(inputOpenFileDialog.FileName); int[,] input; UtilsW.ReadInputFromFile(inputOpenFileDialog.FileName, ' ', out input); DataGridViewUtils.ArrayToGrid(arr2FromDataGridView, input); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void outputToFileButton_Click(object sender, EventArgs e) { if (outputSaveFileDialog.ShowDialog() == DialogResult.OK) { try { outputSaveFileDialog.InitialDirectory = Path.GetDirectoryName(outputSaveFileDialog.FileName); int[,] output = DataGridViewUtils.GridToArray2 <int>(arr2ToDataGridView); UtilsW.WriteInputIntoFile(outputSaveFileDialog.FileName, output); /*IList<int> output = DataGridViewUtils.GridToList<int>(arr2ToDataGridView); * Nine.WriteOutputIntoFile(outputSaveFileDialog.FileName, output); */ } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void Add_btn_Click(object sender, EventArgs e) { string mark = FormsUtils.Enter("Укажите марку телефона", "Информация о телефоне"); string model = FormsUtils.Enter("Укажите модель телефона", "Информация о телефоне"); int price = Convert.ToInt32(FormsUtils.Enter("Укажите цену телефона", "Информация о телефоне")); int memory = Convert.ToInt32(FormsUtils.Enter("Укажите память телефона (Гб)", "Информация о телефоне")); int countSIM = Convert.ToInt32(FormsUtils.Enter("Укажите кол-во SIM телефона", "Информация о телефоне")); if (countSIM < 2 && countSIM > -1) { MobilePhone phone = new MobilePhone(mark, model, price, memory); phones.AddMobilePhone(phone, null); } else if (countSIM >= 2) { PhoneModify phone = new PhoneModify(mark, model, price, memory, countSIM); phones.AddMobilePhone(null, phone); } else { FormsUtils.ErrorMessageBox("Некорректное значение"); } }