示例#1
0
 public static void Send(string code, string account, EnumPushCommands command, string content, params object[] param)
 {
     try
     {
         PushList.Where(p => p.Value.Code == code && p.Value.Account == account).ToList().ForEach(p =>
         {
             ICommunicationObject obj = (ICommunicationObject)p.Value.Callback;
             if (obj.State == CommunicationState.Opened)
                 p.Value.Callback.Notify(command, content, param);
             else
             {
                 PushInfo info = null;
                 PushList.TryRemove(p.Key, out info);
             }
         });
     }
     catch (Exception e)
     {
         JoveZhao.Framework.Logger.WriteLog(JoveZhao.Framework.LogType.ERROR, "发送消息错误", e);
     }
 }
示例#2
0
 /// <summary>
 /// 取消订阅
 /// </summary>
 /// <param name="codeAccount"></param>
 public static void UnSubscriber(Guid guid)
 {
     PushInfo pushInfo = null;
     if (PushList.ContainsKey(guid))
         PushList.TryRemove(guid, out pushInfo);
 }
示例#3
0
 /// <summary>
 /// 订阅
 /// </summary>
 /// <param name="codeAccount"></param>
 /// <param name="callback"></param>
 public static void Subscriber(Guid guid, string code, string account, IPublisherEvents callback)
 {
     PushInfo pushInfo = new PushInfo(code, account, callback);
     PushList.AddOrUpdate(guid, pushInfo, (a, b) => { return pushInfo; });
 }