using System; using System.Collections.Generic; using System.Linq; using System.Text; using Aitex.Core.WCF; using Aitex.Core.RT.Event; using System.ServiceModel; using Aitex.Core.WCF.Interface; namespace Aitex.Core.WCF { public class EventServiceClient : DuplexChannelServiceClientWrapper, IEventService { public event Action OnEvent; public EventServiceClient(EventServiceCallback callbackInstance) : base(new InstanceContext(callbackInstance), "Client_IEventService", "EventService") { callbackInstance.FireEvent += new Action(callbackInstance_FireEvent); } void callbackInstance_FireEvent(EventItem obj) { if (OnEvent != null) { OnEvent(obj); } } public bool Register(Guid id) { bool ret = false; Invoke(svc => { ret = svc.Register(id); }); return ret; } public void UnRegister(Guid id) { Invoke(svc => { svc.UnRegister(id); }); } } }