Merge branch 'hotfix/#32' into develop

This commit is contained in:
stubbfel
2013-06-18 15:07:18 +02:00
10 changed files with 424 additions and 98 deletions

View File

@@ -91,6 +91,39 @@ namespace CampusAppWP8
}
return default(T);
}
/// <summary>
/// Method save any object to the IsolatedStorage
/// </summary>
/// <param name="key"> key of the object</param>
/// <param name="value">value of the object, if value == null => remove key</param>
public static void SaveToAppState<T>(string key, T value)
{
IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings;
isolatedStore.Remove(key);
if (value != null)
{
isolatedStore.Add(key, value);
}
isolatedStore.Save();
}
/// <summary>
/// Method load any object to the IsolatedStorage
/// </summary>
/// <param name="key"> key of the object</param>
public static T LoadFromAppState<T>(string key)
{
IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings;
if (isolatedStore.Contains(key))
{
object value = isolatedStore[key];
return (T)value;
}
return default(T);
}
// Code, der beim Starten der Anwendung ausgeführt werden soll (z. B. über "Start")
// Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt
private void Application_Launching(object sender, LaunchingEventArgs e)

View File

@@ -109,6 +109,7 @@
<Compile Include="Model\Lecture\LectureLecturer.cs" />
<Compile Include="Model\Lecture\LectureList.cs" />
<Compile Include="Model\Lecture\LectureModule.cs" />
<Compile Include="Model\Lecture\LecturePageModel.cs" />
<Compile Include="Model\Mensa\MenuModel.cs" />
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
<Compile Include="Model\Utility\UrlParamModel.cs" />

View File

@@ -82,6 +82,12 @@ namespace CampusAppWP8.Model.Lecture
[XmlElement("modul")]
public LectureModule Modul { get; set; }
/// <summary>
/// Gets or sets LectureTitel
/// </summary>
[XmlElement("titel")]
public string Title { get; set; }
/// <summary>
/// Gets or sets the lecturers
/// </summary>

View File

@@ -0,0 +1,242 @@
//-----------------------------------------------------------------------
// <copyright file="LecturePageModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>18.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using System.Collections.Generic;
using System.Runtime.Serialization;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
/// <summary>
/// Model for the LecturePage
/// </summary>
[DataContract]
public class LecturePageModel
{
#region Members
/// <summary>
/// List for the courses of the BTU
/// </summary>
/// <remarks>
/// need to be extend to full list
/// </remarks>
private List<ListPickerItemModel> courseList;
/// <summary>
/// List of the degrees
/// </summary>
private List<ListPickerItemModel> degreeList;
/// <summary>
/// List of the semester
/// </summary>
private List<ListPickerItemModel> semesterList;
/// <summary>
/// List for the number of semester
/// </summary>
private List<ListPickerItemModel> numberList;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="LecturePageModel" /> class.
/// </summary>
public LecturePageModel()
{
}
#endregion
#region Proberty
/// <summary>
/// Gets or sets the selected course index
/// </summary>
[DataMember]
public int SelectCourseIndex { get; set; }
/// <summary>
/// Gets or sets the selected degree index
/// </summary>
[DataMember]
public int SelectDegreeIndex { get; set; }
/// <summary>
/// Gets or sets the selected semester-index
/// </summary>
[DataMember]
public int SelectSemesterIndex { get; set; }
/// <summary>
/// Gets or sets the selected from-index
/// </summary>
[DataMember]
public int SelectFromIndex { get; set; }
/// <summary>
/// Gets or sets the selected to-index
/// </summary>
[DataMember]
public int SelectToIndex { get; set; }
/// <summary>
/// Gets List for the courses of the BTU
/// </summary>
public List<ListPickerItemModel> CourseList
{
get
{
return this.courseList;
}
}
/// <summary>
/// Gets List of the degrees
/// </summary>
public List<ListPickerItemModel> DegreeList
{
get
{
return this.degreeList;
}
}
/// <summary>
/// Gets List of the semester
/// </summary>
public List<ListPickerItemModel> SemesterList
{
get
{
return this.semesterList;
}
}
/// <summary>
/// Gets List for the number of semester
/// </summary>
public List<ListPickerItemModel> NumberList
{
get
{
return this.numberList;
}
}
#endregion
#region Methods
#region public
/// <summary>
/// Load all ListPickerLists
/// </summary>
public void LoadLists()
{
this.LoadCourseList();
this.LoadDegreeList();
this.LoadNumberList();
this.LoadSemesterList();
}
#endregion
#region private
/// <summary>
/// Load the NumberList
/// </summary>
private void LoadNumberList()
{
this.numberList = new List<ListPickerItemModel>();
this.numberList.Add(new ListPickerItemModel() { Text = "1", Value = "1" });
this.numberList.Add(new ListPickerItemModel() { Text = "2", Value = "2" });
this.numberList.Add(new ListPickerItemModel() { Text = "3", Value = "3" });
this.numberList.Add(new ListPickerItemModel() { Text = "4", Value = "4" });
}
/// <summary>
/// Load the SemesterList
/// </summary>
private void LoadSemesterList()
{
this.semesterList = new List<ListPickerItemModel>();
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" });
}
/// <summary>
/// Load the DegreeList
/// </summary>
private void LoadDegreeList()
{
this.degreeList = new List<ListPickerItemModel>();
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" });
}
/// <summary>
/// Load the DegreeList
/// </summary>
private void LoadCourseList()
{
this.courseList = new List<ListPickerItemModel>();
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" });
}
#endregion
#endregion
}
}

