예제 #1
0
 public void Connect()
 {
     if (isOnline == false)
     {
         try
         {
             helper.Ready();
             if (helper.tcpClient != null)
             {
                 DataHelpers.ShowHandler += ShowMsg;
                 helper.DataHandler      += CC.DataHandle.Handle;
                 Task.Run(() => helper.ReceiveData());
                 isOnline = true;
             }
             else
             {
                 ShowMsg(null, "无法连接到服务器");
             }
         }
         catch (Exception e)
         {
             ShowMsg(null, e.Message);
         }
     }
 }
예제 #2
0
 public ServerUser(TcpClient tcpClient)
 {
     Helper              = new TCPHelper();
     Helper.tcpClient    = tcpClient;
     Helper.DataHandler += DataHelpers.Handle4Server;
     Helper.Ready();
     Task.Run(() => Helper.ReceiveData());
 }
예제 #3
0
 public UserOnServer(TcpClient tcpClient)
 {
     helper              = new TCPHelper();
     helper.tcpClient    = tcpClient;
     helper.DataHandler += CC.DataHandle.Handle;
     helper.Ready();
     Task.Run(() => helper.ReceiveData());
 }
예제 #4
0
 public SignupWindow()
 {
     InitializeComponent();
     DataHelpers.ShowHandler += this.ShowMsg;
     Task.Run(() => tcpHelper.ReceiveData());
 }