private void btnGoBack_Click(object sender, EventArgs e) { mainFrm.Visible = true; AdditionalFunctionality.FormCentering(mainFrm); this.Close(); }
private void CloseForm() { string totalJobTime = (DateTime.Now - start).ToString(); this.Close(); MessageBox.Show(AdditionalFunctionality.TotalTimeFormat(totalJobTime)); parentalFrm.Show(); AdditionalFunctionality.FormCentering(parentalFrm); }
private void btnCalculate_Click(object sender, EventArgs e) { this.Visible = false; double pi = 3.14159265358979323846264338327950288419716939937510582097494459; try { if ((txtOuterDim.Text == defaultTextBoxString || txtInnerDim.Text == defaultTextBoxString || txtMatThickness.Text == defaultTextBoxString) || (txtOuterDim.Text == string.Empty || txtInnerDim.Text == string.Empty || txtMatThickness.Text == string.Empty)) { throw new EmtyTextBoxException(); } double outDim = Convert.ToDouble(txtOuterDim.Text); double inDim = Convert.ToDouble(txtInnerDim.Text); double thickness = Convert.ToDouble(txtMatThickness.Text); if (outDim <= 0 || inDim <= 0 || thickness <= 0) { throw new SmallerThanZeroException(); } double res = (((Math.Pow(outDim, 2) / 4) - (Math.Pow(inDim, 2) / 4)) * pi) / thickness; MessageBox.Show(string.Format(" אורך החומר בגליל שווה ל {0} מטר", Math.Round(res / 1000, 2))); } catch (EmtyTextBoxException ex) { MessageBox.Show(ex.Message); } catch (SmallerThanZeroException ex) { MessageBox.Show(ex.Message); } catch (Exception) { MessageBox.Show("!!! הנתונים חייבים להכיל רק מספרים"); } finally { FillTextBoxes(); AdditionalFunctionality.FormCentering(this); this.Visible = true; } }
private void btnStart_Click(object sender, EventArgs e) { try { if (Convert.ToInt32(this.txtIteration.Text) <= 0) { throw new Exception(); } else if (Convert.ToInt32(this.txtIteration.Text) > 9999) { throw new LargeNumberException(); } IterationForm itrFrm = new IterationForm(this, this.txtIteration.Text); itrFrm.Show(); } catch (LargeNumberException ex) { this.Visible = false; MessageBox.Show(ex.Message); this.Visible = true; AdditionalFunctionality.ButtonStatusChange("dis", this.btnStart); } catch (Exception) { this.Visible = false; MessageBox.Show("!!! נתון חייב להיות מספר שלם גדול מאפס"); this.Visible = true; AdditionalFunctionality.ButtonStatusChange("dis", this.btnStart); } finally { FillTextBox(); AdditionalFunctionality.FormCentering(this); AdditionalFunctionality.ButtonStatusChange("dis", this.btnStart); } }