Пример #1
0
 public void AddRosterRequestAsk(long uid, long ruid, string rjid, string message, int type, long categoryId, long rosterCategoryId, IDKin.IM.Protocol.Center.User user)
 {
     RosterAddResponse response = new RosterAddResponse();
     response.category_id = categoryId;
     response.message = message;
     response.rjid = rjid;
     response.roster_category_id = rosterCategoryId;
     response.ruid = ruid;
     response.type = type;
     response.uid = uid;
     response.user = user;
     this.connection.Send(PacketType.ROSTER_ADD_ASK, response);
 }
        private void ShowAddRosterAskNewMessage(long rosterId, System.Collections.Generic.List <Message> list)
        {
            Message message = list[0];

            if (message != null)
            {
                RosterAddResponse response = message.MessageObject as RosterAddResponse;
                if (response != null)
                {
                    this.RosterAddAskNewMessage(response);
                    DataModel.Instance.RemoveMessage(response.uid, MessageActorType.AddRosterAsk);
                }
            }
        }
Пример #3
0
        public void AddRosterRequestAsk(long uid, long ruid, string rjid, string message, int type, long categoryId, long rosterCategoryId, IDKin.IM.Protocol.Center.User user)
        {
            RosterAddResponse response = new RosterAddResponse();

            response.category_id        = categoryId;
            response.message            = message;
            response.rjid               = rjid;
            response.roster_category_id = rosterCategoryId;
            response.ruid               = ruid;
            response.type               = type;
            response.uid  = uid;
            response.user = user;
            this.connection.Send(PacketType.ROSTER_ADD_ASK, response);
        }
 private void ArgeeAndRoster(RosterAddResponse response)
 {
     if (response != null)
     {
         MessageBox.Show(response.user.name + "同意您添加为好友!");
         Roster roster = new Roster();
         roster.Uid       = response.user.uid;
         roster.Jid       = response.user.jid;
         roster.Name      = response.user.name;
         roster.Nickname  = response.user.nickname;
         roster.Status    = (UserStatus)System.Enum.Parse(typeof(UserStatus), response.user.status.ToString());
         roster.Signature = response.user.signature;
         this.dataService.AddRoster(roster);
         INWindow inWindow = this.dataService.INWindow as INWindow;
         inWindow.FriendsList.AddRoster(roster);
     }
 }
        private void RosterAddAskNewMessage(RosterAddResponse response)
        {
            switch (response.type)
            {
            case 1:
                this.ArgeeAndRoster(response);
                break;

            case 2:
                this.ArgeeAndRoster(response);
                break;

            case 3:
                this.RejectRoster(response);
                break;
            }
        }
Пример #6
0
 private void RosterAddAskNewMessage(RosterAddResponse response)
 {
     switch (response.type)
     {
     case 1:
         this.ArgeeAndRoster(response);
         break;
     case 2:
         this.ArgeeAndRoster(response);
         break;
     case 3:
         this.RejectRoster(response);
         break;
     }
 }
Пример #7
0
 private void RejectRoster(RosterAddResponse response)
 {
     System.Windows.MessageBox.Show(response.user.name + "拒绝您添加为好友!");
 }
Пример #8
0
 private void ArgeeAndRoster(RosterAddResponse response)
 {
     if (response != null)
     {
         System.Windows.MessageBox.Show(response.user.name + "同意您添加为好友!");
         Roster roster = new Roster();
         roster.Uid = response.user.uid;
         roster.Jid = response.user.jid;
         roster.Name = response.user.name;
         roster.Nickname = response.user.nickname;
         roster.Status = (UserStatus)System.Enum.Parse(typeof(UserStatus), response.user.status.ToString());
         roster.Signature = response.user.signature;
         this.dataService.AddRoster(roster);
         INWindow inWindow = this.dataService.INWindow as INWindow;
         inWindow.FriendsList.AddRoster(roster);
     }
 }
 private void RejectRoster(RosterAddResponse response)
 {
     MessageBox.Show(response.user.name + "拒绝您添加为好友!");
 }
Пример #10
0
 public void Refresh()
 {
     try
     {
         this.lbMessageBox.Items.Clear();
         if (!this.dataModel.HasMessage())
         {
             NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.Default);
             base.Close();
         }
         foreach (string key in this.dataModel.MessageBoxSort)
         {
             if (!string.IsNullOrEmpty(key))
             {
                 System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(key);
                 if (list != null && list.Count > 0)
                 {
                     Message message = list[0];
                     if (message != null)
                     {
                         if (message.MessageObjectType == MessageActorType.EntStaff)
                         {
                             Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid)));
                             if (staff != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.EntStaff, staff.Uid, staff.Name, list.Count.ToString(), staff.HeaderImage);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.EntGroup)
                         {
                             EntGroup group = this.dataService.GetEntGroup(message.Gid);
                             if (group != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.EntGroup, group.Gid, group.Name, list.Count.ToString(), this.imageService.GetIcon(ImageTypeIcon.Group));
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.Roster)
                         {
                             Roster roster = this.dataService.GetRoster((long)((ulong)Jid.GetUid(message.FromJid)));
                             if (roster != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.Roster, roster.Uid, roster.Name, list.Count.ToString(), roster.HeaderImage);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.AddRoster)
                         {
                             RosterAddRequest request = message.MessageObject as RosterAddRequest;
                             if (request != null && request.user != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.AddRoster, request.uid, "验证消息", list.Count.ToString(), null);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.AddRosterAsk)
                         {
                             RosterAddResponse response = message.MessageObject as RosterAddResponse;
                             if (response != null && response.user != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.AddRosterAsk, response.uid, "验证消息", list.Count.ToString(), null);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                         if (message.MessageObjectType == MessageActorType.CooperationStaff)
                         {
                             CooperationStaff staff2 = this.dataService.GetCooperationStaff((long)((ulong)Jid.GetUid(message.FromJid)), message.ProjectId);
                             if (staff2 != null)
                             {
                                 MessageBoxItem mbi = new MessageBoxItem(MessageActorType.CooperationStaff, staff2.Uid, staff2.UnitedProjectid, staff2.Name, list.Count.ToString(), staff2.HeaderImage);
                                 this.lbMessageBox.Items.Add(mbi);
                             }
                         }
                     }
                 }
             }
         }
         base.Top = SystemParameters.WorkArea.Height - 47.0 - (double)(this.lbMessageBox.Items.Count * 30);
     }
     catch (System.Exception e)
     {
         this.logger.Error(e.ToString());
     }
 }
Пример #11
0
 private void AddRosterAskEvent(RosterAddResponse response)
 {
     try
     {
         if (response != null)
         {
             this.AddRosterAskTip(new Message
             {
                 MessageObjectType = MessageActorType.AddRosterAsk,
                 MessageObject = response
             }, response.uid);
         }
     }
     catch (System.Exception ex)
     {
         ServiceUtil.Instance.Logger.Error(ex.ToString());
     }
 }
Пример #12
0
 private void RejectRoster(RosterAddResponse response)
 {
     MessageBox.Show(response.user.name + "拒绝您添加为好友!", "提示");
 }