From dd0a823ff7e4dac680df8a78fe83e0bb852af9f2 Mon Sep 17 00:00:00 2001 From: test Date: Tue, 9 Apr 2019 19:22:56 +0200 Subject: [PATCH] finished project --- winVCR/VCRlogic/SMtape.cs | 25 ++++++++---------- winVCR/VCRlogic/SMvcr.cs | 46 +++++++++++++++++++++++++++------ winVCR/winVCR/Form1.Designer.cs | 7 ++--- 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/winVCR/VCRlogic/SMtape.cs b/winVCR/VCRlogic/SMtape.cs index daeb9c1..c754c0a 100644 --- a/winVCR/VCRlogic/SMtape.cs +++ b/winVCR/VCRlogic/SMtape.cs @@ -32,6 +32,10 @@ namespace VCRlogic _concreteState = e; } + public static StateTape getState() + { + return _concreteState; + } public static void insertTape() { @@ -81,7 +85,6 @@ namespace VCRlogic public class StapeNoTapeIn : StateTape { - public StapeNoTapeIn() { Debug.Print("NoTapeIn\n"); @@ -89,6 +92,7 @@ namespace VCRlogic // sub to event SMtape.evIntape += evIntape; } + public override void evIntape() { //unsub @@ -103,24 +107,22 @@ namespace VCRlogic public override void evEndtape() { - } public override void evNotendtape() { - } } public class StapeTapeInNotEnd : StateTape { - - public StapeTapeInNotEnd() { - Debug.Print("TapeInNotEnd\n"); + + SMvcr.tapeBeginn(); + //sub SMtape.evOuttape += evOuttape; SMtape.evEndtape += evEndtape; @@ -148,28 +150,24 @@ namespace VCRlogic public override void evNotendtape() { - } - - - } public class StapeTapeInEnd : StateTape { - public StapeTapeInEnd() { Debug.Print("TapeInEnd\n"); + + SMvcr.tapeEnd(); + SMtape.evOuttape += evOuttape; SMtape.evNoendtape += evNotendtape; - } public override void evIntape() { - } public override void evOuttape() @@ -181,7 +179,6 @@ namespace VCRlogic public override void evEndtape() { - } public override void evNotendtape() diff --git a/winVCR/VCRlogic/SMvcr.cs b/winVCR/VCRlogic/SMvcr.cs index 0e144cb..292fa5d 100644 --- a/winVCR/VCRlogic/SMvcr.cs +++ b/winVCR/VCRlogic/SMvcr.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; +using VCRlogic; public static class SMvcr @@ -65,33 +66,62 @@ public static class SMvcr public static void record() { - if (evRecordbutton != null) + if (SMtape.getState() is StapeTapeInNotEnd) { - evRecordbutton(); + if (evRecordbutton != null) + { + evRecordbutton(); + } } } public static void play() { - if (evPlaybutton != null) + if (SMtape.getState() is StapeTapeInNotEnd) { - evPlaybutton(); + if (evPlaybutton != null) + { + evPlaybutton(); + } } } public static void rewind() { - if (evRewindbutton != null) + if (SMtape.getState() is StapeTapeInEnd) { - evRewindbutton(); + if (evRewindbutton != null) + { + evRewindbutton(); + } } } public static void fastforward() { - if (evFastforwardbutton != null) + if (SMtape.getState() is StapeTapeInNotEnd) { - evFastforwardbutton(); + if (evFastforwardbutton != null) + { + evFastforwardbutton(); + } + } + } + + + public static void tapeEnd() + { + if (evEndtape != null) + { + evEndtape(); + } + } + + public static void tapeBeginn() + { + if (evBeginningtape != null) + { + evBeginningtape(); } } } diff --git a/winVCR/winVCR/Form1.Designer.cs b/winVCR/winVCR/Form1.Designer.cs index d72265e..c398c10 100644 --- a/winVCR/winVCR/Form1.Designer.cs +++ b/winVCR/winVCR/Form1.Designer.cs @@ -89,12 +89,13 @@ // this.statusLabel.AutoSize = true; this.statusLabel.Font = new System.Drawing.Font("Arial", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.statusLabel.Location = new System.Drawing.Point(242, 230); + this.statusLabel.Location = new System.Drawing.Point(267, 223); this.statusLabel.MinimumSize = new System.Drawing.Size(200, 50); this.statusLabel.Name = "statusLabel"; - this.statusLabel.Size = new System.Drawing.Size(291, 55); + this.statusLabel.Size = new System.Drawing.Size(200, 55); this.statusLabel.TabIndex = 5; - this.statusLabel.Text = "Status Label"; + this.statusLabel.Text = "Standby"; + this.statusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // btnInsertTape //