From 8f472d766284f91784b8a2e160abfc659f1735c2 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 18 Jun 2013 10:34:09 +0200 Subject: [PATCH] add LecturepageModel --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + .../Model/Lecture/LecturePageModel.cs | 171 ++++++++++++++++++ .../Pages/Lecture/LecturePage.xaml.cs | 96 ++-------- .../CampusAppWP8/Properties/WMAppManifest.xml | 2 +- 4 files changed, 188 insertions(+), 82 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 63d3a82e..3d9378d5 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -109,6 +109,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs new file mode 100644 index 00000000..bc87358d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -0,0 +1,171 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 18.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Resources; + using System.Collections.Generic; + + public class LecturePageModel + { + #region Members + + /// + /// List for the courses of the BTU + /// + /// + /// need to be extend to full list + /// + private List courseList; + + /// + /// List of the degrees + /// + private List degreeList; + + /// + /// List of the semester + /// + private List semesterList; + + /// + /// List for the number of semester + /// + private List numberList; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LecturePageModel() + { + } + #endregion + + #region Proberty + + /// + /// Gets List for the courses of the BTU + /// + /// + /// need to be extend to full list + /// + public List CourseList + { + get + { + return this.courseList; + } + } + + /// + /// Gets List of the degrees + /// + public List DegreeList + { + get + { + return this.degreeList; + } + } + + /// + /// Gets List of the semester + /// + public List SemesterList + { + get + { + return this.semesterList; + } + } + + /// + /// Gets List for the number of semester + /// + public List NumberList + { + get + { + return this.numberList; + } + } + #endregion + + #region Methods + + #region public + + /// + /// Load all ListpickerLists + /// + public void LoadLists() + { + this.LoadCourseList(); + this.LoadDegreeList(); + this.LoadNumberList(); + this.LoadSemesterList(); + } + + #endregion + + #region private + + /// + /// Load the NumberList + /// + private void LoadNumberList() + { + this.numberList = new List(); + this.numberList.Add(new ListPickerItemModel() { Text = "1", Value = "1" }); + this.numberList.Add(new ListPickerItemModel() { Text = "2", Value = "2" }); + this.numberList.Add(new ListPickerItemModel() { Text = "3", Value = "3" }); + this.numberList.Add(new ListPickerItemModel() { Text = "4", Value = "4" }); + } + + /// + /// Load the SemesterList + /// + private void LoadSemesterList() + { + this.semesterList = new List(); + this.semesterList.Add(new ListPickerItemModel() { Text = "SoSe 13", Value = "20131" }); + this.semesterList.Add(new ListPickerItemModel() { Text = "WiSe 13/14", Value = "20132" }); + this.semesterList.Add(new ListPickerItemModel() { Text = "SoSe 14", Value = "20131" }); + } + + /// + /// Load the DegreeList + /// + private void LoadDegreeList() + { + this.degreeList = new List(); + this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Bachelor, Value = "82" }); + this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Master, Value = "88" }); + this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Diploma, Value = "11" }); + } + + /// + /// Load the DegreeList + /// + private void LoadCourseList() + { + this.courseList = new List(); + this.courseList.Add(new ListPickerItemModel() { Text = "Architektur", Value = "013" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Bauingenieurwesen", Value = "017" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Betriebswirtschaftslehre", Value = "021" }); + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 2ba1e36c..29c0b7f5 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -36,82 +36,7 @@ namespace CampusAppWP8.Pages.Lecture /// /// need to be extend to full list /// - private List courseList = new List() - { - new ListPickerItemModel() - { - Text = "Architektur", Value = "013" - }, - new ListPickerItemModel() - { - Text = "Bauingenieurwesen", Value = "017" - }, - new ListPickerItemModel() - { - Text = "Betriebswirtschaftslehre", Value = "021" - } - }; - - /// - /// List of the degrees - /// - private List degreeList = new List() - { - new ListPickerItemModel() - { - Text = AppResources.Degree_Bachelor, Value = "82" - }, - new ListPickerItemModel() - { - Text = AppResources.Degree_Master, Value = "88" - }, - new ListPickerItemModel() - { - Text = AppResources.Degree_Diploma, Value = "11" - } - }; - - /// - /// List of the semester - /// - private List semesterList = new List() - { - new ListPickerItemModel() - { - Text = "SoSe 13", Value = "20131" - }, - new ListPickerItemModel() - { - Text = "WiSe 13/14", Value = "20132" - }, - new ListPickerItemModel() - { - Text = "SoSe 14", Value = "20141" - } - }; - - /// - /// List for the number of semester - /// - private List numberList = new List() - { - new ListPickerItemModel() - { - Text = "1", Value = "1" - }, - new ListPickerItemModel() - { - Text = "2", Value = "2" - }, - new ListPickerItemModel() - { - Text = "3", Value = "3" - }, - new ListPickerItemModel() - { - Text = "4", Value = "4" - } - }; + private LecturePageModel pageModel; /// /// Initializes a new instance of the class. @@ -119,6 +44,7 @@ namespace CampusAppWP8.Pages.Lecture public LecturePage() { this.InitializeComponent(); + this.LoadPageModel(); this.SetupListPickers(); if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible) { @@ -126,16 +52,24 @@ namespace CampusAppWP8.Pages.Lecture } } + /// + /// Load the PageModel + /// + private void LoadPageModel() + { + this.pageModel = new LecturePageModel(); + this.pageModel.LoadLists(); + } /// /// Method sets the ItemSource of the ListPickers /// private void SetupListPickers() { - this.Course.ItemsSource = this.courseList; - this.Degree.ItemsSource = this.degreeList; - this.From.ItemsSource = this.numberList; - this.To.ItemsSource = this.numberList; - this.Semester.ItemsSource = this.semesterList; + this.Course.ItemsSource = pageModel.CourseList; + this.Degree.ItemsSource = pageModel.DegreeList; + this.From.ItemsSource = pageModel.NumberList; + this.To.ItemsSource = pageModel.NumberList; + this.Semester.ItemsSource = pageModel.SemesterList; } /// diff --git a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml index f4b319d3..b65e09d5 100644 --- a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml +++ b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml @@ -13,7 +13,7 @@ - +