示例#1
0
 private void exitApp()
 {
     if (pcthread != null)
     {
         threadExe.Abort();
         threadExe = null;
         pcthread.Abort();
         pcthread = null;
     }
     if (scthread != null)
     {
         threadSender.Abort();
         threadSender = null;
         scthread.Abort();
         scthread = null;
     }
     Process.GetCurrentProcess().Kill();
     this.Close();
 }
示例#2
0
 private void bstop_Click(object sender, EventArgs e)
 {
     if (pcthread != null)
     {
         threadExe.Abort();
         threadExe = null;
         pcthread.Abort();
         pcthread = null;
     }
     if (scthread != null)
     {
         threadSender.Abort();
         threadSender = null;
         scthread.Abort();
         scthread = null;
     }
     bstart.Enabled = true;
     bstop.Enabled  = false;
     lstatus.Text   = "";
     // System.Drawing.Image image = new System.Drawing.Bitmap(Properties.Resources.pause);
 }
示例#3
0
        private void Connect()
        {
            int pcport = 0, scport = 0;

            try
            {
                if (IPBox.Text != null && IPBox.Text.Length > 0)
                {
                    try
                    {
                        pcport = int.Parse(PCPort.Text.Trim());
                        scport = int.Parse(SCPort.Text.Trim());
                    }
                    catch (Exception e)
                    {
                        System.Windows.Forms.MessageBox.Show(e.Message.ToString());
                    }
                }
                else
                {
                    pcport    = -1; scport = -1;
                    connected = false;
                }
                if (pcport != -1 && scport != -1)
                {
                    threadExe = new Thread(new ThreadStart((pcthread = new RemoteControlPC.CommandThread(IPBox.Text.ToString().Trim(), pcport, this)).Handle));
                    threadExe.Start();
                    threadExe.IsBackground = true;
                    threadSender           = new Thread(new ThreadStart((scthread = new RemoteControlPC.ScThread(IPBox.Text.ToString().Trim(), scport, this)).Handle));
                    threadSender.Start();
                    threadSender.IsBackground = true;
                    connected = true;
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message.ToString());
            }
        }