View File

@@ -10,6 +10,7 @@ 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;
@@ -17,14 +18,14 @@ namespace CampusAppWP8.Pages.Lecture
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
/// <summary>
/// Class for the LecturePage
/// </summary>
public partial class LecturePage : PhoneApplicationPage
{
#region Member
/// <summary>
/// actual LectureAPI
/// </summary>
@@ -36,106 +37,120 @@ namespace CampusAppWP8.Pages.Lecture
/// <remarks>
/// need to be extend to full list
/// </remarks>
private List<ListPickerItemModel> courseList = new List<ListPickerItemModel>()
{
new ListPickerItemModel()
{
Text = "Architektur", Value = "013"
},
new ListPickerItemModel()
{
Text = "Bauingenieurwesen", Value = "017"
},
new ListPickerItemModel()
{
Text = "Betriebswirtschaftslehre", Value = "021"
}
};
private LecturePageModel pageModel;
/// <summary>
/// List of the degrees
/// </summary>
private List<ListPickerItemModel> degreeList = new List<ListPickerItemModel>()
{
new ListPickerItemModel()
{
Text = AppResources.Degree_Bachelor, Value = "82"
},
new ListPickerItemModel()
{
Text = AppResources.Degree_Master, Value = "88"
},
new ListPickerItemModel()
{
Text = AppResources.Degree_Diploma, Value = "11"
}
};
/// <summary>
/// List of the semester
/// </summary>
private List<ListPickerItemModel> semesterList = new List<ListPickerItemModel>()
{
new ListPickerItemModel()
{
Text = "SoSe 13", Value = "20131"
},
new ListPickerItemModel()
{
Text = "WiSe 13/14", Value = "20132"
},
new ListPickerItemModel()
{
Text = "SoSe 14", Value = "20141"
}
};
/// <summary>
/// List for the number of semester
/// </summary>
private List<ListPickerItemModel> numberList = new List<ListPickerItemModel>()
{
new ListPickerItemModel()
{
Text = "1", Value = "1"
},
new ListPickerItemModel()
{
Text = "2", Value = "2"
},
new ListPickerItemModel()
{
Text = "3", Value = "3"
},
new ListPickerItemModel()
{
Text = "4", Value = "4"
}
};
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="LecturePage" /> class.
/// </summary>
public LecturePage()
{
this.InitializeComponent();
this.LoadPageModel();
this.SetupListPickers();
if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible)
{
this.SearchButtonImg.Source = new BitmapImage(new Uri("/Assets/icons/search_159_dark.png",UriKind.Relative));
this.SearchButtonImg.Source = new BitmapImage(new Uri("/Assets/icons/search_159_dark.png", UriKind.Relative));
}
}
#endregion
#region methods
#region protected
/// <summary>
/// Methods overrides the OnNavigatedFrom-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (NavigationMode.Back == e.NavigationMode)
{
// delete all models
App.SaveToIsolatedStorage<LecturePageModel>(Constants.IsolatedStorage_LecturePageModel, null);
App.SaveToIsolatedStorage<LectureList>(Constants.IsolatedStorage_LectureModel, null);
}
else
{
this.StoreSelectedIndex();
App.SaveToIsolatedStorage<LecturePageModel>(Constants.IsolatedStorage_LecturePageModel, this.pageModel);
}
base.OnNavigatedFrom(e);
}
#endregion
#region private
/// <summary>
/// Load the PageModel
/// </summary>
private void LoadPageModel()
{
this.pageModel = new LecturePageModel();
this.pageModel.LoadLists();
}
/// <summary>
/// Method sets the ItemSource of the ListPickers
/// </summary>
private void SetupListPickers()
{
this.Course.ItemsSource = this.courseList;
this.Degree.ItemsSource = this.degreeList;
this.From.ItemsSource = this.numberList;
this.To.ItemsSource = this.numberList;
this.Semester.ItemsSource = this.semesterList;
this.Course.ItemsSource = this.pageModel.CourseList;
this.Degree.ItemsSource = this.pageModel.DegreeList;
this.From.ItemsSource = this.pageModel.NumberList;
this.To.ItemsSource = this.pageModel.NumberList;
this.Semester.ItemsSource = this.pageModel.SemesterList;
// load values from last request
LecturePageModel lastPageModel = App.LoadFromIsolatedStorage<LecturePageModel>(Constants.IsolatedStorage_LecturePageModel);
if (lastPageModel != null)
{
this.SetLastSelectedIndex(lastPageModel);
}
this.SetSelectedIndex();
}
/// <summary>
/// Method set the last selected index of the ListPickers
/// </summary>
/// <param name="lastPageModel">Last PageModel</param>
private void SetLastSelectedIndex(LecturePageModel lastPageModel)
{
this.pageModel.SelectCourseIndex = lastPageModel.SelectCourseIndex;
this.pageModel.SelectDegreeIndex = lastPageModel.SelectDegreeIndex;
this.pageModel.SelectFromIndex = lastPageModel.SelectFromIndex;
this.pageModel.SelectToIndex = lastPageModel.SelectToIndex;
this.pageModel.SelectSemesterIndex = lastPageModel.SelectSemesterIndex;
}
/// <summary>
/// Method set the last selected index of the ListPickers
/// </summary>
private void SetSelectedIndex()
{
this.Course.SelectedIndex = this.pageModel.SelectCourseIndex;
this.Degree.SelectedIndex = this.pageModel.SelectDegreeIndex;
this.Semester.SelectedIndex = this.pageModel.SelectSemesterIndex;
this.From.SelectedIndex = this.pageModel.SelectFromIndex;
this.To.SelectedIndex = this.pageModel.SelectToIndex;
}
/// <summary>
/// Method store the actual selectIndex to the models
/// </summary>
private void StoreSelectedIndex()
{
this.pageModel.SelectCourseIndex = this.Course.SelectedIndex;
this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex;
this.pageModel.SelectSemesterIndex = this.Semester.SelectedIndex;
this.pageModel.SelectFromIndex = this.From.SelectedIndex;
this.pageModel.SelectToIndex = this.To.SelectedIndex;
}
/// <summary>
@@ -186,5 +201,9 @@ namespace CampusAppWP8.Pages.Lecture
Uri url = new Uri(Constants.PathLecture_ResultPage, UriKind.Relative);
NavigationService.Navigate(url);
}
#endregion
#endregion
}
}

