public MainWindow() { InitializeComponent(); Client = new InformerClient(); Client.OnAuthed += OnAuthed; Client.OnMessage += OnMessage; Client.OnPacketRecv += OnPacketRecv; Client.OnPacketSent += OnPacketSent; }
static void Main() { ServerOpt so = new ServerOpt(); Client = new InformerClient(); Client.OnMessage += Console.WriteLine; Client.OnAuthed += () => { Console.WriteLine("Authed..."); new Thread(SendOnlineUpdates).Start(); }; ScsClient = ScsServiceClientBuilder.CreateClient <IInformerService> (new ScsTcpEndPoint(so.serverip, so.informerPort), Client); ScsClient.Timeout = ScsClient.ConnectTimeout = 2500; ScsClient.Connected += (sender, args) => { Console.WriteLine("Connected..."); ScsClient.ServiceProxy.Auth(so.sercurityKey); }; while (true) { try { if (ScsClient.CommunicationState == CommunicationStates.Disconnected) { ScsClient.Connect(); } while (ScsClient.CommunicationState == CommunicationStates.Connected) { Thread.Sleep(1000); } } catch { } SendUpdate(); //Offline } }