Merge branch 'feature/#136' into develop
This commit is contained in:
@@ -108,6 +108,7 @@
|
||||
<Compile Include="Feed\Mensa\MensaFeedCBSouth.cs" />
|
||||
<Compile Include="Feed\Mensa\MensaFeedCBNorth.cs" />
|
||||
<Compile Include="Feed\Mensa\MensaFeedCBMain.cs" />
|
||||
<Compile Include="Feed\Utility\CourseFeed.cs" />
|
||||
<Compile Include="File\Exams\ExamFile.cs" />
|
||||
<Compile Include="File\Places\PlacesFile.cs" />
|
||||
<Compile Include="Model\BinaryModel.cs" />
|
||||
@@ -128,6 +129,7 @@
|
||||
<Compile Include="Model\Setting\AppSettings.cs" />
|
||||
<Compile Include="Model\Setting\UserProfilModel.cs" />
|
||||
<Compile Include="Model\Utility\CourseListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\CourseModel.cs" />
|
||||
<Compile Include="Model\Utility\DegreeListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\CleanUrlParamModel.cs" />
|
||||
<Compile Include="Model\Utility\CampusListPickerItemListModel.cs" />
|
||||
@@ -535,9 +537,7 @@
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Feed\Utility\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
59
CampusAppWP8/CampusAppWP8/Feed/Utility/CourseFeed.cs
Normal file
59
CampusAppWP8/CampusAppWP8/Feed/Utility/CourseFeed.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="CourseFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.09.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.Utility
|
||||
{
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Exams;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>Course Feed.</summary>
|
||||
/// <remarks>Stubbfel, 02.09.2013.</remarks>
|
||||
public class CourseFeed : XmlModel<ExamListModel>
|
||||
{
|
||||
/// <summary>Initializes a new instance of the CourseFeed class.</summary>
|
||||
/// <remarks>Stubbfel, 02.09.2013.</remarks>
|
||||
public CourseFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileExamApp_ExamFeed, Constants.UrlExamApp_ExamFeed)
|
||||
{
|
||||
this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.ValidRootName = Constants.ExamXmlValidRootName;
|
||||
}
|
||||
|
||||
/// <summary>Check is model up to date.</summary>
|
||||
/// <remarks>Stubbfel, 02.09.2013.</remarks>
|
||||
/// <param name="model">The model.</param>
|
||||
/// <returns>true if it succeeds, false if it fails.</returns>
|
||||
private bool CheckIsModelUpToDate(ExamListModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Check is file up to date.</summary>
|
||||
/// <remarks>Stubbfel, 02.09.2013.</remarks>
|
||||
/// <param name="model"> The model.</param>
|
||||
/// <param name="fileInfo">Information describing the file.</param>
|
||||
/// <returns>true if it succeeds, false if it fails.</returns>
|
||||
private bool CheckIsFileUpToDate(ExamListModel model, FileInfo fileInfo)
|
||||
{
|
||||
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,11 @@
|
||||
// <sience>02.09.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Exams
|
||||
{
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Model.Utility;
|
||||
|
||||
/// <summary>Exam list model.</summary>
|
||||
/// <remarks>Stubbfel, 02.09.2013.</remarks>
|
||||
@@ -19,5 +21,24 @@ namespace CampusAppWP8.Model.Exams
|
||||
/// <value>The exams.</value>
|
||||
[XmlElement("link")]
|
||||
public ObservableCollection<ExamModel> Exams { get; set; }
|
||||
|
||||
/// <summary>Creates course list.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <returns>The new course list.</returns>
|
||||
public List<CourseModel> CreateCourseList()
|
||||
{
|
||||
List<CourseModel> result = new List<CourseModel>();
|
||||
foreach (ExamModel exam in this.Exams)
|
||||
{
|
||||
CourseModel tmpModel = new CourseModel(exam.CourseNumber, exam.CourseText);
|
||||
|
||||
if (!result.Contains(tmpModel))
|
||||
{
|
||||
result.Add(tmpModel);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <remarks>
|
||||
/// need to be extend to full list
|
||||
/// </remarks>
|
||||
private ListPickerItemListModel courseList;
|
||||
private CourseListPickerItemListModel courseList;
|
||||
|
||||
/// <summary>
|
||||
/// List of the degrees
|
||||
@@ -86,12 +86,23 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// </summary>
|
||||
public LecturePageModel()
|
||||
{
|
||||
this.courseList = new CourseListPickerItemListModel();
|
||||
this.degreeList = new DegreeListPickerItemListModel();
|
||||
this.semesterList = new SemesterListPickerItemListModel();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region events
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the OnIO callback function.
|
||||
/// </summary>
|
||||
public delegate void OnIO();
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, called after loading.
|
||||
/// </summary>
|
||||
public event OnIO OnLoaded = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Proberty
|
||||
|
||||
/// <summary>
|
||||
@@ -254,18 +265,11 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// </summary>
|
||||
public void LoadLists()
|
||||
{
|
||||
this.LoadFromNumberList();
|
||||
this.LoadToNumberList();
|
||||
UserProfilModel userModel = Settings.UserProfil;
|
||||
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());
|
||||
this.courseList = new CourseListPickerItemListModel();
|
||||
this.courseList.OnLoaded += new CourseListPickerItemListModel.OnIO(this.CourseListIsReady);
|
||||
this.courseList.LoadCourseList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Load the NumberList
|
||||
/// </summary>
|
||||
@@ -296,6 +300,29 @@ namespace CampusAppWP8.Model.Lecture
|
||||
this.SelectToIndex = this.toNumberList.GetIndexOrDefault(selectValue);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>Course list is ready.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void CourseListIsReady()
|
||||
{
|
||||
this.degreeList = new DegreeListPickerItemListModel();
|
||||
this.semesterList = new SemesterListPickerItemListModel();
|
||||
|
||||
this.LoadFromNumberList();
|
||||
this.LoadToNumberList();
|
||||
UserProfilModel userModel = Settings.UserProfil;
|
||||
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());
|
||||
if (this.OnLoaded != null)
|
||||
{
|
||||
this.OnLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method create a NumberList
|
||||
/// </summary>
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace CampusAppWP8.Model.Utility
|
||||
public CampusListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -6,20 +6,26 @@
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CampusAppWP8.Feed.Exams;
|
||||
using CampusAppWP8.Feed.Utility;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This is a class for the courseList
|
||||
/// </summary>
|
||||
public class CourseListPickerItemListModel : ListPickerItemListModel
|
||||
{
|
||||
/// <summary>List of courses.</summary>
|
||||
private CourseFeed courseList;
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CourseListPickerItemListModel" /> class.
|
||||
/// </summary>
|
||||
public CourseListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,14 +33,44 @@ namespace CampusAppWP8.Model.Utility
|
||||
|
||||
#region Method
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the OnIO callback function.
|
||||
/// </summary>
|
||||
public delegate void OnIO();
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, called after loading.
|
||||
/// </summary>
|
||||
public event OnIO OnLoaded = null;
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the LoadList-Method <see cref="ListPickerItemListModel"/>
|
||||
/// </summary>
|
||||
protected override void LoadList()
|
||||
public void LoadCourseList()
|
||||
{
|
||||
if (this.courseList == null || this.courseList.Model == null)
|
||||
{
|
||||
this.courseList = new CourseFeed();
|
||||
this.courseList.OnLoaded += new CourseFeed.OnIO(this.FeedIsReady);
|
||||
this.courseList.OnFailedWeb += new CourseFeed.OnFailed(this.FeedIsFail);
|
||||
this.courseList.OnFailedFile += new CourseFeed.OnFailed(this.FeedIsFail);
|
||||
this.courseList.LoadData();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CallOnLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Fall back list.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void FallBackList()
|
||||
{
|
||||
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"));
|
||||
@@ -79,6 +115,46 @@ namespace CampusAppWP8.Model.Utility
|
||||
this.List = this.List.OrderBy(o => o.Text).ToList();
|
||||
}
|
||||
|
||||
/// <summary>Feed is fail.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void FeedIsFail()
|
||||
{
|
||||
this.FallBackList();
|
||||
this.CallOnLoaded();
|
||||
}
|
||||
|
||||
/// <summary>Feed is ready.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void FeedIsReady()
|
||||
{
|
||||
this.ConvertToListPickerItemModel(this.courseList.Model.CreateCourseList());
|
||||
this.CallOnLoaded();
|
||||
}
|
||||
|
||||
/// <summary>Converts a courseList to a list picker item model.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <param name="courseList">List of courses.</param>
|
||||
private void ConvertToListPickerItemModel(List<CourseModel> courseList)
|
||||
{
|
||||
foreach (CourseModel course in courseList)
|
||||
{
|
||||
this.AddItem(new ListPickerItemModel(course.CourseNumber, StringManager.StripHTML(course.CourseText)));
|
||||
}
|
||||
|
||||
this.List = this.List.OrderBy(o => o.Text).ToList();
|
||||
this.courseList.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>Call on loaded.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void CallOnLoaded()
|
||||
{
|
||||
if (this.OnLoaded != null)
|
||||
{
|
||||
this.OnLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
48
CampusAppWP8/CampusAppWP8/Model/Utility/CourseModel.cs
Normal file
48
CampusAppWP8/CampusAppWP8/Model/Utility/CourseModel.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
// <copyright file="CourseModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.List
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>25.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>Course model.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
public class CourseModel : IEquatable<CourseModel>
|
||||
{
|
||||
/// <summary>Initializes a new instance of the CourseModel class.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <param name="courseNumber">The course number.</param>
|
||||
/// <param name="courseText"> The course text.</param>
|
||||
public CourseModel(string courseNumber, string courseText)
|
||||
{
|
||||
this.CourseNumber = courseNumber;
|
||||
this.CourseText = courseText;
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the course number.</summary>
|
||||
/// <value>The course number.</value>
|
||||
public string CourseNumber { get; set; }
|
||||
|
||||
/// <summary>Gets or sets the course text.</summary>
|
||||
/// <value>The course text.</value>
|
||||
public string CourseText { get; set; }
|
||||
|
||||
/// <summary>Tests if this CourseModel is considered equal to another.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <param name="other">The course model to compare to this object.</param>
|
||||
/// <returns>true if the objects are considered equal, false if they are not.</returns>
|
||||
public bool Equals(CourseModel other)
|
||||
{
|
||||
if (this.CourseNumber.Equals(other.CourseNumber))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ namespace CampusAppWP8.Model.Utility
|
||||
public DegreeListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace CampusAppWP8.Model.Utility
|
||||
public ListPickerItemListModel()
|
||||
{
|
||||
this.list = new List<ListPickerItemModel>();
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace CampusAppWP8.Model.Utility
|
||||
public RoleListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace CampusAppWP8.Model.Utility
|
||||
public SemesterListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Api.Lecture;
|
||||
@@ -18,7 +17,6 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility.Lui.MessageBoxes;
|
||||
using Microsoft.Phone.Controls;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the LecturePage
|
||||
@@ -56,8 +54,6 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
this.InitializeComponent();
|
||||
this.init = false;
|
||||
this.LoadPageModel();
|
||||
this.SetupListPickers();
|
||||
this.init = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -96,7 +92,9 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
/// </summary>
|
||||
private void LoadPageModel()
|
||||
{
|
||||
this.ProgressBar.Visibility = Visibility.Visible;
|
||||
this.pageModel = new LecturePageModel();
|
||||
this.pageModel.OnLoaded += new LecturePageModel.OnIO(this.SetupListPickers);
|
||||
this.pageModel.LoadLists();
|
||||
}
|
||||
|
||||
@@ -119,6 +117,8 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
}
|
||||
|
||||
this.SetSelectedIndex();
|
||||
this.init = true;
|
||||
this.ProgressBar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -205,6 +205,7 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
{
|
||||
this.api.Model.FilterByCourseTitle(query);
|
||||
}
|
||||
|
||||
App.SaveToIsolatedStorage<LectureList>(Constants.IsolatedStorage_LectureModel, this.api.Model);
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
Uri url = new Uri(Constants.PathLecture_ResultPage, UriKind.Relative);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
|
||||
if (NavigationMode.Back == e.NavigationMode && this.places == null)
|
||||
{
|
||||
this.places = new PlacesFile();
|
||||
@@ -103,9 +103,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
this.places.OnFailedLoad += new PlacesFile.OnFailed(this.PlacesFileIsFail);
|
||||
this.places.LoadData();
|
||||
}
|
||||
|
||||
// init sps API
|
||||
if (this.spsApi == null || this.forceReqest)
|
||||
else if (this.spsApi == null || this.forceReqest)
|
||||
{
|
||||
this.spsApi = new SpsApi();
|
||||
this.spsApi.OnLoaded += new SpsApi.OnIO(this.SpsApiIsReady);
|
||||
@@ -152,11 +150,15 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
private void PlacesFileIsFail()
|
||||
{
|
||||
this.places.Model = new SpsModel();
|
||||
if (this.spsApi != null)
|
||||
if (this.spsApi == null)
|
||||
{
|
||||
this.spsApi.LoadData();
|
||||
this.waitForApi++;
|
||||
}
|
||||
this.spsApi = new SpsApi();
|
||||
this.spsApi.OnLoaded += new SpsApi.OnIO(this.SpsApiIsReady);
|
||||
this.spsApi.OnFailedLoad += new SpsApi.OnFailed(this.ApiIsFail);
|
||||
this.spsApi.SetupCurrentPlaceRequest(Constants.SpsDomain_Buildings);
|
||||
}
|
||||
this.spsApi.LoadData();
|
||||
this.waitForApi++;
|
||||
}
|
||||
|
||||
/// <summary>Places file is ready.</summary>
|
||||
@@ -175,7 +177,9 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
private void PssApiIsReady()
|
||||
{
|
||||
this.waitForApi--;
|
||||
this.places.Model.AddPlaces(this.pssApi.Model.Places.ToList());
|
||||
this.places.Model.AddPlaces(this.pssApi.Model.Places.ToList());
|
||||
|
||||
this.CheckedSetupResultBox();
|
||||
}
|
||||
|
||||
/// <summary>Pis API is ready.</summary>
|
||||
@@ -277,7 +281,8 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
|
||||
/// <summary>Checked setup result box.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void CheckedSetupResultBox() {
|
||||
private void CheckedSetupResultBox()
|
||||
{
|
||||
if (this.waitForApi < 1)
|
||||
{
|
||||
if (this.Dispatcher != null)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
namespace CampusAppWP8.Pages.Setting
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Setting;
|
||||
using CampusAppWP8.Model.Utility;
|
||||
@@ -24,6 +25,9 @@ namespace CampusAppWP8.Pages.Setting
|
||||
/// </summary>
|
||||
private UserProfilModel userProfil;
|
||||
|
||||
/// <summary>List of courses.</summary>
|
||||
private CourseListPickerItemListModel courseList;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserProfil" /> class.
|
||||
/// </summary>
|
||||
@@ -31,8 +35,7 @@ namespace CampusAppWP8.Pages.Setting
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.userProfil = Settings.UserProfil;
|
||||
|
||||
this.SetupListPickers();
|
||||
this.LoadListPicker();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,28 +50,38 @@ namespace CampusAppWP8.Pages.Setting
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Loads list picker.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void LoadListPicker()
|
||||
{
|
||||
this.ProgressBar.Visibility = Visibility.Visible;
|
||||
this.courseList = new CourseListPickerItemListModel();
|
||||
this.courseList.OnLoaded += new CourseListPickerItemListModel.OnIO(this.SetupListPickers);
|
||||
this.courseList.LoadCourseList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method sets the ItemSource of the ListPickers
|
||||
/// </summary>
|
||||
private void SetupListPickers()
|
||||
{
|
||||
CourseListPickerItemListModel courseList = new CourseListPickerItemListModel();
|
||||
DegreeListPickerItemListModel degreeList = new DegreeListPickerItemListModel();
|
||||
SemesterListPickerItemListModel semesterList = new SemesterListPickerItemListModel();
|
||||
RoleListPickerItemListModel roleList = new RoleListPickerItemListModel();
|
||||
CampusListPickerItemListModel campusList = new CampusListPickerItemListModel();
|
||||
|
||||
this.Course.ItemsSource = courseList.List;
|
||||
this.Course.ItemsSource = this.courseList.List;
|
||||
this.Degree.ItemsSource = degreeList.List;
|
||||
this.Semster.ItemsSource = semesterList.List;
|
||||
this.Role.ItemsSource = roleList.List;
|
||||
this.Campus.ItemsSource = campusList.List;
|
||||
|
||||
this.Course.SelectedIndex = courseList.GetIndexOrDefault(this.userProfil.Course.ToString().PadLeft(3, '0'));
|
||||
this.Course.SelectedIndex = this.courseList.GetIndexOrDefault(this.userProfil.Course.ToString().PadLeft(3, '0'));
|
||||
this.Degree.SelectedIndex = degreeList.GetIndexOrDefault(((int)this.userProfil.Degree).ToString());
|
||||
this.Semster.SelectedIndex = semesterList.GetIndexOrDefault(this.userProfil.Semester.ToString());
|
||||
this.Role.SelectedIndex = roleList.GetIndexOrDefault(this.userProfil.Role.ToString());
|
||||
this.Campus.SelectedIndex = campusList.GetIndexOrDefault(((int)this.userProfil.DefaultCampus).ToString());
|
||||
this.ProgressBar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.Utility;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Utility.Lui.MessageBoxes;
|
||||
@@ -23,6 +24,9 @@ namespace CampusAppWP8.Pages
|
||||
/// </summary>
|
||||
public partial class StartPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>List of initialise courses.</summary>
|
||||
private CourseFeed initCourseList;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StartPage" /> class.
|
||||
/// </summary>
|
||||
@@ -63,7 +67,10 @@ namespace CampusAppWP8.Pages
|
||||
}
|
||||
|
||||
if (!Settings.AppSetting.InitApp)
|
||||
{
|
||||
{
|
||||
this.initCourseList = new CourseFeed();
|
||||
this.initCourseList.OnLoaded += new CourseFeed.OnIO(this.StoreCourseFeed);
|
||||
this.initCourseList.LoadData();
|
||||
this.ShowOptIns();
|
||||
Settings.AppSetting.InitApp = true;
|
||||
}
|
||||
@@ -78,6 +85,13 @@ namespace CampusAppWP8.Pages
|
||||
base.OnNavigatedTo(e);
|
||||
}
|
||||
|
||||
/// <summary>Stores course feed.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void StoreCourseFeed()
|
||||
{
|
||||
this.initCourseList.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method handle OrientationPage
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user