Adding event test button.
authorStephaneLenclud
Fri, 29 Jul 2016 14:46:30 +0200
changeset 2297c631055b94b
parent 228 6a84d8282226
child 230 8c5cf2228e9a
Adding event test button.
Server/FormMain.Designer.cs
Server/FormMain.cs
SharpLibEar/Action.cs
SharpLibEar/Event.cs
     1.1 --- a/Server/FormMain.Designer.cs	Fri Jul 29 14:33:47 2016 +0200
     1.2 +++ b/Server/FormMain.Designer.cs	Fri Jul 29 14:46:30 2016 +0200
     1.3 @@ -129,6 +129,7 @@
     1.4              this.labelFontHeight = new System.Windows.Forms.Label();
     1.5              this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     1.6              this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
     1.7 +            this.buttonEventTest = new System.Windows.Forms.Button();
     1.8              this.panelDisplay.SuspendLayout();
     1.9              this.iTableLayoutPanel.SuspendLayout();
    1.10              this.statusStrip.SuspendLayout();
    1.11 @@ -973,6 +974,7 @@
    1.12              // 
    1.13              // tabPageEvent
    1.14              // 
    1.15 +            this.tabPageEvent.Controls.Add(this.buttonEventTest);
    1.16              this.tabPageEvent.Controls.Add(this.buttonActionEdit);
    1.17              this.tabPageEvent.Controls.Add(this.buttonActionMoveUp);
    1.18              this.tabPageEvent.Controls.Add(this.buttonActionMoveDown);
    1.19 @@ -1187,6 +1189,17 @@
    1.20              // 
    1.21              this.openFileDialog.Filter = "EXE files (*.exe)|*.exe|All files (*.*)|*.*";
    1.22              // 
    1.23 +            // buttonEventTest
    1.24 +            // 
    1.25 +            this.buttonEventTest.Enabled = false;
    1.26 +            this.buttonEventTest.Location = new System.Drawing.Point(6, 122);
    1.27 +            this.buttonEventTest.Name = "buttonEventTest";
    1.28 +            this.buttonEventTest.Size = new System.Drawing.Size(96, 23);
    1.29 +            this.buttonEventTest.TabIndex = 26;
    1.30 +            this.buttonEventTest.Text = "Test Event";
    1.31 +            this.buttonEventTest.UseVisualStyleBackColor = true;
    1.32 +            this.buttonEventTest.Click += new System.EventHandler(this.buttonEventTest_Click);
    1.33 +            // 
    1.34              // FormMain
    1.35              // 
    1.36              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    1.37 @@ -1330,6 +1343,7 @@
    1.38          private System.Windows.Forms.Button buttonActionMoveDown;
    1.39          private System.Windows.Forms.Button buttonActionTest;
    1.40          private System.Windows.Forms.Button buttonActionEdit;
    1.41 +        private System.Windows.Forms.Button buttonEventTest;
    1.42      }
    1.43  }
    1.44  
     2.1 --- a/Server/FormMain.cs	Fri Jul 29 14:33:47 2016 +0200
     2.2 +++ b/Server/FormMain.cs	Fri Jul 29 14:46:30 2016 +0200
     2.3 @@ -2863,7 +2863,7 @@
     2.4              SharpLib.Ear.Action a = CurrentAction();
     2.5              if (a != null)
     2.6              {
     2.7 -                Console.WriteLine("Action test run");
     2.8 +                Console.WriteLine("Action testing:");
     2.9                  a.Execute();
    2.10              }
    2.11              iTreeViewEvents.Focus();
    2.12 @@ -2930,6 +2930,21 @@
    2.13  
    2.14  
    2.15          /// <summary>
    2.16 +        /// 
    2.17 +        /// </summary>
    2.18 +        /// <param name="sender"></param>
    2.19 +        /// <param name="e"></param>
    2.20 +        private void buttonEventTest_Click(object sender, EventArgs e)
    2.21 +        {
    2.22 +            Event earEvent = CurrentEvent();
    2.23 +            if (earEvent != null)
    2.24 +            {
    2.25 +                Console.WriteLine("Event testing:");
    2.26 +                earEvent.Trigger();
    2.27 +            }
    2.28 +        }
    2.29 +
    2.30 +        /// <summary>
    2.31          /// Manages events and actions buttons according to selected item in event tree.
    2.32          /// </summary>
    2.33          /// <param name="sender"></param>
    2.34 @@ -2937,7 +2952,9 @@
    2.35          private void iTreeViewEvents_AfterSelect(object sender, TreeViewEventArgs e)
    2.36          {
    2.37              //Enable buttons according to selected item
    2.38 -            buttonActionAdd.Enabled = CurrentEvent() != null;
    2.39 +            buttonActionAdd.Enabled =
    2.40 +            buttonEventTest.Enabled =
    2.41 +                CurrentEvent() != null;
    2.42  
    2.43              SharpLib.Ear.Action currentAction = CurrentAction();
    2.44              //If an action is selected enable the following buttons
     3.1 --- a/SharpLibEar/Action.cs	Fri Jul 29 14:33:47 2016 +0200
     3.2 +++ b/SharpLibEar/Action.cs	Fri Jul 29 14:46:30 2016 +0200
     3.3 @@ -16,7 +16,7 @@
     3.4  
     3.5          public void Execute()
     3.6          {
     3.7 -            Console.WriteLine("Executing action: " + Brief());
     3.8 +            Console.WriteLine("Action executing: " + Brief());
     3.9              DoExecute();
    3.10          }
    3.11  
     4.1 --- a/SharpLibEar/Event.cs	Fri Jul 29 14:33:47 2016 +0200
     4.2 +++ b/SharpLibEar/Event.cs	Fri Jul 29 14:46:30 2016 +0200
     4.3 @@ -29,7 +29,7 @@
     4.4  
     4.5          public override void Trigger()
     4.6          {
     4.7 -            Console.WriteLine("Event '" + Name + "' triggered.");
     4.8 +            Console.WriteLine("Event triggered: " + Name);
     4.9              foreach (Action action in Actions)
    4.10              {
    4.11                  action.Execute();