Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        public static async Task <CreateClientViewModel> Init(Guid workspaceId)
        {
            var workspaceModel = new WorkspaceModel(workspaceId);
            await workspaceModel.LoadAsync();

            return(new CreateClientViewModel(workspaceModel));
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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
            }));
        }
Ejemplo n.º 7
0
        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
            });
        }
Ejemplo n.º 8
0
        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;
            }
        }
Ejemplo n.º 9
0
 public static async Task<CreateClientViewModel> Init (Guid workspaceId)
 {
     var workspaceModel = new WorkspaceModel (workspaceId);
     await workspaceModel.LoadAsync ();
     return new CreateClientViewModel (workspaceModel);
 }
Ejemplo n.º 10
0
        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;
            }
        }