# HG changeset patch # User StephaneLenclud # Date 1469795627 -7200 # Node ID 6a84d8282226b82382e0924ac4f5ce49e7831e38 # Parent 4a03cc6f41b0c4315328ef4544392e4b50132e94 Adding test action button to edit action form. Action.DoExecute now protected. diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecActiveSource.cs --- a/Server/Actions/ActionCecActiveSource.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecActiveSource.cs Fri Jul 29 14:33:47 2016 +0200 @@ -25,7 +25,7 @@ /// /// Set the defined device type as active source. /// - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecClose.cs --- a/Server/Actions/ActionCecClose.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecClose.cs Fri Jul 29 14:33:47 2016 +0200 @@ -13,7 +13,7 @@ [AttributeAction(Id = "Cec.Close", Name = "CEC Close", Description = "Close CEC connection.")] class ActionCecClose : SharpLib.Ear.Action { - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecDevicePowerOn.cs --- a/Server/Actions/ActionCecDevicePowerOn.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecDevicePowerOn.cs Fri Jul 29 14:33:47 2016 +0200 @@ -26,7 +26,7 @@ /// /// /// - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecDeviceStandby.cs --- a/Server/Actions/ActionCecDeviceStandby.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecDeviceStandby.cs Fri Jul 29 14:33:47 2016 +0200 @@ -26,7 +26,7 @@ /// /// /// - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecInactiveSource.cs --- a/Server/Actions/ActionCecInactiveSource.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecInactiveSource.cs Fri Jul 29 14:33:47 2016 +0200 @@ -13,7 +13,7 @@ [AttributeAction(Id = "Cec.InactiveSource", Name = "CEC Inactive Source", Description = "Set this CEC device as inactive source.")] class ActionCecInactiveSource : SharpLib.Ear.Action { - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecOpen.cs --- a/Server/Actions/ActionCecOpen.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecOpen.cs Fri Jul 29 14:33:47 2016 +0200 @@ -13,7 +13,7 @@ [AttributeAction(Id = "Cec.Open", Name = "CEC Open", Description = "Open CEC connection.")] class ActionCecOpen : SharpLib.Ear.Action { - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecScan.cs --- a/Server/Actions/ActionCecScan.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecScan.cs Fri Jul 29 14:33:47 2016 +0200 @@ -14,7 +14,7 @@ [AttributeAction(Id = "Cec.Scan", Name = "CEC Scan", Description = "Scan devices on your CEC HDMI network.")] class ActionCecScan : SharpLib.Ear.Action { - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecUserControlPressed.cs --- a/Server/Actions/ActionCecUserControlPressed.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecUserControlPressed.cs Fri Jul 29 14:33:47 2016 +0200 @@ -56,7 +56,7 @@ /// /// /// - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionCecUserControlReleased.cs --- a/Server/Actions/ActionCecUserControlReleased.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionCecUserControlReleased.cs Fri Jul 29 14:33:47 2016 +0200 @@ -48,7 +48,7 @@ /// /// /// - public override void DoExecute() + protected override void DoExecute() { if (Cec.Client.Static == null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/Actions/ActionDisplayMessage.cs --- a/Server/Actions/ActionDisplayMessage.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/Actions/ActionDisplayMessage.cs Fri Jul 29 14:33:47 2016 +0200 @@ -65,7 +65,7 @@ /// /// /// - public override void DoExecute() + protected override void DoExecute() { StartMessageClient(); } diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/FormEditAction.Designer.cs --- a/Server/FormEditAction.Designer.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/FormEditAction.Designer.cs Fri Jul 29 14:33:47 2016 +0200 @@ -35,6 +35,7 @@ this.buttonCancel = new System.Windows.Forms.Button(); this.iTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.buttonTest = new System.Windows.Forms.Button(); this.SuspendLayout(); // // comboBoxActionType @@ -100,6 +101,17 @@ this.iTableLayoutPanel.Size = new System.Drawing.Size(312, 16); this.iTableLayoutPanel.TabIndex = 23; // + // buttonTest + // + this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonTest.Location = new System.Drawing.Point(252, 72); + this.buttonTest.Name = "buttonTest"; + this.buttonTest.Size = new System.Drawing.Size(75, 23); + this.buttonTest.TabIndex = 24; + this.buttonTest.Text = "Test"; + this.buttonTest.UseVisualStyleBackColor = true; + this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click); + // // FormEditAction // this.AcceptButton = this.buttonOk; @@ -109,6 +121,7 @@ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.CancelButton = this.buttonCancel; this.ClientSize = new System.Drawing.Size(339, 107); + this.Controls.Add(this.buttonTest); this.Controls.Add(this.iTableLayoutPanel); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonOk); @@ -134,5 +147,6 @@ private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.TableLayoutPanel iTableLayoutPanel; private System.Windows.Forms.ToolTip toolTip; + private System.Windows.Forms.Button buttonTest; } } \ No newline at end of file diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/FormEditAction.cs --- a/Server/FormEditAction.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/FormEditAction.cs Fri Jul 29 14:33:47 2016 +0200 @@ -316,5 +316,10 @@ } + private void buttonTest_Click(object sender, EventArgs e) + { + FetchPropertiesValue(Action); + Action.Execute(); + } } } diff -r 4a03cc6f41b0 -r 6a84d8282226 Server/FormMain.cs --- a/Server/FormMain.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/Server/FormMain.cs Fri Jul 29 14:33:47 2016 +0200 @@ -2790,6 +2790,7 @@ } FormEditAction ea = new FormEditAction(); + ea.Text = "Add action"; DialogResult res = CodeProject.Dialog.DlgBox.ShowDialog(ea); if (res == DialogResult.OK) { @@ -2816,6 +2817,7 @@ } FormEditAction ea = new FormEditAction(); + ea.Text = "Edit action"; ea.Action = selectedAction; int actionIndex = iTreeViewEvents.SelectedNode.Index; DialogResult res = CodeProject.Dialog.DlgBox.ShowDialog(ea); diff -r 4a03cc6f41b0 -r 6a84d8282226 SharpLibEar/Action.cs --- a/SharpLibEar/Action.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/SharpLibEar/Action.cs Fri Jul 29 14:33:47 2016 +0200 @@ -12,7 +12,7 @@ [KnownType("DerivedTypes")] public abstract class Action: IComparable { - public abstract void DoExecute(); + protected abstract void DoExecute(); public void Execute() { diff -r 4a03cc6f41b0 -r 6a84d8282226 SharpLibEar/ActionCallback.cs --- a/SharpLibEar/ActionCallback.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/SharpLibEar/ActionCallback.cs Fri Jul 29 14:33:47 2016 +0200 @@ -17,7 +17,7 @@ iCallback = aCallback; } - public override void DoExecute() + protected override void DoExecute() { if (iCallback != null) { diff -r 4a03cc6f41b0 -r 6a84d8282226 SharpLibEar/ActionSleep.cs --- a/SharpLibEar/ActionSleep.cs Fri Jul 29 13:09:38 2016 +0200 +++ b/SharpLibEar/ActionSleep.cs Fri Jul 29 14:33:47 2016 +0200 @@ -43,7 +43,7 @@ } - public override void DoExecute() + protected override void DoExecute() { Thread.Sleep(TimeoutInMilliseconds); }