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; + } + } + } +}