示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.WindowState   = FormWindowState.Minimized;
            this.ShowInTaskbar = false;
            ShareIcon n = new ShareIcon();

            n.CreateIcon(new NetworkInterface());

            n.UpdateInfo(new ConnectionInfo());
        }
        public void StartConnect(ShareIcon icon, IPAddress svrAddr, int svrPort, string username)
        {
            icon.ShowText("Connecting to: " + svrAddr.ToString() + ":" + svrPort.ToString(), 1);

            try
            {
                tcpC = new TcpClient();
                tcpC.Connect(svrAddr, svrPort);
                Thread runThread = new Thread(WaitForMessage);
                runThread.Start();
                return;
            }
            catch
            {
                icon.ShowText("Failed to connect", 3);
                return;
            }
        }