コード例 #1
0
ファイル: UserListVM.cs プロジェクト: mehabadi/HPMS
        private void refresh()
        {
            var sortBy = Users.SortDescriptions.ToDictionary(sortDesc => sortDesc.PropertyName, sortDesc =>
                                                             (sortDesc.Direction == ListSortDirection.Ascending ? "ASC" : "DESC"));

            ShowBusyIndicator("در حال دریافت اطلاعات...");

            userService.GetAllUsers(
                (res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                HideBusyIndicator();
                if (exp == null)
                {
                    if (res.Result != null)
                    {
                        Users.SourceCollection = res.Result;
                    }
                    else
                    {
                        Users.SourceCollection = new Collection <UserDTOWithActions>();
                    }
                    Users.TotalItemCount = res.TotalCount;
                    Users.PageIndex      = Math.Max(0, res.CurrentPage - 1);
                }
                else
                {
                    appController.HandleException(exp);
                }
            }), Users.PageSize, Users.PageIndex + 1, sortBy, UserCriteria);
        }