Merge branch 'release/r184#136#40' into develmaster
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,24 @@ namespace CampusAppWP8.Model.Lecture
|
||||
return activity;
|
||||
}
|
||||
|
||||
/// <summary>Filter by course string.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <param name="filter">Specifies the filter.</param>
|
||||
public void FilterByCourseTitle(string filter)
|
||||
{
|
||||
ObservableCollection<LectureActivity> filteredCollection = new ObservableCollection<LectureActivity>();
|
||||
filter = filter.Trim().ToLower();
|
||||
foreach (LectureActivity activity in this.Activities)
|
||||
{
|
||||
activity.CreateCourseString();
|
||||
if (activity.Title.ToLower().Contains(filter))
|
||||
{
|
||||
filteredCollection.Add(activity);
|
||||
}
|
||||
}
|
||||
|
||||
this.Activities = filteredCollection;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -54,8 +54,6 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
this.InitializeComponent();
|
||||
this.init = false;
|
||||
this.LoadPageModel();
|
||||
this.SetupListPickers();
|
||||
this.init = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -63,7 +61,7 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
#region methods
|
||||
|
||||
#region protected
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Methods overrides the OnNavigatedFrom-Method
|
||||
/// </summary>
|
||||
@@ -94,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();
|
||||
}
|
||||
|
||||
@@ -117,6 +117,8 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
}
|
||||
|
||||
this.SetSelectedIndex();
|
||||
this.init = true;
|
||||
this.ProgressBar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -198,6 +200,12 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
/// </summary>
|
||||
private void ApiIsReady()
|
||||
{
|
||||
string query = this.ActivtyName.Text;
|
||||
if (!query.Equals(string.Empty))
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -9,9 +9,11 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Lecture;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility.Lui.MessageBoxes;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
@@ -33,6 +35,7 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
LectureList list = App.LoadFromIsolatedStorage<LectureList>(Constants.IsolatedStorage_LectureModel);
|
||||
if (list == null)
|
||||
{
|
||||
@@ -41,8 +44,20 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
return;
|
||||
}
|
||||
|
||||
this.ResultList.ItemsSource = list.Activities.OrderByDescending(o => o.Type).ThenBy(o => o.Title).ToList();
|
||||
base.OnNavigatedTo(e);
|
||||
if (list.Activities.Count > 0)
|
||||
{
|
||||
|
||||
this.ResultList.ItemsSource = list.Activities.OrderByDescending(o => o.Type).ThenBy(o => o.Title).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxResult result = MessageBoxes.ShowMainModelInfoMessageBox(AppResources.MsgBox_NoResult);
|
||||
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
NavigationService.GoBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,8 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
/// <param name="e">Ein Objekt, das die Ereignisdaten enthält.</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
if (NavigationMode.Back == e.NavigationMode && this.places == null)
|
||||
{
|
||||
this.places = new PlacesFile();
|
||||
@@ -65,7 +67,14 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
}
|
||||
else
|
||||
{
|
||||
this.InitializeApi();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
Thread thread = new Thread(delegate()
|
||||
{
|
||||
this.InitializeApi();
|
||||
|
||||
});
|
||||
thread.Start();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,20 +103,14 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
this.places.OnFailedLoad += new PlacesFile.OnFailed(this.PlacesFileIsFail);
|
||||
this.places.LoadData();
|
||||
}
|
||||
|
||||
// init sps API
|
||||
|
||||
// init sps Api
|
||||
if (this.spsApi == null || this.forceReqest)
|
||||
{
|
||||
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.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
if (this.places.Model != null)
|
||||
{
|
||||
this.spsApi.LoadData();
|
||||
this.waitForApi++;
|
||||
}
|
||||
}
|
||||
|
||||
// init pis API
|
||||
@@ -125,6 +128,18 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
this.pssApi.OnLoaded += new PssApi.OnIO(this.PssApiIsReady);
|
||||
this.pssApi.OnFailedLoad += new PssApi.OnFailed(this.ApiIsFail);
|
||||
}
|
||||
|
||||
if (this.waitForApi < 1)
|
||||
{
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() => this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Places file is fail.</summary>
|
||||
@@ -132,22 +147,30 @@ 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>
|
||||
/// <remarks>Stubbfel, 09.09.2013.</remarks>
|
||||
private void PlacesFileIsReady()
|
||||
{
|
||||
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>Pss API is ready.</summary>
|
||||
@@ -157,10 +180,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
this.waitForApi--;
|
||||
this.places.Model.AddPlaces(this.pssApi.Model.Places.ToList());
|
||||
|
||||
if (this.waitForApi < 1)
|
||||
{
|
||||
this.SetupResultBox();
|
||||
}
|
||||
this.CheckedSetupResultBox();
|
||||
}
|
||||
|
||||
/// <summary>Pis API is ready.</summary>
|
||||
@@ -170,10 +190,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
this.waitForApi--;
|
||||
this.places.Model.AddPlaces(this.pisApi.Model.Places.ToList());
|
||||
|
||||
if (this.waitForApi < 1)
|
||||
{
|
||||
this.SetupResultBox();
|
||||
}
|
||||
this.CheckedSetupResultBox();
|
||||
}
|
||||
|
||||
/// <summary>API is fail.</summary>
|
||||
@@ -197,8 +214,6 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
List<string> infoNames = new List<string>() { Constants.PisInformationName_Name };
|
||||
List<string> serviceNames = new List<string>() { Constants.PssServiceName_PlaceNews };
|
||||
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
|
||||
// load from pis api
|
||||
if (this.forceReqest || !this.places.Model.ContainsInformationNames(pidlist, infoNames))
|
||||
{
|
||||
@@ -215,10 +230,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
this.waitForApi++;
|
||||
}
|
||||
|
||||
if (this.waitForApi < 1)
|
||||
{
|
||||
this.SetupResultBox();
|
||||
}
|
||||
this.CheckedSetupResultBox();
|
||||
}
|
||||
|
||||
/// <summary>Sets up the result box.</summary>
|
||||
@@ -249,7 +261,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
{
|
||||
Utilities.DetermineAndStoreCurrentPositionForce();
|
||||
this.forceReqest = true;
|
||||
this.Dispatcher.BeginInvoke(new Action(() => this.InitializeApi()));
|
||||
this.InitializeApi();
|
||||
}
|
||||
|
||||
/// <summary>Event handler. Called by ApplicationBarMenuItem for click events.</summary>
|
||||
@@ -267,5 +279,22 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
private void ApplicationBarMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Checked setup result box.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
private void CheckedSetupResultBox()
|
||||
{
|
||||
if (this.waitForApi < 1)
|
||||
{
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SetupResultBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -645,6 +645,24 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
|
||||
/// </summary>
|
||||
public static string MsgBox_InfoHeader {
|
||||
get {
|
||||
return ResourceManager.GetString("MsgBox_InfoHeader", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Es gibt keine Ergebnisse zur gestellten Anfrage ähnelt.
|
||||
/// </summary>
|
||||
public static string MsgBox_NoResult {
|
||||
get {
|
||||
return ResourceManager.GetString("MsgBox_NoResult", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die News ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -446,4 +446,10 @@
|
||||
<data name="PlaceNewsApp_Title" xml:space="preserve">
|
||||
<value>Placenews</value>
|
||||
</data>
|
||||
<data name="MsgBox_InfoHeader" xml:space="preserve">
|
||||
<value>Hinweis</value>
|
||||
</data>
|
||||
<data name="MsgBox_NoResult" xml:space="preserve">
|
||||
<value>Es gibt keine Ergebnisse zur gestellten Anfrage</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -33,5 +33,14 @@ namespace CampusAppWP8.Utility.Lui.MessageBoxes
|
||||
{
|
||||
return MessageBox.Show(text, AppResources.MsgBox_ErrorHeader, MessageBoxButton.OK);
|
||||
}
|
||||
|
||||
/// <summary>Shows the main model information message box.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <param name="text">custom text for the box.</param>
|
||||
/// <returns>.</returns>
|
||||
public static MessageBoxResult ShowMainModelInfoMessageBox(string text)
|
||||
{
|
||||
return MessageBox.Show(text, AppResources.MsgBox_InfoHeader, MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user