コード例 #1
0
        private bool LoadAllUsersInfo(bool bShowSuccessfulPopup = false)
        {
            //加载数据
            IEnumerable <UserInfo_API_Get> uisToGet;

            try
            {
                uisToGet =
                    WebApiClientHelper.DoJsonRequest <IEnumerable <UserInfo_API_Get> >(GlobalData.GetResUri("usersinfo"),
                                                                                       EnuHttpMethod.Get);
            }
            catch (ClientException ex)
            {
                Commands.ShowPopupAlert.Execute(new ShowPopupAlertParam {
                    AlertMessage = ex.Message, AlertType = EnuPopupAlertType.Error
                }, this);
                return(false);
            }

            IEnumerable <UserInfo_VM> uis_vm = Mapper.Map <IEnumerable <UserInfo_VM> >(uisToGet);

            foreach (var ui in uis_vm)
            {
                ui.ModelType = EnuModelType.View;
            }
            gridAllUsersInfoTab.DataContext = uis_vm;

            if (bShowSuccessfulPopup)
            {
                Commands.ShowPopupAlert.Execute(new ShowPopupAlertParam {
                    AlertMessage = "刷新所有用户信息成功.", AlertType = EnuPopupAlertType.Info
                }, this);
            }

            return(true);
        }