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