From 6338caea9c65b3c6f99e569d6af6251f0652db56 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 23 Jul 2013 15:35:41 +0200 Subject: [PATCH 01/10] add userprofil --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 10 ++ .../File/UserProfil/UserProfilFile.cs | 75 ++++++++ .../Model/UserProfil/UserProfilModel.cs | 161 ++++++++++++++++++ .../Pages/Setting/UserProfil.xaml | 134 +++++++++++++++ .../Pages/Setting/UserProfil.xaml.cs | 20 +++ .../CampusAppWP8/Pages/StartPage.xaml | 8 +- .../CampusAppWP8/Pages/StartPage.xaml.cs | 10 +- .../Resources/AppResources.Designer.cs | 54 ++++++ .../CampusAppWP8/Resources/AppResources.resx | 18 ++ .../Resources/Constants.Designer.cs | 18 ++ .../CampusAppWP8/Resources/Constants.resx | 9 +- CampusAppWP8/CampusAppWP8/Settings.cs | 21 +++ 12 files changed, 532 insertions(+), 6 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/File/UserProfil/UserProfilFile.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs create mode 100644 CampusAppWP8/CampusAppWP8/Settings.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 30b3410b..366beb46 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -98,7 +98,13 @@ + + + + UserProfil.xaml + + @@ -290,6 +296,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/CampusAppWP8/CampusAppWP8/File/UserProfil/UserProfilFile.cs b/CampusAppWP8/CampusAppWP8/File/UserProfil/UserProfilFile.cs new file mode 100644 index 00000000..8323f5fa --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/File/UserProfil/UserProfilFile.cs @@ -0,0 +1,75 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.File.UserProfil +{ + using CampusAppWP8.Model; + using CampusAppWP8.Model.UserProfil; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + + public class UserProfilFile : XmlModel + { + + #region Constructor + /// + /// Initializes a new instance of the class. + /// + /// automatic loading of the data + public UserProfilFile(bool autoload = false) : base(ModelType.File, Constants.FileProfil_User) + { + this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); + this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); + if (autoload) + { + this.LoadData(); + } + } + + // Constructor + #endregion + + + /// + /// Method implement CheckIsFileUpToDate()-Method . + /// + /// model object + /// file info object + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDateOnLoad(UserProfilModel model, FileInfo info) + { + if (this.Model == null) + { + return true; + } + + return false; + } + + /// + /// Method implement CheckIsFileUpToDate()-Method . + /// + /// model object + /// file info object + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDateOnSave(UserProfilModel model, FileInfo info) + { + if (model != null && model.HasChanged()) + { + return true; + } + + return false; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs b/CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs new file mode 100644 index 00000000..cfa9f398 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs @@ -0,0 +1,161 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.UserProfil +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + using System.Xml.Serialization; + + /// + /// Model for the profil of an user + /// + [XmlRoot("root")] + public class UserProfilModel + { + + private bool changed = false; + /// + /// Gets or Sets the course of the user + /// + private string course; + + /// + /// Gets or Sets the role of the user + /// + private int role; + + /// + /// Gets or Sets the degree of the user + /// + private string degree; + + + /// + /// Gets or Sets the semester of the user + /// + private string semester; + + /// + /// Gets or Sets the course of the user + /// + [XmlElement("Course")] + public string Course + { + get + { + return this.course; + } + set + { + if (value != this.course) + { + this.course = value; + this.changed = true; + } + } + } + + /// + /// Gets or Sets the role of the user + /// + [XmlElement("Role")] + public int Role + { + get + { + return this.role; + } + set + { + if (value != this.role) + { + this.role = value; + this.changed = true; + } + } + } + + + /// + /// Gets or Sets the degree of the user + /// + [XmlElement("Degere")] + public string Degree + { + get + { + return this.degree; + } + set + { + if (value != this.degree) + { + this.degree = value; + this.changed = true; + } + } + } + + + /// + /// Gets or Sets the semester of the user + /// + [XmlElement("Semseter")] + public string Semester + { + get + { + return this.semester; + } + set + { + if (value != this.semester) + { + this.semester = value; + this.changed = true; + } + } + } + + + /// + /// Specifies the role of the user. + /// + public enum RoleType + { + /// + /// Invalid/unset state. + /// + INVALID = 0, + + /// + /// for students (01). + /// + Student = 1, + + /// + /// for staffs (10). + /// + Staff = 2, + } + + public bool HasChanged(bool reset = true) + { + bool result = this.changed; + + if (reset) + { + changed = false; + } + return result; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml new file mode 100644 index 00000000..0db945a9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs new file mode 100644 index 00000000..604fbb1c --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; + +namespace CampusAppWP8.Pages.Setting +{ + public partial class UserProfil : PhoneApplicationPage + { + public UserProfil() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml index 42dc15ff..32df20a7 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -137,5 +137,11 @@ - + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index eaa6d530..d3a9410e 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -13,6 +13,7 @@ namespace CampusAppWP8.Pages using System.Windows.Navigation; using CampusAppWP8.Resources; using Microsoft.Phone.Controls; + using Microsoft.Phone.Shell; /// /// Class for the StartPage @@ -25,6 +26,11 @@ namespace CampusAppWP8.Pages public StartPage() { this.InitializeComponent(); + ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem; + if (menuItem1 != null) + { + menuItem1.Text = AppResources.Setting_UserProfilAppBarTitle; + } } /// @@ -74,9 +80,9 @@ namespace CampusAppWP8.Pages } } - private void OpenDepartmentApp(object sender, RoutedEventArgs e) + private void ApplicationBarMenuItem_Click(object sender, EventArgs e) { - Uri url = new Uri(Constants.PathDepartment_DepartmentIndexPage, UriKind.Relative); + Uri url = new Uri(Constants.PathSetting_User, UriKind.Relative); NavigationService.Navigate(url); } } diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index a51dd3a1..f9852643 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -573,6 +573,60 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt. + /// + public static string Setting_User { + get { + return ResourceManager.GetString("Setting_User", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt. + /// + public static string Setting_UserCourse { + get { + return ResourceManager.GetString("Setting_UserCourse", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Abschluss ähnelt. + /// + public static string Setting_UserDegree { + get { + return ResourceManager.GetString("Setting_UserDegree", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt. + /// + public static string Setting_UserProfilAppBarTitle { + get { + return ResourceManager.GetString("Setting_UserProfilAppBarTitle", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Rolle ähnelt. + /// + public static string Setting_UserRole { + get { + return ResourceManager.GetString("Setting_UserRole", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Semster ähnelt. + /// + public static string Setting_UserSemester { + get { + return ResourceManager.GetString("Setting_UserSemester", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Freitag ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 1272c78b..cb0c2c98 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -320,4 +320,22 @@ Aktualisieren + + Profileinstellungen + + + Studiengang + + + Abschluss + + + Profileinstellungen + + + Rolle + + + Semster + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index e79b1eff..9f836c95 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -132,6 +132,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die user.xml ähnelt. + /// + public static string FileProfil_User { + get { + return ResourceManager.GetString("FileProfil_User", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die StudentCouncils.xml ähnelt. /// @@ -402,6 +411,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Setting/UserProfil.xaml ähnelt. + /// + public static string PathSetting_User { + get { + return ResourceManager.GetString("PathSetting_User", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/StudentCouncil/StudentCouncilPage.xaml ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 2e3354f7..e76644ca 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -251,9 +251,6 @@ MensaFeed.xml - - - EventsFeed.xml EventsFeed.xml @@ -276,4 +273,10 @@ http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php + + user.xml + + + /Pages/Setting/UserProfil.xaml + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs new file mode 100644 index 00000000..2012e0ce --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Settings.cs @@ -0,0 +1,21 @@ +using CampusAppWP8.File.UserProfil; + +namespace CampusAppWP8 +{ + public class Settings + { + private static UserProfilFile userProfil = new UserProfilFile(true); + + public static UserProfilFile UserProfil + { + get + { + return UserProfil; + } + set + { + UserProfil = value; + } + } + } +} From c2871bb3d110b569210102cc5ca774f2dc8a2c79 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 24 Jul 2013 11:00:55 +0200 Subject: [PATCH 02/10] add validation userprofile --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 4 +- .../{UserProfil => Setting}/UserProfilFile.cs | 29 +- .../Model/Setting/UserProfilModel.cs | 278 ++++++++++++++++++ .../Model/UserProfil/UserProfilModel.cs | 161 ---------- .../Resources/Constants.Designer.cs | 63 ++++ .../CampusAppWP8/Resources/Constants.resx | 21 ++ CampusAppWP8/CampusAppWP8/Settings.cs | 27 +- 7 files changed, 401 insertions(+), 182 deletions(-) rename CampusAppWP8/CampusAppWP8/File/{UserProfil => Setting}/UserProfilFile.cs (81%) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs delete mode 100644 CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 366beb46..a39c91ea 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -98,8 +98,8 @@ - - + + UserProfil.xaml diff --git a/CampusAppWP8/CampusAppWP8/File/UserProfil/UserProfilFile.cs b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs similarity index 81% rename from CampusAppWP8/CampusAppWP8/File/UserProfil/UserProfilFile.cs rename to CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs index 8323f5fa..0f7e2471 100644 --- a/CampusAppWP8/CampusAppWP8/File/UserProfil/UserProfilFile.cs +++ b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs @@ -5,41 +5,38 @@ // stubbfel // 23.07.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.File.UserProfil +namespace CampusAppWP8.File.Setting { - using CampusAppWP8.Model; - using CampusAppWP8.Model.UserProfil; - using CampusAppWP8.Resources; - using CampusAppWP8.Utility; - using System; - using System.Collections.Generic; using System.IO; - using System.Linq; - using System.Text; - using System.Threading.Tasks; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Setting; + using CampusAppWP8.Resources; + /// + /// Class for handle the user-profile-file + /// public class UserProfilFile : XmlModel { - #region Constructor + /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// automatic loading of the data - public UserProfilFile(bool autoload = false) : base(ModelType.File, Constants.FileProfil_User) + public UserProfilFile(bool autoLoad = false) + : base(ModelType.File, Constants.FileProfil_User) { this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); - if (autoload) + if (autoLoad) { this.LoadData(); } } - + // Constructor #endregion - /// /// Method implement CheckIsFileUpToDate()-Method . /// diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs new file mode 100644 index 00000000..97e16619 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs @@ -0,0 +1,278 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Setting +{ + using System.Xml.Serialization; + using CampusAppWP8.Resources; + + /// + /// Model for the profile of an user + /// + [XmlRoot("root")] + public class UserProfilModel + { + #region Members + + /// + /// constant for the first validate semester + /// + private static readonly int FirstSemester = int.Parse(Constants.Valid_FirstSemseter); + + /// + /// constant for the last validate semester + /// + private static readonly int LastSemester = int.Parse(Constants.Valid_LastSemseter); + + /// + /// constant for the max. number of a validate course + /// + private static readonly int MaxCourseNumber = int.Parse(Constants.Valid_MaxCourseNumber); + + /// + /// constant for the default value of a semester + /// + private static readonly int DefaultSemester = int.Parse(Constants.Setting_DefaultSemester); + + /// + /// constant for the default value of a courseNumber + /// + private static readonly int DefaultCourseNumber = int.Parse(Constants.Setting_DefaultSemester); + + /// + /// constant for the default value of a role + /// + private static readonly int DefaultRole = int.Parse(Constants.Setting_DefaultRole); + + /// + /// constant for the default value of a degree + /// + private static readonly int DefaultDegree = int.Parse(Constants.Setting_DefaultDegree); + + /// + /// Flag which indicates that any properties has been changed + /// + private bool changed = false; + + /// + /// Gets or Sets the course of the user + /// + private int course; + + /// + /// Gets or Sets the role of the user + /// + private RoleType role = RoleType.DEFAULT; + + /// + /// Gets or Sets the degree of the user + /// + private DegreeType degree = DegreeType.DEFAULT; + + /// + /// Gets or Sets the semester of the user + /// + private int semester = UserProfilModel.DefaultSemester; + + #endregion + + #region Enums + /// + /// Specifies the degrees. + /// + public enum DegreeType + { + /// + /// Default value + /// + DEFAULT = UserProfilModel.DefaultRole, + + /// + /// bachelor degree + /// + BACHELOR = 82, + + /// + /// master degree + /// + MASTER = 88, + + /// + /// diploma degree + /// + DIPLOM = 11 + } + + /// + /// Specifies the role of the user. + /// + public enum RoleType + { + /// + /// Default value + /// + DEFAULT = UserProfilModel.DefaultRole, + + /// + /// for students (01). + /// + STUDENT = 1, + + /// + /// for staffs (10). + /// + STAFF = 2, + } + + #endregion + + #region Proberties + /// + /// Gets or sets the course of the user + /// + [XmlElement("Course")] + public int Course + { + get + { + return this.course; + } + + set + { + if (value != this.course && this.ValditateCourse(value)) + { + this.course = value; + this.changed = true; + } + } + } + + /// + /// Gets or sets the role of the user + /// + [XmlElement("Role")] + public RoleType Role + { + get + { + return this.role; + } + + set + { + if (value != this.role) + { + this.role = value; + this.changed = true; + } + } + } + + /// + /// Gets or sets the degree of the user + /// + [XmlElement("Degere")] + public DegreeType Degree + { + get + { + return this.degree; + } + + set + { + if (value != this.degree) + { + this.degree = value; + this.changed = true; + } + } + } + + /// + /// Gets or sets the semester of the user + /// + [XmlElement("Semseter")] + public int Semester + { + get + { + return this.semester; + } + + set + { + if (value != this.semester && this.ValditateSemester(value)) + { + this.semester = value; + this.changed = true; + } + } + } + #endregion + + #region Methods + + #region public + + /// + /// Method return the changed flag + /// + /// if is true, set changed flag to false, otherwise do nothing (bypass) + /// return true, if any properties has changed, otherwise false + public bool HasChanged(bool reset = true) + { + bool result = this.changed; + + if (reset) + { + this.changed = false; + } + + return result; + } + + #endregion + + #region private + + /// + /// Methods check if a value could be a valid semester + /// + /// value which has to be checked + /// true if it is an valid semester, otherwise false + private bool ValditateSemester(int possibleSemester) + { + if (possibleSemester < UserProfilModel.FirstSemester || possibleSemester > UserProfilModel.LastSemester) + { + return false; + } + + return true; + } + + /// + /// Methods check if a value could be a valid course + /// + /// value which has to be checked + /// true if it is an valid course, otherwise false + private bool ValditateCourse(int possibleCourse) + { + if (possibleCourse > UserProfilModel.MaxCourseNumber) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs b/CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs deleted file mode 100644 index cfa9f398..00000000 --- a/CampusAppWP8/CampusAppWP8/Model/UserProfil/UserProfilModel.cs +++ /dev/null @@ -1,161 +0,0 @@ -//----------------------------------------------------------------------- -// -// Company copyright tag. -// -// stubbfel -// 23.07.2013 -//---------------------------------------------------------------------- -namespace CampusAppWP8.Model.UserProfil -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using System.Xml.Serialization; - - /// - /// Model for the profil of an user - /// - [XmlRoot("root")] - public class UserProfilModel - { - - private bool changed = false; - /// - /// Gets or Sets the course of the user - /// - private string course; - - /// - /// Gets or Sets the role of the user - /// - private int role; - - /// - /// Gets or Sets the degree of the user - /// - private string degree; - - - /// - /// Gets or Sets the semester of the user - /// - private string semester; - - /// - /// Gets or Sets the course of the user - /// - [XmlElement("Course")] - public string Course - { - get - { - return this.course; - } - set - { - if (value != this.course) - { - this.course = value; - this.changed = true; - } - } - } - - /// - /// Gets or Sets the role of the user - /// - [XmlElement("Role")] - public int Role - { - get - { - return this.role; - } - set - { - if (value != this.role) - { - this.role = value; - this.changed = true; - } - } - } - - - /// - /// Gets or Sets the degree of the user - /// - [XmlElement("Degere")] - public string Degree - { - get - { - return this.degree; - } - set - { - if (value != this.degree) - { - this.degree = value; - this.changed = true; - } - } - } - - - /// - /// Gets or Sets the semester of the user - /// - [XmlElement("Semseter")] - public string Semester - { - get - { - return this.semester; - } - set - { - if (value != this.semester) - { - this.semester = value; - this.changed = true; - } - } - } - - - /// - /// Specifies the role of the user. - /// - public enum RoleType - { - /// - /// Invalid/unset state. - /// - INVALID = 0, - - /// - /// for students (01). - /// - Student = 1, - - /// - /// for staffs (10). - /// - Staff = 2, - } - - public bool HasChanged(bool reset = true) - { - bool result = this.changed; - - if (reset) - { - changed = false; - } - return result; - } - } -} diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index 9f836c95..8d36a1aa 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -429,6 +429,42 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die 767 ähnelt. + /// + public static string Setting_DefaultCourseNumber { + get { + return ResourceManager.GetString("Setting_DefaultCourseNumber", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die 82 ähnelt. + /// + public static string Setting_DefaultDegree { + get { + return ResourceManager.GetString("Setting_DefaultDegree", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die 1 ähnelt. + /// + public static string Setting_DefaultRole { + get { + return ResourceManager.GetString("Setting_DefaultRole", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die 20131 ähnelt. + /// + public static string Setting_DefaultSemester { + get { + return ResourceManager.GetString("Setting_DefaultSemester", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die ToggleContent ähnelt. /// @@ -537,6 +573,33 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die 20121 ähnelt. + /// + public static string Valid_FirstSemseter { + get { + return ResourceManager.GetString("Valid_FirstSemseter", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die 20502 ähnelt. + /// + public static string Valid_LastSemseter { + get { + return ResourceManager.GetString("Valid_LastSemseter", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die 999 ähnelt. + /// + public static string Valid_MaxCourseNumber { + get { + return ResourceManager.GetString("Valid_MaxCourseNumber", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die root ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index e76644ca..2b9355db 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -279,4 +279,25 @@ /Pages/Setting/UserProfil.xaml + + 767 + + + 82 + + + 1 + + + 20131 + + + 20121 + + + 20502 + + + 999 + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs index 2012e0ce..7ba1d747 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.cs +++ b/CampusAppWP8/CampusAppWP8/Settings.cs @@ -1,20 +1,41 @@ -using CampusAppWP8.File.UserProfil; +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.07.2013 +//---------------------------------------------------------------------- namespace CampusAppWP8 { + using CampusAppWP8.File.Setting; + + /// + /// Class handle all setting (files) + /// public class Settings { + /// + /// reference of the user-profile-file + /// private static UserProfilFile userProfil = new UserProfilFile(true); + /// + /// Gets or sets the user-profile-file + /// public static UserProfilFile UserProfil { get { - return UserProfil; + return Settings.userProfil; } + set { - UserProfil = value; + if (value != Settings.userProfil) + { + Settings.userProfil = value; + } } } } From 1136e29034de30b2aafaca4d35a4d01817ff7494 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 24 Jul 2013 14:00:59 +0200 Subject: [PATCH 03/10] update gitzignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index cbb8760a..fdb60427 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,6 @@ winphone/ *.srum Doxyfile screenshots/ +CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/sl3-wp/Microsoft.Phone.Controls.Toolkit.dll +CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/sl4-windowsphone71/Microsoft.Phone.Controls.Toolkit.dll +CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/wp8/Microsoft.Phone.Controls.Toolkit.dll From 88320657e9bd1a959e827b387f415ef8d598fa4d Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 25 Jul 2013 10:20:40 +0200 Subject: [PATCH 04/10] delete default role and degrre --- .../Model/Setting/UserProfilModel.cs | 24 ++----------------- .../Resources/Constants.Designer.cs | 18 -------------- .../CampusAppWP8/Resources/Constants.resx | 6 ----- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs index 97e16619..7d815106 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs @@ -43,16 +43,6 @@ namespace CampusAppWP8.Model.Setting /// private static readonly int DefaultCourseNumber = int.Parse(Constants.Setting_DefaultSemester); - /// - /// constant for the default value of a role - /// - private static readonly int DefaultRole = int.Parse(Constants.Setting_DefaultRole); - - /// - /// constant for the default value of a degree - /// - private static readonly int DefaultDegree = int.Parse(Constants.Setting_DefaultDegree); - /// /// Flag which indicates that any properties has been changed /// @@ -66,12 +56,12 @@ namespace CampusAppWP8.Model.Setting /// /// Gets or Sets the role of the user /// - private RoleType role = RoleType.DEFAULT; + private RoleType role = RoleType.STUDENT; /// /// Gets or Sets the degree of the user /// - private DegreeType degree = DegreeType.DEFAULT; + private DegreeType degree = DegreeType.BACHELOR; /// /// Gets or Sets the semester of the user @@ -86,11 +76,6 @@ namespace CampusAppWP8.Model.Setting /// public enum DegreeType { - /// - /// Default value - /// - DEFAULT = UserProfilModel.DefaultRole, - /// /// bachelor degree /// @@ -112,11 +97,6 @@ namespace CampusAppWP8.Model.Setting /// public enum RoleType { - /// - /// Default value - /// - DEFAULT = UserProfilModel.DefaultRole, - /// /// for students (01). /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index 8d36a1aa..53ac413a 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -438,24 +438,6 @@ namespace CampusAppWP8.Resources { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die 82 ähnelt. - /// - public static string Setting_DefaultDegree { - get { - return ResourceManager.GetString("Setting_DefaultDegree", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die 1 ähnelt. - /// - public static string Setting_DefaultRole { - get { - return ResourceManager.GetString("Setting_DefaultRole", resourceCulture); - } - } - /// /// Sucht eine lokalisierte Zeichenfolge, die 20131 ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 2b9355db..45793b16 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -282,12 +282,6 @@ 767 - - 82 - - - 1 - 20131 From a3014d04c8b0841489184f35053ccaea35ca6b9a Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 25 Jul 2013 12:45:56 +0200 Subject: [PATCH 05/10] add settings to appload --- CampusAppWP8/CampusAppWP8/App.xaml.cs | 27 ++++++++++++++++++- .../File/Setting/UserProfilFile.cs | 6 +---- .../Model/Setting/UserProfilModel.cs | 4 +-- .../Pages/Setting/UserProfil.xaml | 2 +- .../Pages/Setting/UserProfil.xaml.cs | 12 +++++++++ .../CampusAppWP8/Pages/StartPage.xaml | 2 +- .../CampusAppWP8/Pages/StartPage.xaml.cs | 12 +++++++++ CampusAppWP8/CampusAppWP8/Settings.cs | 4 +-- 8 files changed, 57 insertions(+), 12 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs index e0f3e904..9c9b665f 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -8,6 +8,8 @@ using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using CampusAppWP8.Resources; using System.IO.IsolatedStorage; +using CampusAppWP8.File.Setting; +using CampusAppWP8.Model.Setting; namespace CampusAppWP8 @@ -128,13 +130,36 @@ namespace CampusAppWP8 // Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt private void Application_Launching(object sender, LaunchingEventArgs e) { + this.LoadSettings(); + } + + private void LoadSettings() + { + UserProfilFile userFile; + userFile = Settings.UserProfil; + if (userFile.Model == null) + { + userFile.onLoaded += new UserProfilFile.OnLoaded(this.UserSettingsLoaded); + userFile.LoadData(); + } + else + { + this.UserSettingsLoaded(); + } + } + private void UserSettingsLoaded() + { + if (Settings.UserProfil.Model == null) + { + Settings.UserProfil.Model = new UserProfilModel(); + } } // Code, der ausgeführt werden soll, wenn die Anwendung aktiviert wird (in den Vordergrund gebracht wird) // Dieser Code wird beim ersten Starten der Anwendung nicht ausgeführt private void Application_Activated(object sender, ActivatedEventArgs e) { - + this.LoadSettings(); } // Code, der ausgeführt werden soll, wenn die Anwendung deaktiviert wird (in den Hintergrund gebracht wird) diff --git a/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs index 0f7e2471..49dd10d3 100644 --- a/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs +++ b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs @@ -23,15 +23,11 @@ namespace CampusAppWP8.File.Setting /// Initializes a new instance of the class. /// /// automatic loading of the data - public UserProfilFile(bool autoLoad = false) + public UserProfilFile() : base(ModelType.File, Constants.FileProfil_User) { this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad); this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave); - if (autoLoad) - { - this.LoadData(); - } } // Constructor diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs index 7d815106..38da0528 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs @@ -41,7 +41,7 @@ namespace CampusAppWP8.Model.Setting /// /// constant for the default value of a courseNumber /// - private static readonly int DefaultCourseNumber = int.Parse(Constants.Setting_DefaultSemester); + private static readonly int DefaultCourseNumber = int.Parse(Constants.Setting_DefaultCourseNumber); /// /// Flag which indicates that any properties has been changed @@ -51,7 +51,7 @@ namespace CampusAppWP8.Model.Setting /// /// Gets or Sets the course of the user /// - private int course; + private int course = UserProfilModel.DefaultCourseNumber; /// /// Gets or Sets the role of the user diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml index 0db945a9..940eb46c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml @@ -43,7 +43,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs index 604fbb1c..d908777a 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs @@ -7,14 +7,26 @@ using System.Windows.Controls; using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; +using CampusAppWP8.Model.Setting; +using CampusAppWP8.File.Setting; namespace CampusAppWP8.Pages.Setting { public partial class UserProfil : PhoneApplicationPage { + UserProfilFile userFile; public UserProfil() { InitializeComponent(); + userFile = Settings.UserProfil; + + this.SetupListPickers(); + + } + + private void SetupListPickers() + { + Test.Text = userFile.Model.Course.ToString(); } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml index 32df20a7..22cd2213 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -138,7 +138,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index d3a9410e..c6f84e3c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -85,5 +85,17 @@ namespace CampusAppWP8.Pages Uri url = new Uri(Constants.PathSetting_User, UriKind.Relative); NavigationService.Navigate(url); } + + private void ApplicationBar_StateChanged(object sender, ApplicationBarStateChangedEventArgs e) + { + if (e.IsMenuVisible) + { + ApplicationBar.Opacity = 0.99; + } + else + { + ApplicationBar.Opacity = 0.5; + } + } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs index 7ba1d747..efb0f5b6 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.cs +++ b/CampusAppWP8/CampusAppWP8/Settings.cs @@ -13,12 +13,12 @@ namespace CampusAppWP8 /// /// Class handle all setting (files) /// - public class Settings + public static class Settings { /// /// reference of the user-profile-file /// - private static UserProfilFile userProfil = new UserProfilFile(true); + private static UserProfilFile userProfil = new UserProfilFile(); /// /// Gets or sets the user-profile-file From 75b6b4501f208c4cf3353f953180ed5b4033099c Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 25 Jul 2013 15:24:24 +0200 Subject: [PATCH 06/10] update20130725 --- CampusAppWP8/CampusAppWP8/App.xaml.cs | 2 + CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 5 + .../File/Setting/UserProfilFile.cs | 4 +- .../Model/Lecture/LecturePageModel.cs | 2 +- .../Utility/CourseListPickerItemListModel .cs | 80 +++++++++++++ .../Utility/DegreeListPickerItemListModel .cs | 41 +++++++ .../Model/Utility/ListPickerItemListModel.cs | 113 ++++++++++++++++++ .../Model/Utility/ListPickerItemModel.cs | 18 +++ .../Utility/RoleListPickerItemListModel .cs | 40 +++++++ .../SemesterListPickerItemListModel .cs | 41 +++++++ CampusAppWP8/CampusAppWP8/Model/XmlModel.cs | 1 + .../Pages/Setting/UserProfil.xaml | 2 +- .../Pages/Setting/UserProfil.xaml.cs | 46 ++++++- .../Resources/AppResources.Designer.cs | 18 +++ .../CampusAppWP8/Resources/AppResources.resx | 6 + 15 files changed, 414 insertions(+), 5 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel .cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel .cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel .cs diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs index 9c9b665f..3a14e6e9 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -166,12 +166,14 @@ namespace CampusAppWP8 // Dieser Code wird beim Schließen der Anwendung nicht ausgeführt private void Application_Deactivated(object sender, DeactivatedEventArgs e) { + Settings.UserProfil.SaveData(); } // Code, der beim Schließen der Anwendung ausgeführt wird (z. B. wenn der Benutzer auf "Zurück" klickt) // Dieser Code wird beim Deaktivieren der Anwendung nicht ausgeführt private void Application_Closing(object sender, ClosingEventArgs e) { + Settings.UserProfil.SaveData(); // Sicherstellen, dass der erforderliche Anwendungszustand hier beibehalten wird } diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index a39c91ea..923abff0 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -100,6 +100,11 @@ + + + + + UserProfil.xaml diff --git a/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs index 49dd10d3..56013f06 100644 --- a/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs +++ b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs @@ -41,7 +41,7 @@ namespace CampusAppWP8.File.Setting /// true, if file is up-to-date, otherwise false private bool CheckIsFileUpToDateOnLoad(UserProfilModel model, FileInfo info) { - if (this.Model == null) + if (model == null) { return true; } @@ -57,7 +57,7 @@ namespace CampusAppWP8.File.Setting /// true, if file is up-to-date, otherwise false private bool CheckIsFileUpToDateOnSave(UserProfilModel model, FileInfo info) { - if (model != null && model.HasChanged()) + if (model != null && !model.HasChanged()) { return true; } diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs index 48253fb2..7b8d7481 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -326,7 +326,7 @@ namespace CampusAppWP8.Model.Lecture 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" }); + this.semesterList.Add(new ListPickerItemModel() { Text = "SoSe 14", Value = "20141" }); } /// diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs new file mode 100644 index 00000000..04631bff --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs @@ -0,0 +1,80 @@ +// +// Company copyright tag.List +// +// stubbfel +// 25.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + using System.Linq; + public class CourseListPickerItemListModel : ListPickerItemListModel + { + #region Constructor + + + /// + /// Initializes a new instance of the class. + /// + public CourseListPickerItemListModel() + : base() + { + } + + #endregion + + #region Method + + #region private + + protected override void LoadList() + { + this.addItem(new ListPickerItemModel("013", "Architektur")); + this.addItem(new ListPickerItemModel("017", "Bauingenieurwesen")); + this.addItem(new ListPickerItemModel("021", "Betriebswirtschaftslehre")); + this.addItem(new ListPickerItemModel("042", "Wirtschaftsrecht für Technologieunternehmen")); + this.addItem(new ListPickerItemModel("048", "Elektrotechnik")); + this.addItem(new ListPickerItemModel("079", "Informatik ")); + this.addItem(new ListPickerItemModel("104", "Maschinenbau")); + this.addItem(new ListPickerItemModel("105", "Mathematik")); + this.addItem(new ListPickerItemModel("128", "Physik ")); + this.addItem(new ListPickerItemModel("179", "Wirtschaftsingenieurwesen")); + this.addItem(new ListPickerItemModel("184", "Wirtschaftswissenschaften ")); + this.addItem(new ListPickerItemModel("215", "Biomedizinische Gerätetechnik ")); + this.addItem(new ListPickerItemModel("226", "Verfahrenstechnik")); + this.addItem(new ListPickerItemModel("276", "Wirtschaftsmathematik ")); + this.addItem(new ListPickerItemModel("711", "Kultur und Technik ")); + this.addItem(new ListPickerItemModel("744", "Physik der Halbleiter-Technologie")); + this.addItem(new ListPickerItemModel("749", "Angewandte Mathematik ")); + this.addItem(new ListPickerItemModel("764", "Technologie- und Innovationsmanagement")); + this.addItem(new ListPickerItemModel("766", "Stadt- und Regionalplanung")); + this.addItem(new ListPickerItemModel("767", "Informations- und Medientechnik ")); + this.addItem(new ListPickerItemModel("768", "World Heritage Studies")); + this.addItem(new ListPickerItemModel("770", "Umweltingenieurwesen und Verfahrenstechnik")); + this.addItem(new ListPickerItemModel("771", "Environmental and Resource Management")); + this.addItem(new ListPickerItemModel("772", "Landnutzung und Wasserbewirtschaftung")); + this.addItem(new ListPickerItemModel("773", "Bauen und Erhalten")); + this.addItem(new ListPickerItemModel("774", "Umweltingenieurwesen")); + this.addItem(new ListPickerItemModel("794", "eBusiness")); + this.addItem(new ListPickerItemModel("798", "Civil Engineering")); + this.addItem(new ListPickerItemModel("799", "Structural Engineering")); + this.addItem(new ListPickerItemModel("800", "Electrical Power Engineering ")); + this.addItem(new ListPickerItemModel("841", "Euro Hydroinformatics and Water Management")); + this.addItem(new ListPickerItemModel("842", "Technologien Biogener Rohstoffe")); + this.addItem(new ListPickerItemModel("843", "Environmental Technologies")); + this.addItem(new ListPickerItemModel("844", "Process Engineering and Plant Design")); + this.addItem(new ListPickerItemModel("845", "Architekturvermittlung")); + this.addItem(new ListPickerItemModel("851", "Nachwachsende Rohstoffe und Erneuerbare Energien")); + this.addItem(new ListPickerItemModel("852", "Energieträger aus Biomasse und Abfällen")); + this.addItem(new ListPickerItemModel("853", "Power Engineering")); + this.addItem(new ListPickerItemModel("857", "Verfahrenstechnik - Prozess- und Anlagentechnik")); + this.addItem(new ListPickerItemModel("858", "Architektur.Studium.Generale")); + this.addItem(new ListPickerItemModel("860", "Verarbeitungstechnologien der Werkstoffe")); + this.addItem(new ListPickerItemModel("871", "Forensic Sciences and Engineering")); + this.List = this.List.OrderBy(o => o.Text).ToList(); + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel .cs new file mode 100644 index 00000000..eb0df31b --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel .cs @@ -0,0 +1,41 @@ +// +// Company copyright tag.List +// +// stubbfel +// 25.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + using CampusAppWP8.Resources; + using System.Linq; + public class DegreeListPickerItemListModel : ListPickerItemListModel + { + #region Constructor + + + /// + /// Initializes a new instance of the class. + /// + public DegreeListPickerItemListModel() + : base() + { + } + + #endregion + + #region Method + + #region private + + protected override void LoadList() + { + this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.BACHELOR.ToString(), AppResources.Degree_Bachelor)); + this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.MASTER.ToString(), AppResources.Degree_Master)); + this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.DIPLOM.ToString(), AppResources.Degree_Diploma)); + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs new file mode 100644 index 00000000..8c62b512 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs @@ -0,0 +1,113 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag.List +// +// stubbfel +// 25.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + using System.Collections.Generic; + public class ListPickerItemListModel + { + #region Members + + List list; + + #endregion + + #region Constructor + + + /// + /// Initializes a new instance of the class. + /// + public ListPickerItemListModel() + { + this.list = new List(); + this.LoadList(); + } + + #endregion + + #region Property + + public List List + { + get + { + return this.list; + } + set + { + if (value != this.list) + { + this.list = value; + } + } + } + + #endregion + + #region Method + + #region public + + /// + /// Method return a the Index of an item which has a certain value + /// + /// a certain value + /// return index of value or default(0) + virtual public int GetIndexOrDefault(string value) + { + int index = 0; + int i = 0; + foreach (ListPickerItemModel item in this.list) + { + if (item.Value.Equals(value)) + { + index = i; + break; + } + + i++; + } + + return index; + } + + public void addItem(string value, string text) + { + this.addItem(new ListPickerItemModel(value, text)); + } + + public void addItem(ListPickerItemModel item) + { + this.list.Add(item); + } + + + public bool removeItem(string value, string text) + { + return this.removeItem(new ListPickerItemModel(value, text)); + } + + public bool removeItem(ListPickerItemModel item) + { + return this.list.Remove(item); + } + + #endregion + + #region private + + virtual protected void LoadList() + { + return; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs index f5e6cba8..c37e6f29 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs @@ -12,6 +12,24 @@ namespace CampusAppWP8.Model.Utility /// public class ListPickerItemModel { + + /// + /// Initializes a new instance of the class. + /// + public ListPickerItemModel() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// string for the value property of an item + /// string for the text property of an item + public ListPickerItemModel(string value, string text) + { + this.Value = value; + this.Text = text; + } /// /// Gets or sets the Value of an Item /// diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel .cs new file mode 100644 index 00000000..daa4b518 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel .cs @@ -0,0 +1,40 @@ +// +// Company copyright tag.List +// +// stubbfel +// 25.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + using CampusAppWP8.Resources; + using System.Linq; + public class RoleListPickerItemListModel : ListPickerItemListModel + { + #region Constructor + + + /// + /// Initializes a new instance of the class. + /// + public RoleListPickerItemListModel() + : base() + { + } + + #endregion + + #region Method + + #region private + + protected override void LoadList() + { + this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STUDENT.ToString(), AppResources.Setting_RoleStudent)); + this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STAFF.ToString(), AppResources.Setting_RoleStaff)); + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel .cs new file mode 100644 index 00000000..95d47d6f --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel .cs @@ -0,0 +1,41 @@ +// +// Company copyright tag.List +// +// stubbfel +// 25.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + using CampusAppWP8.Resources; + using System.Linq; + public class SemesterListPickerItemListModel : ListPickerItemListModel + { + #region Constructor + + + /// + /// Initializes a new instance of the class. + /// + public SemesterListPickerItemListModel() + : base() + { + } + + #endregion + + #region Method + + #region private + + protected override void LoadList() + { + this.addItem(new ListPickerItemModel("20131", "SoSe 13")); + this.addItem(new ListPickerItemModel("20132", "WiSe 13/14")); + this.addItem(new ListPickerItemModel("20141", "SoSe 14")); + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs index ffb56040..e606f082 100644 --- a/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs @@ -38,6 +38,7 @@ namespace CampusAppWP8.Model public XmlModel(ModelType modelType, string sourceName) : base(modelType, sourceName) { + this.ValidRootName = Constants.XMLRootElementName; } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml index 940eb46c..0db945a9 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml @@ -43,7 +43,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs index d908777a..b55ab3a9 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs @@ -9,6 +9,8 @@ using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using CampusAppWP8.Model.Setting; using CampusAppWP8.File.Setting; +using CampusAppWP8.Model.Utility; +using CampusAppWP8.Utility; namespace CampusAppWP8.Pages.Setting { @@ -24,9 +26,51 @@ namespace CampusAppWP8.Pages.Setting } + + #region protected + + /// + /// Override the OnNavigatedFrom method + /// + /// Arguments of navigation + protected override void OnNavigatedFrom(NavigationEventArgs e) + { + this.SaveProfile(); + } + + #endregion + private void SetupListPickers() { - Test.Text = userFile.Model.Course.ToString(); + CourseListPickerItemListModel courseList = new CourseListPickerItemListModel(); + DegreeListPickerItemListModel degreeList = new DegreeListPickerItemListModel(); + SemesterListPickerItemListModel semesterList = new SemesterListPickerItemListModel(); + RoleListPickerItemListModel roleList = new RoleListPickerItemListModel(); + + this.Course.ItemsSource = courseList.List; + this.Degree.ItemsSource = degreeList.List; + this.Semster.ItemsSource = semesterList.List; + this.Role.ItemsSource = roleList.List; + + this.Course.SelectedIndex = courseList.GetIndexOrDefault(userFile.Model.Course.ToString().PadLeft(3,'0')); + this.Degree.SelectedIndex = degreeList.GetIndexOrDefault(userFile.Model.Degree.ToString()); + this.Semster.SelectedIndex = semesterList.GetIndexOrDefault(userFile.Model.Semester.ToString()); + this.Role.SelectedIndex = roleList.GetIndexOrDefault(userFile.Model.Role.ToString()); + } + + private void SaveProfile() + { + try + { + userFile.Model.Course = int.Parse(((ListPickerItemModel)this.Course.SelectedItem).Value); + userFile.Model.Degree = (CampusAppWP8.Model.Setting.UserProfilModel.DegreeType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType), ((ListPickerItemModel)this.Degree.SelectedItem).Value); + userFile.Model.Semester = int.Parse(((ListPickerItemModel)this.Semster.SelectedItem).Value); + userFile.Model.Role = (CampusAppWP8.Model.Setting.UserProfilModel.RoleType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.RoleType), ((ListPickerItemModel)this.Role.SelectedItem).Value); + } + catch (Exception e) + { + Logger.LogException(e); + } } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index f9852643..9e14041b 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -573,6 +573,24 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Mitarbeiter ähnelt. + /// + public static string Setting_RoleStaff { + get { + return ResourceManager.GetString("Setting_RoleStaff", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Student ähnelt. + /// + public static string Setting_RoleStudent { + get { + return ResourceManager.GetString("Setting_RoleStudent", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index cb0c2c98..350cd768 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -338,4 +338,10 @@ Semster + + Mitarbeiter + + + Student + \ No newline at end of file From fa7a84661e7ca2c4634341beda29836e6c2a1423 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 5 Aug 2013 11:18:32 +0200 Subject: [PATCH 07/10] finish profilsite --- CampusAppWP8/CampusAppWP8/App.xaml.cs | 2 - CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 8 +- .../File/Setting/UserProfilFile.cs | 1 - .../Model/Lecture/LecturePageModel.cs | 6 +- .../Model/Setting/UserProfilModel.cs | 2 +- .../Utility/CourseListPickerItemListModel .cs | 80 ----------------- .../Utility/CourseListPickerItemListModel.cs | 86 +++++++++++++++++++ ...l .cs => DegreeListPickerItemListModel.cs} | 19 ++-- .../Model/Utility/ListPickerItemListModel.cs | 57 +++++++++--- .../Model/Utility/ListPickerItemModel.cs | 2 +- ...del .cs => RoleListPickerItemListModel.cs} | 17 ++-- ....cs => SemesterListPickerItemListModel.cs} | 17 ++-- .../Pages/Lecture/LecturePage.xaml.cs | 2 - .../Pages/Setting/UserProfil.xaml.cs | 78 ++++++++++------- 14 files changed, 221 insertions(+), 156 deletions(-) delete mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel.cs rename CampusAppWP8/CampusAppWP8/Model/Utility/{DegreeListPickerItemListModel .cs => DegreeListPickerItemListModel.cs} (64%) rename CampusAppWP8/CampusAppWP8/Model/Utility/{RoleListPickerItemListModel .cs => RoleListPickerItemListModel.cs} (63%) rename CampusAppWP8/CampusAppWP8/Model/Utility/{SemesterListPickerItemListModel .cs => SemesterListPickerItemListModel.cs} (61%) diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs index 3a14e6e9..9c9b665f 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -166,14 +166,12 @@ namespace CampusAppWP8 // Dieser Code wird beim Schließen der Anwendung nicht ausgeführt private void Application_Deactivated(object sender, DeactivatedEventArgs e) { - Settings.UserProfil.SaveData(); } // Code, der beim Schließen der Anwendung ausgeführt wird (z. B. wenn der Benutzer auf "Zurück" klickt) // Dieser Code wird beim Deaktivieren der Anwendung nicht ausgeführt private void Application_Closing(object sender, ClosingEventArgs e) { - Settings.UserProfil.SaveData(); // Sicherstellen, dass der erforderliche Anwendungszustand hier beibehalten wird } diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 923abff0..847a75fc 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -100,10 +100,10 @@ - - - - + + + + UserProfil.xaml diff --git a/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs index 56013f06..64dc798b 100644 --- a/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs +++ b/CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs @@ -22,7 +22,6 @@ namespace CampusAppWP8.File.Setting /// /// Initializes a new instance of the class. /// - /// automatic loading of the data public UserProfilFile() : base(ModelType.File, Constants.FileProfil_User) { diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs index 7b8d7481..815ace1f 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -27,17 +27,17 @@ namespace CampusAppWP8.Model.Lecture /// /// need to be extend to full list /// - private List courseList; + private CourseListPickerItemListModel courseList; /// /// List of the degrees /// - private List degreeList; + private DegreeListPickerItemListModel degreeList; /// /// List of the semester /// - private List semesterList; + private SemesterListPickerItemListModel semesterList; /// /// List for the number of semester (from) diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs index 38da0528..59eac750 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs @@ -51,7 +51,7 @@ namespace CampusAppWP8.Model.Setting /// /// Gets or Sets the course of the user /// - private int course = UserProfilModel.DefaultCourseNumber; + private int course = UserProfilModel.DefaultCourseNumber; /// /// Gets or Sets the role of the user diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs deleted file mode 100644 index 04631bff..00000000 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel .cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Company copyright tag.List -// -// stubbfel -// 25.07.2013 -//---------------------------------------------------------------------- -namespace CampusAppWP8.Model.Utility -{ - using System.Linq; - public class CourseListPickerItemListModel : ListPickerItemListModel - { - #region Constructor - - - /// - /// Initializes a new instance of the class. - /// - public CourseListPickerItemListModel() - : base() - { - } - - #endregion - - #region Method - - #region private - - protected override void LoadList() - { - this.addItem(new ListPickerItemModel("013", "Architektur")); - this.addItem(new ListPickerItemModel("017", "Bauingenieurwesen")); - this.addItem(new ListPickerItemModel("021", "Betriebswirtschaftslehre")); - this.addItem(new ListPickerItemModel("042", "Wirtschaftsrecht für Technologieunternehmen")); - this.addItem(new ListPickerItemModel("048", "Elektrotechnik")); - this.addItem(new ListPickerItemModel("079", "Informatik ")); - this.addItem(new ListPickerItemModel("104", "Maschinenbau")); - this.addItem(new ListPickerItemModel("105", "Mathematik")); - this.addItem(new ListPickerItemModel("128", "Physik ")); - this.addItem(new ListPickerItemModel("179", "Wirtschaftsingenieurwesen")); - this.addItem(new ListPickerItemModel("184", "Wirtschaftswissenschaften ")); - this.addItem(new ListPickerItemModel("215", "Biomedizinische Gerätetechnik ")); - this.addItem(new ListPickerItemModel("226", "Verfahrenstechnik")); - this.addItem(new ListPickerItemModel("276", "Wirtschaftsmathematik ")); - this.addItem(new ListPickerItemModel("711", "Kultur und Technik ")); - this.addItem(new ListPickerItemModel("744", "Physik der Halbleiter-Technologie")); - this.addItem(new ListPickerItemModel("749", "Angewandte Mathematik ")); - this.addItem(new ListPickerItemModel("764", "Technologie- und Innovationsmanagement")); - this.addItem(new ListPickerItemModel("766", "Stadt- und Regionalplanung")); - this.addItem(new ListPickerItemModel("767", "Informations- und Medientechnik ")); - this.addItem(new ListPickerItemModel("768", "World Heritage Studies")); - this.addItem(new ListPickerItemModel("770", "Umweltingenieurwesen und Verfahrenstechnik")); - this.addItem(new ListPickerItemModel("771", "Environmental and Resource Management")); - this.addItem(new ListPickerItemModel("772", "Landnutzung und Wasserbewirtschaftung")); - this.addItem(new ListPickerItemModel("773", "Bauen und Erhalten")); - this.addItem(new ListPickerItemModel("774", "Umweltingenieurwesen")); - this.addItem(new ListPickerItemModel("794", "eBusiness")); - this.addItem(new ListPickerItemModel("798", "Civil Engineering")); - this.addItem(new ListPickerItemModel("799", "Structural Engineering")); - this.addItem(new ListPickerItemModel("800", "Electrical Power Engineering ")); - this.addItem(new ListPickerItemModel("841", "Euro Hydroinformatics and Water Management")); - this.addItem(new ListPickerItemModel("842", "Technologien Biogener Rohstoffe")); - this.addItem(new ListPickerItemModel("843", "Environmental Technologies")); - this.addItem(new ListPickerItemModel("844", "Process Engineering and Plant Design")); - this.addItem(new ListPickerItemModel("845", "Architekturvermittlung")); - this.addItem(new ListPickerItemModel("851", "Nachwachsende Rohstoffe und Erneuerbare Energien")); - this.addItem(new ListPickerItemModel("852", "Energieträger aus Biomasse und Abfällen")); - this.addItem(new ListPickerItemModel("853", "Power Engineering")); - this.addItem(new ListPickerItemModel("857", "Verfahrenstechnik - Prozess- und Anlagentechnik")); - this.addItem(new ListPickerItemModel("858", "Architektur.Studium.Generale")); - this.addItem(new ListPickerItemModel("860", "Verarbeitungstechnologien der Werkstoffe")); - this.addItem(new ListPickerItemModel("871", "Forensic Sciences and Engineering")); - this.List = this.List.OrderBy(o => o.Text).ToList(); - } - - #endregion - - #endregion - } -} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel.cs new file mode 100644 index 00000000..4c85b0f8 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/CourseListPickerItemListModel.cs @@ -0,0 +1,86 @@ +// +// Company copyright tag.List +// +// stubbfel +// 25.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + using System.Linq; + + /// + /// This is a class for the courseList + /// + public class CourseListPickerItemListModel : ListPickerItemListModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public CourseListPickerItemListModel() + : base() + { + } + + #endregion + + #region Method + + #region private + + /// + /// Overrides the LoadList-Method + /// + protected override void LoadList() + { + this.AddItem(new ListPickerItemModel("013", "Architektur")); + this.AddItem(new ListPickerItemModel("017", "Bauingenieurwesen")); + this.AddItem(new ListPickerItemModel("021", "Betriebswirtschaftslehre")); + this.AddItem(new ListPickerItemModel("042", "Wirtschaftsrecht für Technologieunternehmen")); + this.AddItem(new ListPickerItemModel("048", "Elektrotechnik")); + this.AddItem(new ListPickerItemModel("079", "Informatik ")); + this.AddItem(new ListPickerItemModel("104", "Maschinenbau")); + this.AddItem(new ListPickerItemModel("105", "Mathematik")); + this.AddItem(new ListPickerItemModel("128", "Physik ")); + this.AddItem(new ListPickerItemModel("179", "Wirtschaftsingenieurwesen")); + this.AddItem(new ListPickerItemModel("184", "Wirtschaftswissenschaften ")); + this.AddItem(new ListPickerItemModel("215", "Biomedizinische Gerätetechnik ")); + this.AddItem(new ListPickerItemModel("226", "Verfahrenstechnik")); + this.AddItem(new ListPickerItemModel("276", "Wirtschaftsmathematik ")); + this.AddItem(new ListPickerItemModel("711", "Kultur und Technik ")); + this.AddItem(new ListPickerItemModel("744", "Physik der Halbleiter-Technologie")); + this.AddItem(new ListPickerItemModel("749", "Angewandte Mathematik ")); + this.AddItem(new ListPickerItemModel("764", "Technologie- und Innovationsmanagement")); + this.AddItem(new ListPickerItemModel("766", "Stadt- und Regionalplanung")); + this.AddItem(new ListPickerItemModel("767", "Informations- und Medientechnik ")); + this.AddItem(new ListPickerItemModel("768", "World Heritage Studies")); + this.AddItem(new ListPickerItemModel("770", "Umweltingenieurwesen und Verfahrenstechnik")); + this.AddItem(new ListPickerItemModel("771", "Environmental and Resource Management")); + this.AddItem(new ListPickerItemModel("772", "Landnutzung und Wasserbewirtschaftung")); + this.AddItem(new ListPickerItemModel("773", "Bauen und Erhalten")); + this.AddItem(new ListPickerItemModel("774", "Umweltingenieurwesen")); + this.AddItem(new ListPickerItemModel("794", "eBusiness")); + this.AddItem(new ListPickerItemModel("798", "Civil Engineering")); + this.AddItem(new ListPickerItemModel("799", "Structural Engineering")); + this.AddItem(new ListPickerItemModel("800", "Electrical Power Engineering ")); + this.AddItem(new ListPickerItemModel("841", "Euro Hydroinformatics and Water Management")); + this.AddItem(new ListPickerItemModel("842", "Technologien Biogener Rohstoffe")); + this.AddItem(new ListPickerItemModel("843", "Environmental Technologies")); + this.AddItem(new ListPickerItemModel("844", "Process Engineering and Plant Design")); + this.AddItem(new ListPickerItemModel("845", "Architekturvermittlung")); + this.AddItem(new ListPickerItemModel("851", "Nachwachsende Rohstoffe und Erneuerbare Energien")); + this.AddItem(new ListPickerItemModel("852", "Energieträger aus Biomasse und Abfällen")); + this.AddItem(new ListPickerItemModel("853", "Power Engineering")); + this.AddItem(new ListPickerItemModel("857", "Verfahrenstechnik - Prozess- und Anlagentechnik")); + this.AddItem(new ListPickerItemModel("858", "Architektur.Studium.Generale")); + this.AddItem(new ListPickerItemModel("860", "Verarbeitungstechnologien der Werkstoffe")); + this.AddItem(new ListPickerItemModel("871", "Forensic Sciences and Engineering")); + this.List = this.List.OrderBy(o => o.Text).ToList(); + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel.cs similarity index 64% rename from CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel .cs rename to CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel.cs index eb0df31b..9fc79af9 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel .cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel.cs @@ -1,4 +1,4 @@ -// +// // Company copyright tag.List // // stubbfel @@ -7,14 +7,16 @@ namespace CampusAppWP8.Model.Utility { using CampusAppWP8.Resources; - using System.Linq; + + /// + /// This Class creates a list of degrees + /// public class DegreeListPickerItemListModel : ListPickerItemListModel { #region Constructor - /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public DegreeListPickerItemListModel() : base() @@ -27,11 +29,14 @@ namespace CampusAppWP8.Model.Utility #region private + /// + /// Overrides the LoadList-Method + /// protected override void LoadList() { - this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.BACHELOR.ToString(), AppResources.Degree_Bachelor)); - this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.MASTER.ToString(), AppResources.Degree_Master)); - this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.DIPLOM.ToString(), AppResources.Degree_Diploma)); + this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.BACHELOR.ToString(), AppResources.Degree_Bachelor)); + this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.MASTER.ToString(), AppResources.Degree_Master)); + this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.DIPLOM.ToString(), AppResources.Degree_Diploma)); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs index 8c62b512..5cb196fb 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemListModel.cs @@ -8,17 +8,23 @@ namespace CampusAppWP8.Model.Utility { using System.Collections.Generic; + + /// + /// Class for a List of ListPickerItems + /// public class ListPickerItemListModel { #region Members - List list; + /// + /// reference of the itemList + /// + private List list; #endregion #region Constructor - /// /// Initializes a new instance of the class. /// @@ -32,12 +38,16 @@ namespace CampusAppWP8.Model.Utility #region Property + /// + /// Gets or sets the ItemList + /// public List List { get { return this.list; } + set { if (value != this.list) @@ -58,7 +68,7 @@ namespace CampusAppWP8.Model.Utility /// /// a certain value /// return index of value or default(0) - virtual public int GetIndexOrDefault(string value) + public virtual int GetIndexOrDefault(string value) { int index = 0; int i = 0; @@ -76,23 +86,42 @@ namespace CampusAppWP8.Model.Utility return index; } - public void addItem(string value, string text) + /// + /// add an new item to the list + /// + /// value of the item + /// text of the item + public void AddItem(string value, string text) { - this.addItem(new ListPickerItemModel(value, text)); + this.AddItem(new ListPickerItemModel(value, text)); } - public void addItem(ListPickerItemModel item) + /// + /// add an new item to the list + /// + /// new item of the list + public void AddItem(ListPickerItemModel item) { this.list.Add(item); } - - public bool removeItem(string value, string text) + /// + /// remove an item + /// + /// value of the item + /// text of the item + /// true if removing was successful, otherwise false + public bool RemoveItem(string value, string text) { - return this.removeItem(new ListPickerItemModel(value, text)); + return this.RemoveItem(new ListPickerItemModel(value, text)); } - public bool removeItem(ListPickerItemModel item) + /// + /// remove an item + /// + /// item which has to be remove + /// true if removing was successful, otherwise false + public bool RemoveItem(ListPickerItemModel item) { return this.list.Remove(item); } @@ -101,7 +130,13 @@ namespace CampusAppWP8.Model.Utility #region private - virtual protected void LoadList() + /// + /// Method load an default list + /// + /// + /// load an empty list + /// + protected virtual void LoadList() { return; } diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs index c37e6f29..5dceec55 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs @@ -12,7 +12,6 @@ namespace CampusAppWP8.Model.Utility /// public class ListPickerItemModel { - /// /// Initializes a new instance of the class. /// @@ -30,6 +29,7 @@ namespace CampusAppWP8.Model.Utility this.Value = value; this.Text = text; } + /// /// Gets or sets the Value of an Item /// diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel.cs similarity index 63% rename from CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel .cs rename to CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel.cs index daa4b518..72aac6b8 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel .cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/RoleListPickerItemListModel.cs @@ -1,4 +1,4 @@ -// +// // Company copyright tag.List // // stubbfel @@ -7,14 +7,16 @@ namespace CampusAppWP8.Model.Utility { using CampusAppWP8.Resources; - using System.Linq; + + /// + /// Class for the RoleList + /// public class RoleListPickerItemListModel : ListPickerItemListModel { #region Constructor - /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public RoleListPickerItemListModel() : base() @@ -27,10 +29,13 @@ namespace CampusAppWP8.Model.Utility #region private + /// + /// Overrides the LoadList-Method + /// protected override void LoadList() { - this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STUDENT.ToString(), AppResources.Setting_RoleStudent)); - this.addItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STAFF.ToString(), AppResources.Setting_RoleStaff)); + this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STUDENT.ToString(), AppResources.Setting_RoleStudent)); + this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STAFF.ToString(), AppResources.Setting_RoleStaff)); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel .cs b/CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel.cs similarity index 61% rename from CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel .cs rename to CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel.cs index 95d47d6f..bd6e2159 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel .cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/SemesterListPickerItemListModel.cs @@ -7,14 +7,16 @@ namespace CampusAppWP8.Model.Utility { using CampusAppWP8.Resources; - using System.Linq; + + /// + /// Class for the SemesterList + /// public class SemesterListPickerItemListModel : ListPickerItemListModel { #region Constructor - /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public SemesterListPickerItemListModel() : base() @@ -27,11 +29,14 @@ namespace CampusAppWP8.Model.Utility #region private + /// + /// Overrides the LoadList-Method + /// protected override void LoadList() { - this.addItem(new ListPickerItemModel("20131", "SoSe 13")); - this.addItem(new ListPickerItemModel("20132", "WiSe 13/14")); - this.addItem(new ListPickerItemModel("20141", "SoSe 14")); + this.AddItem(new ListPickerItemModel("20131", "SoSe 13")); + this.AddItem(new ListPickerItemModel("20132", "WiSe 13/14")); + this.AddItem(new ListPickerItemModel("20141", "SoSe 14")); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 37f46e87..6d9b5f85 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -10,13 +10,11 @@ namespace CampusAppWP8.Pages.Lecture using System; using System.Collections.Generic; using System.Windows; - using System.Windows.Media.Imaging; using System.Windows.Navigation; using CampusAppWP8.Feed.Lecture; using CampusAppWP8.Model.Lecture; using CampusAppWP8.Model.Utility; using CampusAppWP8.Resources; - using CampusAppWP8.Utility; using Microsoft.Phone.Controls; /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs index b55ab3a9..f0b70686 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs @@ -1,45 +1,55 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Navigation; -using Microsoft.Phone.Controls; -using Microsoft.Phone.Shell; -using CampusAppWP8.Model.Setting; -using CampusAppWP8.File.Setting; -using CampusAppWP8.Model.Utility; -using CampusAppWP8.Utility; - +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.07.2013 +//---------------------------------------------------------------------- namespace CampusAppWP8.Pages.Setting { + using System; + using System.Windows.Navigation; + using CampusAppWP8.File.Setting; + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Utility; + using Microsoft.Phone.Controls; + + /// + /// Class for the UserProfilePage + /// public partial class UserProfil : PhoneApplicationPage { - UserProfilFile userFile; + /// + /// Reference of the profileFile + /// + private UserProfilFile userFile; + + /// + /// Initializes a new instance of the class. + /// public UserProfil() { - InitializeComponent(); - userFile = Settings.UserProfil; + this.InitializeComponent(); + this.userFile = Settings.UserProfil; this.SetupListPickers(); - } - - #region protected - /// /// Override the OnNavigatedFrom method /// /// Arguments of navigation protected override void OnNavigatedFrom(NavigationEventArgs e) { - this.SaveProfile(); + if (NavigationMode.Back == e.NavigationMode) + { + this.SaveProfile(); + } } - #endregion - + /// + /// Method sets the ItemSource of the ListPickers + /// private void SetupListPickers() { CourseListPickerItemListModel courseList = new CourseListPickerItemListModel(); @@ -52,20 +62,24 @@ namespace CampusAppWP8.Pages.Setting this.Semster.ItemsSource = semesterList.List; this.Role.ItemsSource = roleList.List; - this.Course.SelectedIndex = courseList.GetIndexOrDefault(userFile.Model.Course.ToString().PadLeft(3,'0')); - this.Degree.SelectedIndex = degreeList.GetIndexOrDefault(userFile.Model.Degree.ToString()); - this.Semster.SelectedIndex = semesterList.GetIndexOrDefault(userFile.Model.Semester.ToString()); - this.Role.SelectedIndex = roleList.GetIndexOrDefault(userFile.Model.Role.ToString()); + this.Course.SelectedIndex = courseList.GetIndexOrDefault(this.userFile.Model.Course.ToString().PadLeft(3, '0')); + this.Degree.SelectedIndex = degreeList.GetIndexOrDefault(this.userFile.Model.Degree.ToString()); + this.Semster.SelectedIndex = semesterList.GetIndexOrDefault(this.userFile.Model.Semester.ToString()); + this.Role.SelectedIndex = roleList.GetIndexOrDefault(this.userFile.Model.Role.ToString()); } + /// + /// Method save the current profile + /// private void SaveProfile() { try { - userFile.Model.Course = int.Parse(((ListPickerItemModel)this.Course.SelectedItem).Value); - userFile.Model.Degree = (CampusAppWP8.Model.Setting.UserProfilModel.DegreeType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType), ((ListPickerItemModel)this.Degree.SelectedItem).Value); - userFile.Model.Semester = int.Parse(((ListPickerItemModel)this.Semster.SelectedItem).Value); - userFile.Model.Role = (CampusAppWP8.Model.Setting.UserProfilModel.RoleType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.RoleType), ((ListPickerItemModel)this.Role.SelectedItem).Value); + this.userFile.Model.Course = int.Parse(((ListPickerItemModel)this.Course.SelectedItem).Value); + this.userFile.Model.Degree = (CampusAppWP8.Model.Setting.UserProfilModel.DegreeType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType), ((ListPickerItemModel)this.Degree.SelectedItem).Value); + this.userFile.Model.Semester = int.Parse(((ListPickerItemModel)this.Semster.SelectedItem).Value); + this.userFile.Model.Role = (CampusAppWP8.Model.Setting.UserProfilModel.RoleType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.RoleType), ((ListPickerItemModel)this.Role.SelectedItem).Value); + this.userFile.SaveData(); } catch (Exception e) { From 9a84f847d150de1ca4a3a2c0d95daa4ead15200f Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 5 Aug 2013 11:56:45 +0200 Subject: [PATCH 08/10] add list to lecture --- .../Model/Lecture/LecturePageModel.cs | 158 ++++-------------- .../Utility/DegreeListPickerItemListModel.cs | 6 +- .../Pages/Lecture/LecturePage.xaml.cs | 14 +- .../Pages/Setting/UserProfil.xaml.cs | 2 +- 4 files changed, 43 insertions(+), 137 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs index 815ace1f..d1cdcbfc 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -24,30 +24,27 @@ namespace CampusAppWP8.Model.Lecture /// /// List for the courses of the BTU /// - /// - /// need to be extend to full list - /// - private CourseListPickerItemListModel courseList; + private ListPickerItemListModel courseList; /// /// List of the degrees /// - private DegreeListPickerItemListModel degreeList; + private ListPickerItemListModel degreeList; /// /// List of the semester /// - private SemesterListPickerItemListModel semesterList; + private ListPickerItemListModel semesterList; /// /// List for the number of semester (from) /// - private List fromNumberList; + private ListPickerItemListModel fromNumberList; /// /// List for the number of semester (to) /// - private List toNumberList; + private ListPickerItemListModel toNumberList; /// /// Variable for the courseIndex @@ -88,6 +85,11 @@ namespace CampusAppWP8.Model.Lecture /// public LecturePageModel() { + this.courseList = new CourseListPickerItemListModel(); + this.degreeList = new DegreeListPickerItemListModel(); + this.semesterList = new SemesterListPickerItemListModel(); + this.fromNumberList = new ListPickerItemListModel(); + this.toNumberList = new ListPickerItemListModel(); } #endregion @@ -105,7 +107,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectCourseIndex && this.courseList != null && value < this.courseList.Count) + if (value != this.selectCourseIndex && this.courseList != null && value < this.courseList.List.Count) { this.selectCourseIndex = value; } @@ -124,7 +126,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectDegreeIndex && this.degreeList != null && value < this.degreeList.Count) + if (value != this.selectDegreeIndex && this.degreeList != null && value < this.degreeList.List.Count) { this.selectDegreeIndex = value; } @@ -143,7 +145,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectSemesterIndex && this.semesterList != null && value < this.semesterList.Count) + if (value != this.selectSemesterIndex && this.semesterList != null && value < this.semesterList.List.Count) { this.selectSemesterIndex = value; } @@ -162,7 +164,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectFromIndex && this.fromNumberList != null && value < this.fromNumberList.Count) + if (value != this.selectFromIndex && this.fromNumberList != null && value < this.fromNumberList.List.Count) { this.selectFromIndex = value; } @@ -181,7 +183,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectToIndex && this.toNumberList != null && value < this.toNumberList.Count) + if (value != this.selectToIndex && this.toNumberList != null && value < this.toNumberList.List.Count) { this.selectToIndex = value; } @@ -191,7 +193,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List for the courses of the BTU /// - public List CourseList + public ListPickerItemListModel CourseList { get { @@ -202,7 +204,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List of the degrees /// - public List DegreeList + public ListPickerItemListModel DegreeList { get { @@ -213,7 +215,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List of the semester /// - public List SemesterList + public ListPickerItemListModel SemesterList { get { @@ -224,7 +226,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List for the number of semester /// - public List FromNumberList + public ListPickerItemListModel FromNumberList { get { @@ -235,7 +237,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets the NumberList /// - public List ToNumberList + public ListPickerItemListModel ToNumberList { get { @@ -253,11 +255,11 @@ namespace CampusAppWP8.Model.Lecture /// public void LoadLists() { - this.LoadCourseList(); - this.LoadDegreeList(); this.LoadFromNumberList(); this.LoadToNumberList(); - this.LoadSemesterList(); + this.selectCourseIndex = this.courseList.GetIndexOrDefault(Settings.UserProfil.Model.Course.ToString().PadLeft(3, '0')); + this.selectDegreeIndex = this.degreeList.GetIndexOrDefault(Settings.UserProfil.Model.Degree.ToString()); + this.selectSemesterIndex = this.semesterList.GetIndexOrDefault(Settings.UserProfil.Model.Semester.ToString()); } #endregion @@ -270,13 +272,13 @@ namespace CampusAppWP8.Model.Lecture public void LoadFromNumberList() { string selectValue = null; - if (this.fromNumberList != null) + if (this.fromNumberList != null && this.fromNumberList.List.Count > 0) { - selectValue = this.fromNumberList[this.SelectFromIndex].Value; + selectValue = this.fromNumberList.List[this.SelectFromIndex].Value; } - this.fromNumberList = this.CreateNumberList(1, 10); - this.SelectFromIndex = this.GetIndexOrDefault(this.fromNumberList, selectValue); + this.fromNumberList.List = this.CreateNumberList(1, 10); + this.SelectFromIndex = this.fromNumberList.GetIndexOrDefault(selectValue); } /// @@ -285,13 +287,13 @@ namespace CampusAppWP8.Model.Lecture public void LoadToNumberList() { string selectValue = null; - if (this.toNumberList != null) + if (this.toNumberList != null && this.toNumberList.List.Count > 0) { - selectValue = this.toNumberList[this.SelectToIndex].Value; + selectValue = this.toNumberList.List[this.SelectToIndex].Value; } - this.toNumberList = this.CreateNumberList(this.SelectFromIndex + 1, 10); - this.SelectToIndex = this.GetIndexOrDefault(this.toNumberList, selectValue); + this.toNumberList.List = this.CreateNumberList(this.SelectFromIndex + 1, 10); + this.SelectToIndex = this.toNumberList.GetIndexOrDefault(selectValue); } /// @@ -303,7 +305,7 @@ namespace CampusAppWP8.Model.Lecture private List CreateNumberList(int startvalue, int endvalue) { List list = new List(); - string degree = this.DegreeList[this.SelectDegreeIndex].Value; + string degree = this.DegreeList.List[this.SelectDegreeIndex].Value; for (int i = startvalue; i <= endvalue; i++) { @@ -318,102 +320,6 @@ namespace CampusAppWP8.Model.Lecture return list; } - /// - /// 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 = "20141" }); - } - - /// - /// 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" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsrecht für Technologieunternehmen", Value = "042" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Elektrotechnik", Value = "048" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Informatik ", Value = "079" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Maschinenbau", Value = "104" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Mathematik", Value = "105" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Physik ", Value = "128" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsingenieurwesen", Value = "179" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftswissenschaften ", Value = "184" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Biomedizinische Gerätetechnik ", Value = "215" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik", Value = "226" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsmathematik ", Value = "276" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Kultur und Technik ", Value = "711" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Physik der Halbleiter-Technologie", Value = "744" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Angewandte Mathematik ", Value = "749" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Technologie- und Innovationsmanagement", Value = "764" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Stadt- und Regionalplanung", Value = "766" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Informations- und Medientechnik ", Value = "767" }); - this.courseList.Add(new ListPickerItemModel() { Text = "World Heritage Studies", Value = "768" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen und Verfahrenstechnik", Value = "770" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Environmental and Resource Management", Value = "771" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Landnutzung und Wasserbewirtschaftung", Value = "772" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Bauen und Erhalten", Value = "773" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen", Value = "774" }); - this.courseList.Add(new ListPickerItemModel() { Text = "eBusiness", Value = "794" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Civil Engineering", Value = "798" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Structural Engineering", Value = "799" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Electrical Power Engineering ", Value = "800" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Euro Hydroinformatics and Water Management", Value = "841" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Technologien Biogener Rohstoffe", Value = "842" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Environmental Technologies", Value = "843" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Process Engineering and Plant Design", Value = "844" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Architekturvermittlung", Value = "845" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Nachwachsende Rohstoffe und Erneuerbare Energien", Value = "851" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Energieträger aus Biomasse und Abfällen", Value = "852" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Power Engineering", Value = "853" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik - Prozess- und Anlagentechnik", Value = "857" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Architektur.Studium.Generale", Value = "858" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Verarbeitungstechnologien der Werkstoffe", Value = "860" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Forensic Sciences and Engineering", Value = "871" }); - this.courseList = this.courseList.OrderBy(o => o.Text).ToList(); - } - - /// - /// Method return a the Index of an item which has a certain value - /// - /// list for items - /// a certain value - /// return index of value or default(0) - private int GetIndexOrDefault(List list, string value) - { - int index = 0; - int i = 0; - foreach (ListPickerItemModel item in list) - { - if (item.Value.Equals(value)) - { - index = i; - break; - } - - i++; - } - - return index; - } #endregion #endregion diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel.cs index 9fc79af9..19e997bb 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/DegreeListPickerItemListModel.cs @@ -34,9 +34,9 @@ namespace CampusAppWP8.Model.Utility /// protected override void LoadList() { - this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.BACHELOR.ToString(), AppResources.Degree_Bachelor)); - this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.MASTER.ToString(), AppResources.Degree_Master)); - this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.DIPLOM.ToString(), AppResources.Degree_Diploma)); + this.AddItem(new ListPickerItemModel(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.BACHELOR).ToString(), AppResources.Degree_Bachelor)); + this.AddItem(new ListPickerItemModel(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.MASTER).ToString(), AppResources.Degree_Master)); + this.AddItem(new ListPickerItemModel(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.DIPLOM).ToString(), AppResources.Degree_Diploma)); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 6d9b5f85..53f8cf73 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -101,11 +101,11 @@ namespace CampusAppWP8.Pages.Lecture /// private void SetupListPickers() { - this.Course.ItemsSource = this.pageModel.CourseList; - this.Degree.ItemsSource = this.pageModel.DegreeList; - this.From.ItemsSource = this.pageModel.FromNumberList; - this.To.ItemsSource = this.pageModel.ToNumberList; - this.Semester.ItemsSource = this.pageModel.SemesterList; + this.Course.ItemsSource = this.pageModel.CourseList.List; + this.Degree.ItemsSource = this.pageModel.DegreeList.List; + this.From.ItemsSource = this.pageModel.FromNumberList.List; + this.To.ItemsSource = this.pageModel.ToNumberList.List; + this.Semester.ItemsSource = this.pageModel.SemesterList.List; // load values from last request LecturePageModel lastPageModel = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_LecturePageModel); @@ -218,7 +218,7 @@ namespace CampusAppWP8.Pages.Lecture this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex; this.pageModel.LoadFromNumberList(); - this.From.ItemsSource = this.pageModel.FromNumberList; + this.From.ItemsSource = this.pageModel.FromNumberList.List; } /// @@ -236,7 +236,7 @@ namespace CampusAppWP8.Pages.Lecture this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex; this.pageModel.SelectFromIndex = this.From.SelectedIndex; this.pageModel.LoadToNumberList(); - this.To.ItemsSource = this.pageModel.ToNumberList; + this.To.ItemsSource = this.pageModel.ToNumberList.List; } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs index f0b70686..f5ab784a 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs @@ -63,7 +63,7 @@ namespace CampusAppWP8.Pages.Setting this.Role.ItemsSource = roleList.List; this.Course.SelectedIndex = courseList.GetIndexOrDefault(this.userFile.Model.Course.ToString().PadLeft(3, '0')); - this.Degree.SelectedIndex = degreeList.GetIndexOrDefault(this.userFile.Model.Degree.ToString()); + this.Degree.SelectedIndex = degreeList.GetIndexOrDefault(((int)this.userFile.Model.Degree).ToString()); this.Semster.SelectedIndex = semesterList.GetIndexOrDefault(this.userFile.Model.Semester.ToString()); this.Role.SelectedIndex = roleList.GetIndexOrDefault(this.userFile.Model.Role.ToString()); } From 121c728df7f47c899266c40ffb169b7ee54c68ee Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 5 Aug 2013 11:58:19 +0200 Subject: [PATCH 09/10] fixes --- CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs index d1cdcbfc..1ed9c2c6 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -258,7 +258,7 @@ namespace CampusAppWP8.Model.Lecture this.LoadFromNumberList(); this.LoadToNumberList(); this.selectCourseIndex = this.courseList.GetIndexOrDefault(Settings.UserProfil.Model.Course.ToString().PadLeft(3, '0')); - this.selectDegreeIndex = this.degreeList.GetIndexOrDefault(Settings.UserProfil.Model.Degree.ToString()); + this.selectDegreeIndex = this.degreeList.GetIndexOrDefault(((int)Settings.UserProfil.Model.Degree).ToString()); this.selectSemesterIndex = this.semesterList.GetIndexOrDefault(Settings.UserProfil.Model.Semester.ToString()); } From 55e426f6c2658ed6927f99dcca4bf0f120ea0ee1 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 5 Aug 2013 13:02:39 +0200 Subject: [PATCH 10/10] release fixes --- CampusAppWP8/CampusAppWP8/App.xaml.cs | 38 ++++- .../Model/Lecture/LecturePageModel.cs | 161 ++++-------------- .../CampusAppWP8/Resources/Constants.resx | 1 + 3 files changed, 66 insertions(+), 134 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs index 55788b88..9d7a8955 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -1,12 +1,15 @@ -using CampusAppWP8.Resources; -using Microsoft.Phone.Controls; -using Microsoft.Phone.Shell; -using System; +using System; using System.Diagnostics; -using System.IO.IsolatedStorage; +using System.Resources; using System.Windows; using System.Windows.Markup; using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using CampusAppWP8.Resources; +using System.IO.IsolatedStorage; +using CampusAppWP8.File.Setting; +using CampusAppWP8.Model.Setting; namespace CampusAppWP8 @@ -128,13 +131,36 @@ namespace CampusAppWP8 // Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt private void Application_Launching(object sender, LaunchingEventArgs e) { + this.LoadSettings(); + } + + private void LoadSettings() + { + UserProfilFile userFile; + userFile = Settings.UserProfil; + if (userFile.Model == null) + { + userFile.onLoaded += new UserProfilFile.OnLoaded(this.UserSettingsLoaded); + userFile.LoadData(); + } + else + { + this.UserSettingsLoaded(); + } + } + private void UserSettingsLoaded() + { + if (Settings.UserProfil.Model == null) + { + Settings.UserProfil.Model = new UserProfilModel(); + } } // Code, der ausgeführt werden soll, wenn die Anwendung aktiviert wird (in den Vordergrund gebracht wird) // Dieser Code wird beim ersten Starten der Anwendung nicht ausgeführt private void Application_Activated(object sender, ActivatedEventArgs e) { - + this.LoadSettings(); } // Code, der ausgeführt werden soll, wenn die Anwendung deaktiviert wird (in den Hintergrund gebracht wird) diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs index cca12fe5..748d039e 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -7,11 +7,9 @@ //---------------------------------------------------------------------- namespace CampusAppWP8.Model.Lecture { - using System.Collections.Generic; - using System.Linq; using System.Runtime.Serialization; + using CampusAppWP8.Model.Setting; using CampusAppWP8.Model.Utility; - using CampusAppWP8.Resources; /// /// Model for the LecturePage @@ -57,27 +55,27 @@ namespace CampusAppWP8.Model.Lecture /// /// need to be extend to full list /// - private List courseList; + private ListPickerItemListModel courseList; /// /// List of the degrees /// - private List degreeList; + private ListPickerItemListModel degreeList; /// /// List of the semester /// - private List semesterList; + private ListPickerItemListModel semesterList; /// /// List for the number of semester (from) /// - private List fromNumberList; + private ListPickerItemListModel fromNumberList; /// /// List for the number of semester (to) /// - private List toNumberList; + private ListPickerItemListModel toNumberList; #endregion @@ -88,6 +86,9 @@ namespace CampusAppWP8.Model.Lecture /// public LecturePageModel() { + this.courseList = new CourseListPickerItemListModel(); + this.degreeList = new DegreeListPickerItemListModel(); + this.semesterList = new SemesterListPickerItemListModel(); } #endregion @@ -105,7 +106,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectCourseIndex && this.courseList != null && value < this.courseList.Count) + if (value != this.selectCourseIndex && this.courseList != null && value < this.courseList.List.Count) { this.selectCourseIndex = value; } @@ -124,7 +125,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectDegreeIndex && this.degreeList != null && value < this.degreeList.Count) + if (value != this.selectDegreeIndex && this.degreeList != null && value < this.degreeList.List.Count) { this.selectDegreeIndex = value; } @@ -143,7 +144,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectSemesterIndex && this.semesterList != null && value < this.semesterList.Count) + if (value != this.selectSemesterIndex && this.semesterList != null && value < this.semesterList.List.Count) { this.selectSemesterIndex = value; } @@ -162,7 +163,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectFromIndex && this.fromNumberList != null && value < this.fromNumberList.Count) + if (value != this.selectFromIndex && this.fromNumberList != null && value < this.fromNumberList.List.Count) { this.selectFromIndex = value; } @@ -181,7 +182,7 @@ namespace CampusAppWP8.Model.Lecture set { - if (value != this.selectToIndex && this.toNumberList != null && value < this.toNumberList.Count) + if (value != this.selectToIndex && this.toNumberList != null && value < this.toNumberList.List.Count) { this.selectToIndex = value; } @@ -191,7 +192,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List for the courses of the BTU /// - public List CourseList + public ListPickerItemListModel CourseList { get { @@ -202,7 +203,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List of the degrees /// - public List DegreeList + public ListPickerItemListModel DegreeList { get { @@ -213,7 +214,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List of the semester /// - public List SemesterList + public ListPickerItemListModel SemesterList { get { @@ -224,7 +225,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets List for the number of semester /// - public List FromNumberList + public ListPickerItemListModel FromNumberList { get { @@ -235,7 +236,7 @@ namespace CampusAppWP8.Model.Lecture /// /// Gets the NumberList /// - public List ToNumberList + public ListPickerItemListModel ToNumberList { get { @@ -253,11 +254,12 @@ namespace CampusAppWP8.Model.Lecture /// public void LoadLists() { - this.LoadCourseList(); - this.LoadDegreeList(); this.LoadFromNumberList(); this.LoadToNumberList(); - this.LoadSemesterList(); + UserProfilModel userModel = Settings.UserProfil.Model; + this.selectCourseIndex = this.courseList.GetIndexOrDefault(((int)userModel.Course).ToString().PadLeft(3, '0')); + this.selectDegreeIndex = this.degreeList.GetIndexOrDefault(((int)userModel.Degree).ToString()); + this.selectSemesterIndex = this.semesterList.GetIndexOrDefault(((int)userModel.Semester).ToString()); } #endregion @@ -270,13 +272,13 @@ namespace CampusAppWP8.Model.Lecture public void LoadFromNumberList() { string selectValue = null; - if (this.fromNumberList != null) + if (this.fromNumberList != null && this.fromNumberList.List.Count > 0) { - selectValue = this.fromNumberList[this.SelectFromIndex].Value; + selectValue = this.fromNumberList.List[this.SelectFromIndex].Value; } this.fromNumberList = this.CreateNumberList(1, 10); - this.SelectFromIndex = this.GetIndexOrDefault(this.fromNumberList, selectValue); + this.SelectFromIndex = this.fromNumberList.GetIndexOrDefault(selectValue); } /// @@ -285,13 +287,13 @@ namespace CampusAppWP8.Model.Lecture public void LoadToNumberList() { string selectValue = null; - if (this.toNumberList != null) + if (this.toNumberList != null && this.toNumberList.List.Count > 0) { - selectValue = this.toNumberList[this.SelectToIndex].Value; + selectValue = this.toNumberList.List[this.SelectToIndex].Value; } this.toNumberList = this.CreateNumberList(this.SelectFromIndex + 1, 10); - this.SelectToIndex = this.GetIndexOrDefault(this.toNumberList, selectValue); + this.SelectToIndex = this.toNumberList.GetIndexOrDefault(selectValue); } /// @@ -300,10 +302,10 @@ namespace CampusAppWP8.Model.Lecture /// startValue of the list /// endValue of the list /// return list - private List CreateNumberList(int startvalue, int endvalue) + private ListPickerItemListModel CreateNumberList(int startvalue, int endvalue) { - List list = new List(); - string degree = this.DegreeList[this.SelectDegreeIndex].Value; + ListPickerItemListModel list = new ListPickerItemListModel(); + string degree = this.DegreeList.List[this.SelectDegreeIndex].Value; for (int i = startvalue; i <= endvalue; i++) { @@ -312,108 +314,11 @@ namespace CampusAppWP8.Model.Lecture break; } - list.Add(new ListPickerItemModel() { Text = i.ToString(), Value = i.ToString() }); + list.AddItem(i.ToString(), i.ToString()); } return list; } - - /// - /// 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" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsrecht für Technologieunternehmen", Value = "042" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Elektrotechnik", Value = "048" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Informatik ", Value = "079" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Maschinenbau", Value = "104" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Mathematik", Value = "105" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Physik ", Value = "128" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsingenieurwesen", Value = "179" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftswissenschaften ", Value = "184" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Biomedizinische Gerätetechnik ", Value = "215" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik", Value = "226" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsmathematik ", Value = "276" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Kultur und Technik ", Value = "711" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Physik der Halbleiter-Technologie", Value = "744" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Angewandte Mathematik ", Value = "749" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Technologie- und Innovationsmanagement", Value = "764" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Stadt- und Regionalplanung", Value = "766" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Informations- und Medientechnik ", Value = "767" }); - this.courseList.Add(new ListPickerItemModel() { Text = "World Heritage Studies", Value = "768" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen und Verfahrenstechnik", Value = "770" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Environmental and Resource Management", Value = "771" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Landnutzung und Wasserbewirtschaftung", Value = "772" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Bauen und Erhalten", Value = "773" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen", Value = "774" }); - this.courseList.Add(new ListPickerItemModel() { Text = "eBusiness", Value = "794" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Civil Engineering", Value = "798" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Structural Engineering", Value = "799" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Electrical Power Engineering ", Value = "800" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Euro Hydroinformatics and Water Management", Value = "841" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Technologien Biogener Rohstoffe", Value = "842" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Environmental Technologies", Value = "843" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Process Engineering and Plant Design", Value = "844" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Architekturvermittlung", Value = "845" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Nachwachsende Rohstoffe und Erneuerbare Energien", Value = "851" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Energieträger aus Biomasse und Abfällen", Value = "852" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Power Engineering", Value = "853" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik - Prozess- und Anlagentechnik", Value = "857" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Architektur.Studium.Generale", Value = "858" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Verarbeitungstechnologien der Werkstoffe", Value = "860" }); - this.courseList.Add(new ListPickerItemModel() { Text = "Forensic Sciences and Engineering", Value = "871" }); - this.courseList = this.courseList.OrderBy(o => o.Text).ToList(); - } - - /// - /// Method return a the Index of an item which has a certain value - /// - /// list for items - /// a certain value - /// return index of value or default(0) - private int GetIndexOrDefault(List list, string value) - { - int index = 0; - int i = 0; - foreach (ListPickerItemModel item in list) - { - if (item.Value.Equals(value)) - { - index = i; - break; - } - - i++; - } - - return index; - } #endregion #endregion diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 699b6984..ba9aa34f 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -284,6 +284,7 @@ IsolatedStorage_OpeninghoursModel + user.xml