public UnansweredPage(Inspection inspection, InspectionPage page) { this.inspection = inspection; inspectionPage = page; List <Question> questions = new List <Question>(); foreach (SectionModel section in inspection.Checklist.Sections) { questions.AddRange(section.AllScorableQuestions()); } List <ScoredQuestion> scoredQuestions = inspection.scores; foreach (ScoredQuestion score in scoredQuestions) { questions.RemoveAll(q => q.Id == score.QuestionId); } //TableView table = new TableView(); //TableSection tableSection = new TableSection(); ListView view = new ListView(); view.ItemsSource = questions; view.ItemTemplate = new DataTemplate(() => { GoToQuestionButton button = new GoToQuestionButton(inspectionPage); button.SetBinding(Button.TextProperty, "ToStringForListing"); //FullString button.SetBinding(GoToQuestionButton.QuestionProperty, "SelfReference"); button.HorizontalOptions = LayoutOptions.StartAndExpand; StackLayout stack = new StackLayout(); stack.Padding = new Thickness(20, 0); stack.Children.Add(button); ViewCell cell = new ViewCell(); cell.View = stack; return(cell); /*GoToQuestionButton button = new GoToQuestionButton(inspectionPage); * button.SetBinding(Button.TextProperty,"FullString"); * button.SetBinding(GoToQuestionButton.QuestionProperty, "SelfReference"); * ViewCell cell = new ViewCell(); * cell.View = button; * return cell;*/ }); /*foreach (Question question in questions) * { * GoToQuestionButton button = new GoToQuestionButton(question, inspectionPage); * button.Text = question.ToString() + " " + question.Text; * ViewCell cell = new ViewCell(); * cell.View = button; * //tableSection.Add(cell); * }*/ //table.Root.Add(tableSection); //this.Content = table; Content = view; }
public DisputedPage(Inspection inspection, InspectionPage page) { this.inspection = inspection; inspectionPage = page; IEnumerable <Question> questions = inspection.scores.Where(s => s.answer == Answer.Disputed).Select(s => s.question); ListView view = new ListView(); view.ItemsSource = questions; view.ItemTemplate = new DataTemplate(() => { GoToQuestionButton button = new GoToQuestionButton(inspectionPage); button.SetBinding(Button.TextProperty, "ToStringForListing"); //FullString button.SetBinding(GoToQuestionButton.QuestionProperty, "SelfReference"); button.HorizontalOptions = LayoutOptions.StartAndExpand; StackLayout stack = new StackLayout(); stack.Padding = new Thickness(20, 0); stack.Children.Add(button); ViewCell cell = new ViewCell(); cell.View = stack; return(cell); }); Content = view; //TableView table = new TableView(); //table.Intent = TableIntent.Settings; //TableSection section = new TableSection(); /*foreach (ScoredQuestion score in disputedQuestions) * { * Question question = score.question; * GoToQuestionButton button = new GoToQuestionButton(question,inspectionPage); * button.Text = question.ToString() + " " + question.Text; * ViewCell cell = new ViewCell(); * cell.View = button; * section.Add(cell); * }*/ //table.Root.Add(section); //this.Content = table; }
public SectionNoPartsPage(SectionModel section, Inspection inspection, InspectionPage parentPage) { this.section = section; this.inspection = inspection; this.parentPage = parentPage; Title = section.ShortTitle; int scoredQuestions = inspection.scores.Count(s => s.question.section == section); if (section.AllScorableQuestions().Count == scoredQuestions) { Icon = InspectionHelper.CheckmarkFileName; } else if (scoredQuestions > 0) { Icon = InspectionHelper.HalfCircleFileName; } else { Icon = InspectionHelper.EmptyCircleFileName; } }