public void InitData()
 {
     try
     {
         this.recentList.Items.Clear();
         this.center.Clear();
         System.Collections.Generic.List <MessageCenterChatInfo> listmessage = LocalDataUtil.Instance.GetAllChatInfoBySort();
         if (listmessage != null && listmessage.Count > 0)
         {
             for (int i = listmessage.Count - 1; i >= 0; i--)
             {
                 if (listmessage[i] != null && !this.center.ContainsKey(listmessage[i].Id))
                 {
                     this.item = new RecentContactsItem(listmessage[i], false, true);
                     if (this.item.IsValue)
                     {
                         this.center.Add(listmessage[i].Id, listmessage[i]);
                         if (this.sessionService.Uid != listmessage[i].Id)
                         {
                             this.recentList.Items.Add(this.item);
                         }
                     }
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         this.logger.Error(ex.ToString());
     }
 }
 public void InitData()
 {
     try
     {
         this.recentList.Items.Clear();
         this.center.Clear();
         System.Collections.Generic.List<MessageCenterChatInfo> listmessage = LocalDataUtil.Instance.GetAllChatInfoBySort();
         if (listmessage != null && listmessage.Count > 0)
         {
             for (int i = listmessage.Count - 1; i >= 0; i--)
             {
                 if (listmessage[i] != null && !this.center.ContainsKey(listmessage[i].Id))
                 {
                     this.item = new RecentContactsItem(listmessage[i], false, true);
                     if (this.item.IsValue)
                     {
                         this.center.Add(listmessage[i].Id, listmessage[i]);
                         if (this.sessionService.Uid != listmessage[i].Id)
                         {
                             this.recentList.Items.Add(this.item);
                         }
                     }
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         this.logger.Error(ex.ToString());
     }
 }
Пример #3
0
        private void treeview_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TreeViewItem tvi = base.SelectedItem as TreeViewItem;

            if (tvi != null)
            {
                Department department = tvi.DataContext as Department;
                if (department != null)
                {
                    WindowModel.Instance.RecentPage.recentList.Items.Clear();
                    this.MessageCenter.Clear();
                    if (this.listmessage != null)
                    {
                        for (int i = this.listmessage.Count - 1; i >= 0; i--)
                        {
                            if (this.listmessage[i] != null && !this.MessageCenter.ContainsKey(this.listmessage[i].Id))
                            {
                                Staff staff = this.IsDepartStaff(this.listmessage[i], department.Id);
                                if (staff != null)
                                {
                                    RecentContactsItem item = new RecentContactsItem(this.listmessage[i], false, false);
                                    if (item.IsValue)
                                    {
                                        this.MessageCenter.Add(this.listmessage[i].Id, this.listmessage[i]);
                                        if (this.sessionService.Uid != this.listmessage[i].Id)
                                        {
                                            WindowModel.Instance.RecentPage.recentList.Items.Add(item);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    WindowModel.Instance.MessageCenterWindow.ViewMsgFrame.NavigationService.Navigate(WindowModel.Instance.RecentPage);
                    this.departmentNode[department.Id].IsExpanded = !this.departmentNode[department.Id].IsExpanded;
                    System.GC.Collect();
                }
            }
        }
Пример #4
0
 private void treeview_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     TreeViewItem tvi = base.SelectedItem as TreeViewItem;
     if (tvi != null)
     {
         Department department = tvi.DataContext as Department;
         if (department != null)
         {
             WindowModel.Instance.RecentPage.recentList.Items.Clear();
             this.MessageCenter.Clear();
             if (this.listmessage != null)
             {
                 for (int i = this.listmessage.Count - 1; i >= 0; i--)
                 {
                     if (this.listmessage[i] != null && !this.MessageCenter.ContainsKey(this.listmessage[i].Id))
                     {
                         Staff staff = this.IsDepartStaff(this.listmessage[i], department.Id);
                         if (staff != null)
                         {
                             RecentContactsItem item = new RecentContactsItem(this.listmessage[i], false, false);
                             if (item.IsValue)
                             {
                                 this.MessageCenter.Add(this.listmessage[i].Id, this.listmessage[i]);
                                 if (this.sessionService.Uid != this.listmessage[i].Id)
                                 {
                                     WindowModel.Instance.RecentPage.recentList.Items.Add(item);
                                 }
                             }
                         }
                     }
                 }
             }
             WindowModel.Instance.MessageCenterWindow.ViewMsgFrame.NavigationService.Navigate(WindowModel.Instance.RecentPage);
             this.departmentNode[department.Id].IsExpanded = !this.departmentNode[department.Id].IsExpanded;
             System.GC.Collect();
         }
     }
 }