public async void Init() { IsLoading = true; // Create workspace. workspace = new WorkspaceModel(workspaceId); // Create model. if (timeEntryList.Count > 1) { Model = new TimeEntryGroup(timeEntryList); } else if (timeEntryList.Count == 1) { Model = new TimeEntryModel(timeEntryList [0]); } // Load models. if (timeEntryList.Count > 1) { await Task.WhenAll(workspace.LoadAsync(), Model.LoadAsync()); } else { await workspace.LoadAsync(); } IsLoading = false; }
public async Task Init() { IsLoading = true; try { var user = ServiceContainer.Resolve <AuthManager> ().User; if (user == null) { model = null; return; } workspaceId = timeEntryList[0].WorkspaceId; workspaceModel = new WorkspaceModel(workspaceId); await workspaceModel.LoadAsync(); model = new ProjectModel { Workspace = workspaceModel, IsActive = true, IsPrivate = true }; if (model.Workspace == null || model.Workspace.Id == Guid.Empty) { model = null; } } catch (Exception ex) { model = null; } finally { model.PropertyChanged += OnModelChange; IsLoading = false; } }
public static async Task <CreateClientViewModel> Init(Guid workspaceId) { var workspaceModel = new WorkspaceModel(workspaceId); await workspaceModel.LoadAsync(); return(new CreateClientViewModel(workspaceModel)); }
public async Task Init() { try { var user = ServiceContainer.Resolve <AuthManager> ().User; if (user == null) { model = null; return; } workspaceModel = new WorkspaceModel(workspaceId); await workspaceModel.LoadAsync(); model = new ClientModel { Workspace = workspaceModel }; if (model.Workspace == null || model.Workspace.Id == Guid.Empty) { model = null; } } catch (Exception ex) { model = null; } finally { IsLoading = false; } }
private async void LoadData() { workspace = new WorkspaceModel(WorkspaceId); if (TimeEntryId != Guid.Empty) { timeEntry = new TimeEntryModel(TimeEntryId); await Task.WhenAll(workspace.LoadAsync(), timeEntry.LoadAsync()); } else { await workspace.LoadAsync(); } modelsLoaded = true; ValidateTagName(); }
public static async Task <NewProjectViewModel> Init(Guid workspaceId) { var workspaceModel = new WorkspaceModel(workspaceId); await workspaceModel.LoadAsync(); return(new NewProjectViewModel(new ProjectModel { Workspace = workspaceModel, IsActive = true, IsPrivate = true })); }
public static async Task<NewProjectViewModel> Init (Guid workspaceId) { var workspaceModel = new WorkspaceModel (workspaceId); await workspaceModel.LoadAsync (); return new NewProjectViewModel (new ProjectModel { Workspace = workspaceModel, IsActive = true, IsPrivate = true }); }
private async void LoadData() { timeEntry = new TimeEntryModel(TimeEntryId); workspace = new WorkspaceModel(WorkspaceId); await Task.WhenAll(timeEntry.LoadAsync(), workspace.LoadAsync()); if (timeEntry.Workspace == null || timeEntry.Workspace.Id == Guid.Empty) { // TODO: Better logic to determine if the models are actually non-existent Dismiss(); } else { modelsLoaded = true; } }
public static async Task<CreateClientViewModel> Init (Guid workspaceId) { var workspaceModel = new WorkspaceModel (workspaceId); await workspaceModel.LoadAsync (); return new CreateClientViewModel (workspaceModel); }
private async void LoadData () { timeEntry = new TimeEntryModel (TimeEntryId); workspace = new WorkspaceModel (WorkspaceId); await Task.WhenAll (timeEntry.LoadAsync (), workspace.LoadAsync ()); if (timeEntry.Workspace == null || timeEntry.Workspace.Id == Guid.Empty) { // TODO: Better logic to determine if the models are actually non-existent Dismiss (); } else { modelsLoaded = true; } }