diff --git a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo index 8b5cfe0..bdbcb34 100644 Binary files a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo and b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/.suo differ diff --git a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide index 85015d2..a1ec5a5 100644 Binary files a/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide and b/WindowsFormsApp01/.vs/WindowsFormsApp01/v16/Server/sqlite3/storage.ide differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/Form1.cs b/WindowsFormsApp01/WindowsFormsApp01/Form1.cs index 438dc3a..dc14c34 100644 --- a/WindowsFormsApp01/WindowsFormsApp01/Form1.cs +++ b/WindowsFormsApp01/WindowsFormsApp01/Form1.cs @@ -71,6 +71,17 @@ namespace WindowsFormsApp01 _number = (int) res; label1.Text = "Ergebnis: " + res.ToString(); + + + var f = new CalcEventArgs(res); + //trigger handler + + // if (CalcFinished != null) + // { + CalcFinished(f); + // } + + } @@ -225,6 +236,9 @@ namespace WindowsFormsApp01 public static event CalcEventHandler CalcFinished; + + + public static void CalcIt() { int res = DateTime.Now.Second; diff --git a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe index fcd5c41..2a047e8 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe and b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.exe differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb index 80e560a..0894f7a 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb and b/WindowsFormsApp01/WindowsFormsApp01/bin/Debug/WindowsFormsApp01.pdb differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache index 8925826..538f423 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache and b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.csprojAssemblyReference.cache differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe index fcd5c41..2a047e8 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe and b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.exe differ diff --git a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb index 80e560a..0894f7a 100644 Binary files a/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb and b/WindowsFormsApp01/WindowsFormsApp01/obj/Debug/WindowsFormsApp01.pdb differ diff --git a/winVCR/VCRlogic/SMtape.cs b/winVCR/VCRlogic/SMtape.cs index 4f4677f..da31179 100644 --- a/winVCR/VCRlogic/SMtape.cs +++ b/winVCR/VCRlogic/SMtape.cs @@ -1,29 +1,122 @@ using System; +using System.Diagnostics; using System.Runtime.CompilerServices; +using System.Security.Cryptography.X509Certificates; +using VCRlogic; - -public class SMtape +namespace VCRlogic { - private SMtape _concreteState; - - public SMtape() + public static class SMtape { + private static StateTape _concreteState; + + public delegate void TapeEventHandler(); + + public static event TapeEventHandler evIntape; + + public static event TapeEventHandler evOuttape; + + + public static void initSMtape() + { + setState(new StapeNoTapeIn()); + + //evIntape += evIntape; + } + + public static void setState(StateTape e) + { + _concreteState = null; + + _concreteState = e; + } + + + public static void insertTape() + { + if (evIntape != null) + { + evIntape(); + } + } + + public static void ejectTape() + { + if (evOuttape != null) + { + evOuttape(); + } + + + } } } - - - -public class SMtapeNoTapeIn : SMtape +public abstract class StateTape { + public abstract void evIntape(); + + public abstract void evOuttape(); } -public class SMtapeTapeInNotEnd : SMtape +public class StapeNoTapeIn : StateTape { + public override void evIntape() + { + Debug.Print("tape is now in\n"); + + //unsub + SMtape.evIntape -= evIntape; + + SMtape.setState(new StapeTapeInNotEnd()); + } + + public override void evOuttape() + { + } + + + public StapeNoTapeIn() + { + // sub to event + SMtape.evIntape += evIntape; + } } -public class SMtapeTapeInEnd : SMtape + +public class StapeTapeInNotEnd : StateTape { -} \ No newline at end of file + public override void evIntape() + { + } + + public override void evOuttape() + { + Debug.Print("tape is now out\n"); + + //unsub + SMtape.evOuttape -= evOuttape; + SMtape.setState(new StapeNoTapeIn()); + } + + + public StapeTapeInNotEnd() + { + //sub + SMtape.evOuttape += evOuttape; + } +} + + +/* +public class StapeTapeInEnd : StateTape +{ + public override void setStateText() + { + throw new NotImplementedException(); + } +} + + */ \ No newline at end of file diff --git a/winVCR/VCRlogic/SMvcr.cs b/winVCR/VCRlogic/SMvcr.cs index 6638d84..cd05817 100644 --- a/winVCR/VCRlogic/SMvcr.cs +++ b/winVCR/VCRlogic/SMvcr.cs @@ -9,7 +9,17 @@ public class SMvcr { private string _labelText; - private SMvcr _concreteState; + private StateVCR _concreteState; + + public SMvcr() + { + setState(new SvcrStandBy()); + } + + public void setState(StateVCR e) + { + _concreteState = e; + } public string getLabelText() { @@ -18,25 +28,50 @@ public class SMvcr } -public class SMvcrStandBy : SMvcr +public abstract class StateVCR { + public abstract void setStateText(); +} + +public class SvcrStandBy : StateVCR +{ + public override void setStateText() + { + throw new NotImplementedException(); + } } -public class SMvcrPlay : SMvcr +public class SvcrPlay : StateVCR { + public override void setStateText() + { + throw new NotImplementedException(); + } } -public class SMvcrRewind : SMvcr +public class SvcrRewind : StateVCR { + public override void setStateText() + { + throw new NotImplementedException(); + } } -public class SMvcrFastForward : SMvcr +public class SvcrFastForward : StateVCR { + public override void setStateText() + { + throw new NotImplementedException(); + } } -public class SMvcrRecord : SMvcr +public class SvcrRecord : StateVCR { + public override void setStateText() + { + throw new NotImplementedException(); + } } \ No newline at end of file diff --git a/winVCR/winVCR/Form1.Designer.cs b/winVCR/winVCR/Form1.Designer.cs index a7097bb..943aedf 100644 --- a/winVCR/winVCR/Form1.Designer.cs +++ b/winVCR/winVCR/Form1.Designer.cs @@ -36,6 +36,8 @@ this.statusLabel = new System.Windows.Forms.Label(); this.btnInsertTape = new System.Windows.Forms.Button(); this.btnEjectTape = new System.Windows.Forms.Button(); + this.btnEndTape = new System.Windows.Forms.Button(); + this.btnNotEndTape = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -93,9 +95,9 @@ // // btnInsertTape // - this.btnInsertTape.Location = new System.Drawing.Point(201, 117); + this.btnInsertTape.Location = new System.Drawing.Point(197, 117); this.btnInsertTape.Name = "btnInsertTape"; - this.btnInsertTape.Size = new System.Drawing.Size(99, 44); + this.btnInsertTape.Size = new System.Drawing.Size(79, 44); this.btnInsertTape.TabIndex = 6; this.btnInsertTape.Text = "Insert Tape"; this.btnInsertTape.UseVisualStyleBackColor = true; @@ -103,19 +105,41 @@ // // btnEjectTape // - this.btnEjectTape.Location = new System.Drawing.Point(451, 117); + this.btnEjectTape.Location = new System.Drawing.Point(483, 117); this.btnEjectTape.Name = "btnEjectTape"; - this.btnEjectTape.Size = new System.Drawing.Size(99, 44); + this.btnEjectTape.Size = new System.Drawing.Size(79, 44); this.btnEjectTape.TabIndex = 7; this.btnEjectTape.Text = "Eject Tape"; this.btnEjectTape.UseVisualStyleBackColor = true; this.btnEjectTape.Click += new System.EventHandler(this.BtnEjectTape_Click); // + // btnEndTape + // + this.btnEndTape.Location = new System.Drawing.Point(293, 117); + this.btnEndTape.Name = "btnEndTape"; + this.btnEndTape.Size = new System.Drawing.Size(79, 44); + this.btnEndTape.TabIndex = 8; + this.btnEndTape.Text = "End Tape"; + this.btnEndTape.UseVisualStyleBackColor = true; + this.btnEndTape.Click += new System.EventHandler(this.BtnEndTape_Click); + // + // btnNotEndTape + // + this.btnNotEndTape.Location = new System.Drawing.Point(388, 117); + this.btnNotEndTape.Name = "btnNotEndTape"; + this.btnNotEndTape.Size = new System.Drawing.Size(79, 44); + this.btnNotEndTape.TabIndex = 9; + this.btnNotEndTape.Text = "Not End Tape"; + this.btnNotEndTape.UseVisualStyleBackColor = true; + this.btnNotEndTape.Click += new System.EventHandler(this.BtnNotEndTape_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.btnNotEndTape); + this.Controls.Add(this.btnEndTape); this.Controls.Add(this.btnEjectTape); this.Controls.Add(this.btnInsertTape); this.Controls.Add(this.statusLabel); @@ -141,6 +165,8 @@ private System.Windows.Forms.Label statusLabel; private System.Windows.Forms.Button btnInsertTape; private System.Windows.Forms.Button btnEjectTape; + private System.Windows.Forms.Button btnEndTape; + private System.Windows.Forms.Button btnNotEndTape; } } diff --git a/winVCR/winVCR/Form1.cs b/winVCR/winVCR/Form1.cs index 276effb..60a0d28 100644 --- a/winVCR/winVCR/Form1.cs +++ b/winVCR/winVCR/Form1.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Configuration; using System.Data; using System.Drawing; using System.Linq; @@ -8,15 +9,36 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using VCRlogic; + + + namespace winVCR { public partial class Form1 : Form { + + + + + public Form1() { InitializeComponent(); + + SMtape.initSMtape(); + + + } + + public void setLabelText(string txt) + { + statusLabel.Text = txt; + } + + private void BtnPlay_Click(object sender, EventArgs e) { } @@ -35,10 +57,20 @@ namespace winVCR private void BtnInsertTape_Click(object sender, EventArgs e) { - + SMtape.insertTape(); } private void BtnEjectTape_Click(object sender, EventArgs e) + { + SMtape.ejectTape(); + } + + private void BtnNotEndTape_Click(object sender, EventArgs e) + { + + } + + private void BtnEndTape_Click(object sender, EventArgs e) { } diff --git a/winVCR/winVCR/winVCR.csproj b/winVCR/winVCR/winVCR.csproj index 1ade938..0f69577 100644 --- a/winVCR/winVCR/winVCR.csproj +++ b/winVCR/winVCR/winVCR.csproj @@ -79,5 +79,11 @@ + + + {74f418c8-f030-41c7-ba8d-8a9b57253e45} + VCRlogic + + \ No newline at end of file