Exemplo n.º 1
0
 private void getAllUserInfo()
 {
     ThreadPool.QueueUserWorkItem(delegate
     {
         GetAllUserInfoWorker.SendGetAllUserInfoRequest(
             successCallback : delegate(GetAllUserInfoResponse response)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 response.DataList = response.DataList.Where(item => item.RegistrationTimeStamp != null).ToArray();
                 _AllUserInfoList  = response.DataList;
                 if (_oldAllUserInfo == null)
                 {
                     _oldAllUserInfo = response.DataList;
                 }
                 yonghuliebiao.SetDataSource(_AllUserInfoList);
                 if (_waitingApproveUserNameList != null)
                 {
                     _WaitingApproveUserList = new List <GetUserInfoResponse>();
                     for (int i = 0; i < _waitingApproveUserNameList.Count; i++)
                     {
                         GetUserInfoResponse userInfo = _AllUserInfoList.FirstOrDefault(t => t.PhoneNumber == _waitingApproveUserNameList[i]);
                         if (userInfo != null)
                         {
                             _WaitingApproveUserList.Add(userInfo);
                         }
                     }
                     if (_WaitingApproveUserList != null)
                     {
                         yonghushenhe.SetDataSource(_WaitingApproveUserList);
                     }
                 }
                 foreach (DataListItem item in _AllOrder)
                 {
                     GetUserInfoResponse userInfo = _AllUserInfoList.FirstOrDefault(t => t.PhoneNumber == item.UserId);
                     if (userInfo != null)
                     {
                         item.ChineseName = userInfo.ChineseName;
                     }
                 }
                 if (_AllOrder != null)
                 {
                     dingdanliebiao.SetDataSource(_AllOrder);
                 }
             }));
         },
             failureCallback : delegate(string failureReason)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 MessageBox.Show("获取用户列表。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk);
             }));
         },
             errorCallback : delegate(Exception ex)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 Util.ShowExceptionMessage(ex, "获取用户列表出错。");
             }));
         }
             );
     });
 }
Exemplo n.º 2
0
        private void GetAllUserInfo()
        {
            ThreadPool.QueueUserWorkItem(delegate
            {
                GetAllUserInfoWorker.SendGetAllUserInfoRequest(
                    successCallback : delegate(GetAllUserInfoResponse response)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        _UserNameList        = response.DataList;
                        _UserNameList        = _UserNameList.Where(item => item.RegistrationTimeStamp != null).ToArray();
                        _WaitingUserInfoList = new List <GetUserInfoResponse>();
                        if (_waitingApproveUserNameList != null)
                        {
                            for (int i = 0; i < _waitingApproveUserNameList.Count; i++)
                            {
                                GetUserInfoResponse userInfo = _UserNameList.FirstOrDefault(t => t.PhoneNumber == _waitingApproveUserNameList[i]);
                                if (userInfo != null)
                                {
                                    _WaitingUserInfoList.Add(userInfo);
                                }
                            }
                        }
                        foreach (DataListItem item in _datalist)
                        {
                            GetUserInfoResponse userInfo = _UserNameList.FirstOrDefault(t => t.PhoneNumber == item.UserId);
                            if (userInfo != null)
                            {
                                item.ChineseName = userInfo.ChineseName;
                            }
                        }
                        //AdminWindow adminWindow = new AdminWindow(_UserNameList , _datalist , _WaitingApproveUserInfoList);
                        //adminWindow.Loaded += delegate
                        //{
                        //    Visibility = Visibility.Hidden;
                        //};
                        //adminWindow.ShowDialog();
                        NotificationWindow admin = new NotificationWindow(_WaitingUserInfoList, _datalist, _UserNameList);
                        admin.Loaded            += delegate
                        {
                            Visibility = System.Windows.Visibility.Hidden;
                        };

                        admin.ShowDialog();
                    }));
                },
                    failureCallback : delegate(string failureReason)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        ResumeGUI();
                        MessageBox.Show("获取用户列表。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    }));
                },
                    errorCallback : delegate(Exception ex)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        ResumeGUI();
                        Util.ShowExceptionMessage(ex, "获取用户列表出错。");
                    }));
                }
                    );
            });
        }