static void Main() { Win32.AllocConsole(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); InputDialog d = new InputDialog("Connection details", "Which server:port ?", "localhost:9999"); if (d.ShowDialog() != DialogResult.OK) { return; } string[] parts = d.Input.Split(':'); string host = parts[0]; string port = parts.Length > 1 ? parts[1] : "9999"; PolhemusController polhemus = null; PhidgetController phidget = null; if (isDebug == false) { polhemus = new PolhemusController(false); phidget = new PhidgetController(polhemus); } mainForm = new Form1(polhemus, phidget, host, port); Application.Run(mainForm); }
public Form1(PolhemusController newPolhemusController, PhidgetController newPhidgetController, string host, string port) { this.host = host; this.port = port; InitializeComponent(); this.SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); polhemusController = newPolhemusController; phidgetController = newPhidgetController; this.BackColor = Color.Black; this.Size = new Size(Program.tableWidth, Program.tableHeight); studyController = new HaikuStudyController(HaikuStudyPosition.SideBySide);//, HaikuStudyType.RealArmsPictureArms); wordBoxController = new WordBoxController(studyController); if (studyController.isActuatePenalty == true) { //phidgetController.setUpServos(); } //to snap words back to their original locations when dropped outside of a user's paper, set this to true. wordBoxController.boxesShouldSnapBack = true; studyController.wordBoxController = wordBoxController; studyController.currentCondition = HaikuStudyCondition.Cursors; studyController.isInSetUpMode = false; setMouseProperties(); setUpEmbodiments(); if (Program.kinectEnabled) { // Set up KinectTable kinectData = new KinectData(); // Set up session parameters SessionParameters sessionParams = new SessionParameters(KinectDataParams.EnableType.All); sessionParams.DataParams.validityImageEnable = false; sessionParams.DataParams.testImageEnable = false; // Connect to a local Kinect and hook up to the data event kinectClient = KinectTableNet.KinectTable.ConnectLocal(sessionParams); kinectClient.DataReady += kinectClient_DataReady; // Set up Kinect calibration kinectCalibration = new KinectCalibrationController(); // Read the saved table depth tweak value ReadTableDepthTweak(); } Cursor.Hide(); Load += Form1_Load; FormClosed += Form1_FormClosed; playerID = 0; updateTimer = new Timer(); updateTimer.Interval = 25; updateTimer.Tick += new EventHandler(updateTimer_Tick); updateTimer.Start(); }