exeptions in WFA

This commit is contained in:
test 2019-04-06 14:10:00 +02:00
parent 1a44661209
commit 5cfbf8d0a5
9 changed files with 21 additions and 15 deletions

View File

@ -182,9 +182,24 @@ namespace WindowsFormsApp01
} }
private void Button4_Click(object sender, EventArgs e) private void Button4_Click(object sender, EventArgs e)
{
try
{ {
calc.CalcIt(); calc.CalcIt();
} }
catch (DivideByZeroException)
{
label4.Text = "Fehler: div by zero";
}
catch (Exception)
{
label4.Text = "Fehler";
}
}
public void CalcFinished(CalcEventArgs e) public void CalcFinished(CalcEventArgs e)
{ {
@ -214,6 +229,7 @@ namespace WindowsFormsApp01
{ {
int res = DateTime.Now.Second; int res = DateTime.Now.Second;
res = res / 0;
var e = new CalcEventArgs(res); var e = new CalcEventArgs(res);
//trigger handler //trigger handler

View File

@ -12,6 +12,9 @@ public class SMtape
} }
public class SMtapeNoTapeIn : SMtape public class SMtapeNoTapeIn : SMtape
{ {
} }

View File

@ -31,7 +31,6 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btnPlay = new System.Windows.Forms.Button(); this.btnPlay = new System.Windows.Forms.Button();
this.Power = new System.Windows.Forms.Button();
this.Rewind = new System.Windows.Forms.Button(); this.Rewind = new System.Windows.Forms.Button();
this.btnRecord = new System.Windows.Forms.Button(); this.btnRecord = new System.Windows.Forms.Button();
this.statusLabel = new System.Windows.Forms.Label(); this.statusLabel = new System.Windows.Forms.Label();
@ -57,20 +56,10 @@
this.btnPlay.Name = "btnPlay"; this.btnPlay.Name = "btnPlay";
this.btnPlay.Size = new System.Drawing.Size(75, 23); this.btnPlay.Size = new System.Drawing.Size(75, 23);
this.btnPlay.TabIndex = 1; this.btnPlay.TabIndex = 1;
this.btnPlay.Text = "btnPlay"; this.btnPlay.Text = "Play/Pause";
this.btnPlay.UseVisualStyleBackColor = false; this.btnPlay.UseVisualStyleBackColor = false;
this.btnPlay.Click += new System.EventHandler(this.BtnPlay_Click); this.btnPlay.Click += new System.EventHandler(this.BtnPlay_Click);
// //
// Power
//
this.Power.Location = new System.Drawing.Point(701, 249);
this.Power.Name = "Power";
this.Power.Size = new System.Drawing.Size(57, 23);
this.Power.TabIndex = 2;
this.Power.Text = "Power";
this.Power.UseVisualStyleBackColor = true;
this.Power.Click += new System.EventHandler(this.Power_Click);
//
// Rewind // Rewind
// //
this.Rewind.Location = new System.Drawing.Point(586, 159); this.Rewind.Location = new System.Drawing.Point(586, 159);
@ -132,7 +121,6 @@
this.Controls.Add(this.statusLabel); this.Controls.Add(this.statusLabel);
this.Controls.Add(this.btnRecord); this.Controls.Add(this.btnRecord);
this.Controls.Add(this.Rewind); this.Controls.Add(this.Rewind);
this.Controls.Add(this.Power);
this.Controls.Add(this.btnPlay); this.Controls.Add(this.btnPlay);
this.Controls.Add(this.pictureBox1); this.Controls.Add(this.pictureBox1);
this.Name = "Form1"; this.Name = "Form1";
@ -148,7 +136,6 @@
private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btnPlay; private System.Windows.Forms.Button btnPlay;
private System.Windows.Forms.Button Power;
private System.Windows.Forms.Button Rewind; private System.Windows.Forms.Button Rewind;
private System.Windows.Forms.Button btnRecord; private System.Windows.Forms.Button btnRecord;
private System.Windows.Forms.Label statusLabel; private System.Windows.Forms.Label statusLabel;