public void ClientDisposed(Beetle.NetPackage.NetClient client) { Invoke(new Action <NetClient>(c => { txtStatus.Text = "close!"; }), client); }
public void Connected(Beetle.NetPackage.NetClient client) { Invoke(new Action <NetClient>(c => { txtStatus.Text = "connected!"; }), client); }
public void ClientError(Beetle.NetPackage.NetClient client, Exception e) { Invoke(new Action <Exception>(err => { txtError.Text = err.Message; }), e); }
public void ClientReceive(Beetle.NetPackage.NetClient client, object message) { if (message is Register) { Invoke(new Action <Register>(msg => { txtRegTime.Text = msg.RegTime.ToString(); }), message as Register); } }
public static void Invoke(Object actionobj, NetClient client, Object message) { lock (mActions) { Type key = actionobj.GetType(); ControllerAction action = null; if (!mActions.TryGetValue(key, out action)) { action = new ControllerAction(key); mActions[key] = action; } action.Invoke(actionobj, client, message); } }
public void Invoke(Object action, NetClient client, Object message) { MethodInfo method = null; if (mMethods.TryGetValue(message.GetType(), out method)) { try { method.Invoke(action, new object[] {client,message }); } catch (Exception e) { } } }
private void Form1_Load(object sender, EventArgs e) { mClient = new Beetle.NetPackage.NetClient("127.0.0.1", 9088, new NPPackage(), this); mClient.LittleEndian = false; mClient.Connect(); }