public void Init() { // 声明消息发送循环方法(有消息就发) var action = new Action(() => { while (_isSending) { RollMessage[] msgs; lock (_sync_sendWhispers) { msgs = new RollMessage[_sendWhispers.Count]; _sendWhispers.CopyTo(msgs, 0); _sendWhispers.Clear(); } foreach (var msg in msgs) { // todo: 改为异步调用?? ContactCenterProxy.Whisper(msg.ID, new byte[][] { BitConverter.GetBytes((int)msg.RollAction), msg.Data }); } msgs = null; Thread.Sleep(1); } }); // 开始执行 action.BeginInvoke(null, null); }
public ContactCenterCallback(IContactCenterCallbackHandler handler) { this._handler = handler; InstanceContext site = new InstanceContext(this); this._proxy = new ContactCenterProxy(site); handler.ContactCenterProxy = this._proxy; this._proxy.BeginJoin(handler.ServiceID, new AsyncCallback(OnEndJoin), null); }
public ContactCenterCallback(IContactCenterCallbackHandler handler) { this._handler = handler; InstanceContext site = new InstanceContext(this); this._proxy = new ContactCenterProxy(site); handler.ContactCenterProxy = this._proxy; this._proxy.BeginJoin(handler.ServiceID, new AsyncCallback(OnEndJoin), null); }
private void ExitServiceSession() { try { _proxy.Leave(); } catch { } finally { if (_proxy != null) { _proxy.Abort(); _proxy.Close(); _proxy = null; } } }
private void ExitServiceSession() { try { _proxy.Leave(); } catch { } finally { if (_proxy != null) { _proxy.Abort(); _proxy.Close(); _proxy = null; } } }