//------------------------------------------- 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("StubDancerPositionRequest" ,0); Thread.Sleep(1000); }; //----------------------------------------- button2.Click += (_,__) => { stubManager.Run("StubDancerPositionRequest" ,1); Thread.Sleep(1000); }; //----------------------------------------- button3.Click += (_,__) => { stubManager.Run("StubDancerPositionRequest" ,2); Thread.Sleep(1000); }; //-------------------------------------------------------------------------------- // Display the form as a modal dialog box. form1.ShowDialog(); stubManager.Run("StubMotorStopRequest" ,5, 3); return; }