View File

@@ -38,7 +38,7 @@
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<StackPanel>
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_LectureName, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="0,0,0,0"/>
<TextBlock Text="{Binding Modul.Title}" TextWrapping="Wrap"/>
<TextBlock Text="{Binding Title}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">

View File

@@ -33,7 +33,7 @@
<TextBlock Text="{Binding Type}" Grid.Column="0" Grid.Row="0"/>
<TextBlock Text=" : " Grid.Column="1" Grid.Row="0"/>
<TextBlock Text="{Binding Modul.Title}" TextWrapping="Wrap" Grid.Column="2" Grid.Row="0"/>
<TextBlock Text="{Binding Title}" TextWrapping="Wrap" Grid.Column="2" Grid.Row="0"/>
</Grid>
</Button>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

View File

@@ -20,11 +20,6 @@ namespace CampusAppWP8.Pages.Lecture
/// </summary>
public partial class ResultPage : PhoneApplicationPage
{
/// <summary>
/// Reference of the button which was lastClicked
/// </summary>
private Button lastClickedButton;
/// <summary>
/// Initializes a new instance of the <see cref="ResultPage" /> class.
/// </summary>
@@ -39,8 +34,15 @@ namespace CampusAppWP8.Pages.Lecture
/// <param name="e">Arguments of navigation</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
LectureList list = App.LoadFromIsolatedStorage<LectureList>(Constants.IsolatedStorage_LectureModel);
this.ResultList.ItemsSource = list.Activities;
LectureList list = App.LoadFromIsolatedStorage<LectureList>(Constants.IsolatedStorage_LectureModel);
if (list == null)
{
Uri url = new Uri(Constants.PathLecture_LecturePage, UriKind.Relative);
NavigationService.Navigate(url);
return;
}
this.ResultList.ItemsSource = list.Activities;
base.OnNavigatedTo(e);
}
@@ -53,15 +55,14 @@ namespace CampusAppWP8.Pages.Lecture
{
Button button = (Button)sender;
StackPanel parent = (StackPanel)button.Parent;
if (this.lastClickedButton != null && !this.lastClickedButton.Equals(button))
{
this.HideOptions(parent);
}
this.lastClickedButton = button;
Button link = (Button)parent.FindName("Link");
Button details = (Button)parent.FindName("Details");
if (link.Tag == null)
{
link.IsEnabled = false;
}
this.ToogleVisibility(link);
this.ToogleVisibility(details);
}

View File

@@ -69,6 +69,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_LecturePageModel ähnelt.
/// </summary>
internal static string IsolatedStorage_LecturePageModel {
get {
return ResourceManager.GetString("IsolatedStorage_LecturePageModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die lsf_auszug ähnelt.
/// </summary>
@@ -150,6 +159,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/LecturePage.xaml ähnelt.
/// </summary>
internal static string PathLecture_LecturePage {
get {
return ResourceManager.GetString("PathLecture_LecturePage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ModulWebPage.xaml ähnelt.
/// </summary>

View File

@@ -168,4 +168,10 @@
<data name="UrlLecture_ApiBaseAddr" xml:space="preserve">
<value>http://www.zv.tu-cottbus.de/LSFveranst/LSF4</value>
</data>
<data name="IsolatedStorage_LecturePageModel" xml:space="preserve">
<value>IsolatedStorage_LecturePageModel</value>
</data>
<data name="PathLecture_LecturePage" xml:space="preserve">
<value>/Pages/Lecture/LecturePage.xaml</value>
</data>
</root>