private void Form_monitor_FormClosing(object sender, FormClosingEventArgs e) { mycursor.timerSpeed.Stop(); mycursor.Dispose(); mycursor.Close(); mycursor = null; moveCursor = false; if (timerExportData.Enabled) { timerExportData.Enabled = false; exportDataFile.CloseFile(); progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous; } ClientStatus.clientName = "PauseReconnect"; ClientStatus.inputoutputThread.Abort(); ClientStatus.client.Close(); frm1.Show(); }//end Form_monitor_FormClosing
public void Form_monitor_Load(object sender, EventArgs e) { commandHandler += new CommandHandler(this.GetCommand); this.Text += "_" + ClientStatus.clientName; DisplayMessage("Connection successful\r\n", textBox1); DisplayMessage("Your name is " + ClientStatus.clientName + "\r\n", textBox1); // start a new thread for sending and receiving messages ClientStatus.inputoutputThread = new Thread(new ThreadStart(Run)); ClientStatus.inputoutputThread.Start(); #region set frm_glyph Rectangle rect = new Rectangle(Screen.FromHandle(this.Handle).Bounds.Left, Screen.FromHandle(this.Handle).Bounds.Top, Screen.FromHandle(this.Handle).Bounds.Width, Screen.FromHandle(this.Handle).Bounds.Height); frm_glyph = new Form_Recognition(this, rect); frm_glyph.Show(); frm_glyph.Hide(); #endregion set frm_glyph mycursor = new AnimatedCursor(); timerExportData.Tick += new EventHandler(timerExportData_Tick); if (checkBox_showGaze.Checked) { mycursor.Show(); } comboBoxes = new ComboBox[8]; comboBoxes[0] = cmb_RightClick; comboBoxes[1] = cmb_LeftClick; comboBoxes[2] = cmb_Enter; comboBoxes[3] = cmb_Space; comboBoxes[4] = cmb_ArrowUp; comboBoxes[5] = cmb_ArrowDown; comboBoxes[6] = cmb_ArrowLeft; comboBoxes[7] = cmb_ArrowRight; foreach (ComboBox cmb in comboBoxes) { cmb.Text = "Select a command"; cmb.Items.Add("Select a command"); cmb.Items.Add("Blink"); cmb.Items.Add("DbBlink"); cmb.Items.Add("TR"); cmb.Items.Add("TL"); cmb.Items.Add("U_D"); cmb.Items.Add("U_U"); cmb.Items.Add("R_L"); cmb.Items.Add("R_R"); cmb.Items.Add("D_U"); cmb.Items.Add("D_D"); cmb.Items.Add("L_R"); cmb.Items.Add("L_L"); cmb.Items.Add("Custom1"); cmb.Items.Add("Custom2"); cmb.Items.Add("Custom3"); cmb.Items.Add("Custom4"); } }