1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- 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>, IEventService
- {
- public event Action<EventItem> OnEvent;
- public EventServiceClient(EventServiceCallback callbackInstance)
- : base(new InstanceContext(callbackInstance), "Client_IEventService", "EventService")
- {
- callbackInstance.FireEvent += new Action<EventItem>(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); });
- }
- }
- }
|