private void OnNewProjectFabClick(object sender, EventArgs e) { var entryList = new List <TimeEntryData> (viewModel.TimeEntryList); ChangeListWorkspace(entryList, viewModel.ProjectList.Workspaces[viewModel.ProjectList.CurrentWorkspaceIndex].Data.Id); // Show create project activity instead var intent = BaseActivity.CreateDataIntent <NewProjectActivity, List <TimeEntryData> > (Activity, entryList, NewProjectActivity.ExtraTimeEntryDataListId); StartActivityForResult(intent, ProjectCreatedRequestCode); }
private async void OnItemSelected(object m) { ProjectModel project = null; WorkspaceModel workspace = null; TaskData task = null; if (m is WorkspaceProjectsView.Project) { var wrap = (WorkspaceProjectsView.Project)m; if (wrap.IsNoProject) { workspace = new WorkspaceModel(wrap.WorkspaceId); } else if (wrap.IsNewProject) { // Show create project activity instead var entryList = new List <TimeEntryData> (viewModel.TimeEntryList); var intent = BaseActivity.CreateDataIntent <NewProjectActivity, List <TimeEntryData> > (Activity, entryList, NewProjectActivity.ExtraTimeEntryDataListId); StartActivityForResult(intent, ProjectCreatedRequestCode); } else { project = (ProjectModel)wrap.Data; workspace = project.Workspace; } } else if (m is ProjectAndTaskView.Workspace) { var wrap = (ProjectAndTaskView.Workspace)m; workspace = (WorkspaceModel)wrap.Data; } else if (m is TaskData) { task = (TaskData)m; project = new ProjectModel(task.ProjectId); workspace = new WorkspaceModel(task.WorkspaceId); } if (project != null || workspace != null) { await viewModel.SaveModelAsync(project, workspace, task); Activity.Finish(); } }