private void InitProject() { int projectId = -1; int.TryParse(NavigationContext.QueryString["ProjectId"], out projectId); Debug.Assert(projectId != -1, "ProjectId should not be null"); project = SterlingService.Current.Database.Query<Project, int>() .Where(delegate(TableKey<Project, int> key) { return key.Key == projectId; }) .First<TableKey<Project, int>>() .LazyValue.Value; Debug.Assert(project != null, "Project should not be null"); }
private void InitProject() { if (project != null) { InitTasks(); // keep the project info untouched, but refresh the tasks list. Needed when performing back navigation. return; } int projectId = -1; if (!NavigationContext.QueryString.ContainsKey("ProjectId") || !int.TryParse(NavigationContext.QueryString["ProjectId"], out projectId)) { project = new Project(); } else { project = SterlingService.Current.Database.Query<Project, int>() .Where(delegate(TableKey<Project, int> key) { return key.Key == projectId; }) .First<TableKey<Project, int>>() .LazyValue.Value; Debug.Assert(project != null, "Project should not be null"); } }
private void ShowProjectDetails(Project project) { NavigationService.Navigate(new Uri("/Views/ViewProject.xaml?ProjectId=" + project.Id, UriKind.Relative)); }