/// <summary> /// set focus property /// </summary> public async void LoadData() { try { IEnumerable <RoleDto> roles = await ServiceClient <IRoleService> .ExecuteAsync(d => d.FindRolesAsync()); Roles = new ObservableCollection <IRoleModel>(_roleFactory.Convert(roles)); } catch (Exception ex) { _notificationService.ShowDialog(ex.Message, Translation.Translate("Error")); } if (IsNameFocused) { IsNameFocused = false; } IsNameFocused = true; }
/// <summary> /// Loads the data. /// </summary> public async void LoadData() { try { AreResourcesLoading = true; IEnumerable <IResourceModel> resourceModels = _resourceFactory .Convert(await ServiceClient <IResourceService> .ExecuteAsync(d => d.FindAsync())) .ToList(); Resources = new ListCollectionView(resourceModels.ToList()); } catch (Exception ex) { _notificationService.ShowDialog(ex.Message, Translation.Translate("Error")); } finally { AreResourcesLoading = false; } }
/// <summary> /// Lädt ClientContext Data /// </summary> private async Task <LoadClientResult> LoadClientContext() { LoadClientResult loadClientRes = new LoadClientResult(); try { IModelFactory <IUserModel, UserDto> factory = Container.Resolve <IModelFactory <IUserModel, UserDto> >(); Tuple <UserDto, IEnumerable <ClientRights> > userInformation = await ServiceClient <IUserService> .ExecuteAsync(d => d.GetCurrentUserAsync()); ClientContext.CurrentUser = factory.Convert(userInformation.Item1); ClientContext.ClientRights = userInformation.Item2; loadClientRes.IsSuccessfull = true; Constants.UserId = ClientContext.CurrentUser.Id; } catch (FaultException <RemoteFault> exception) { FaultException <RemoteFault> faultException = exception; loadClientRes.FaultId = faultException.Detail.FaultId; Common.Logger.Logger.Write(exception); loadClientRes.IsSuccessfull = false; } catch (EndpointNotFoundException exception) { Common.Logger.Logger.Write(exception); loadClientRes.IsSuccessfull = false; throw; } catch (Exception ex) { Common.Logger.Logger.Write(ex); loadClientRes.IsSuccessfull = false; throw; } return(loadClientRes); }