aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/Scripts/Read Dancer new.cs
blob: 9d15722915409c70e6295f2a9d445b01fced9bb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//-------------------------------------------
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;

//include "..\..\Defines\Tango_Defines_Basic.cs"
//include "..\Defines\Tango_Defines_Motors.cs"

	//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
Int32	last_14bit_position;
Int32	position_32bit;

	
public void OnExecute(StubManager stubManager)
{
	
	
//Create form
		Form form1 = new Form();

//--------------------------------------------------------------------------------

// Create buttons to use as the accept and cancel buttons.
 		Button button1 = new Button () 
	{
		Width = 100,
   	  	Height = 100,
  	};
   
 		Button button2 = new Button ()
    {
		Width = 100,
	   	Height = 100,
	 };
 		Button button3 = new Button ()
    {
		Width = 100,
	   	Height = 100,
	 };
//--------------------------------------------------------------------------------		
// Set the text of button
		   
		button1.Text = "Left Dancer";
		button2.Text = "Center Dancer";
 		button3.Text = "Right Dancer";
 
//--------------------------------------------------------------------------------
// Set the position of the button on the form.
		
		button1.Location = new Point (40, 40);

	    button2.Location
      		= new Point (button1.Left  + button1.Width + 10, 40);

	    button3.Location
      		= new Point (button2.Left  + button2.Width + 10, 40);

//--------------------------------------------------------------------------------
   // Add button to the form.
 
	    form1.Controls.Add(button1);

	    form1.Controls.Add(button2);

 	    form1.Controls.Add(button3);
 
//--------------------------------------------------------------------------------

// Set the caption bar text of the form.
   
		form1.Text = "Read Dancer";
		
//--------------------------------------------------------------------------------
   
   // Define the border style of the form to a dialog box.
   
  		form1.FormBorderStyle = FormBorderStyle.FixedDialog;
   
	// Set the MaximizeBox to false to remove the maximize box.

		form1.MaximizeBox = false;
   
	// Set the MinimizeBox to false to remove the minimize box.
   	
		form1.MinimizeBox = false;
   	
	// Set the start position of the form to the center of the screen.

		form1.StartPosition = FormStartPosition.CenterScreen;

   
	    form1.AutoSize = true;
	    form1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
//----------------------------------------- 	  
	    button1.Click += (_,__) =>
   {
			stubManager.Run<StubDancerPositionResponse>("StubDancerPositionRequest" ,0);
			Thread.Sleep(1000);
   };
//----------------------------------------- 	  
	    button2.Click += (_,__) =>
	    	
   {
			stubManager.Run<StubDancerPositionResponse>("StubDancerPositionRequest" ,1);
			Thread.Sleep(1000);
		
   };
//----------------------------------------- 	  

	    button3.Click += (_,__) =>
   {
			stubManager.Run<StubDancerPositionResponse>("StubDancerPositionRequest" ,2);
			Thread.Sleep(1000);
   };

//--------------------------------------------------------------------------------

// Display the form as a modal dialog box.
	    form1.ShowDialog();
	    
			stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,5, 3);
		
	
	return;
}