From 220fe3daed0660f91e99c320677d433db21528b3 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 10 Sep 2013 10:28:44 +0200 Subject: [PATCH 1/6] fix init --- .../Pages/PlaceNews/PlaceNews.xaml.cs | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs index 1f4457ac..34a3edb2 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs @@ -57,6 +57,8 @@ namespace CampusAppWP8.Pages.PlaceNews /// Ein Objekt, das die Ereignisdaten enthält. protected override void OnNavigatedTo(NavigationEventArgs e) { + base.OnNavigatedTo(e); + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; if (NavigationMode.Back == e.NavigationMode && this.places == null) { this.places = new PlacesFile(); @@ -65,7 +67,13 @@ namespace CampusAppWP8.Pages.PlaceNews } else { - this.InitializeApi(); + Thread thread = new Thread(delegate() + { + this.InitializeApi(); + + }); + thread.Start(); + } } @@ -102,7 +110,6 @@ namespace CampusAppWP8.Pages.PlaceNews 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(); @@ -159,7 +166,14 @@ namespace CampusAppWP8.Pages.PlaceNews if (this.waitForApi < 1) { - this.SetupResultBox(); + if (this.Dispatcher != null) + { + this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox())); + } + else + { + this.SetupResultBox(); + } } } @@ -172,7 +186,14 @@ namespace CampusAppWP8.Pages.PlaceNews if (this.waitForApi < 1) { - this.SetupResultBox(); + if (this.Dispatcher != null) + { + this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox())); + } + else + { + this.SetupResultBox(); + }; } } @@ -197,8 +218,6 @@ namespace CampusAppWP8.Pages.PlaceNews List infoNames = new List() { Constants.PisInformationName_Name }; List serviceNames = new List() { Constants.PssServiceName_PlaceNews }; - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; - // load from pis api if (this.forceReqest || !this.places.Model.ContainsInformationNames(pidlist, infoNames)) { @@ -217,7 +236,14 @@ namespace CampusAppWP8.Pages.PlaceNews if (this.waitForApi < 1) { - this.SetupResultBox(); + if (this.Dispatcher != null) + { + this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox())); + } + else + { + this.SetupResultBox(); + } } } @@ -249,7 +275,7 @@ namespace CampusAppWP8.Pages.PlaceNews { Utilities.DetermineAndStoreCurrentPositionForce(); this.forceReqest = true; - this.Dispatcher.BeginInvoke(new Action(() => this.InitializeApi())); + this.InitializeApi(); } /// Event handler. Called by ApplicationBarMenuItem for click events. From b6bdac321126e600abb56cea6722c3012d445ceb Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 10 Sep 2013 12:23:01 +0200 Subject: [PATCH 2/6] fix progressbar --- .../Pages/PlaceNews/PlaceNews.xaml.cs | 69 +++++++++---------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs index 34a3edb2..d8aae007 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs @@ -58,7 +58,7 @@ namespace CampusAppWP8.Pages.PlaceNews protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); - this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + if (NavigationMode.Back == e.NavigationMode && this.places == null) { this.places = new PlacesFile(); @@ -67,6 +67,7 @@ namespace CampusAppWP8.Pages.PlaceNews } else { + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; Thread thread = new Thread(delegate() { this.InitializeApi(); @@ -132,6 +133,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; + } + } } /// Places file is fail. @@ -162,19 +175,7 @@ namespace CampusAppWP8.Pages.PlaceNews private void PssApiIsReady() { this.waitForApi--; - this.places.Model.AddPlaces(this.pssApi.Model.Places.ToList()); - - if (this.waitForApi < 1) - { - if (this.Dispatcher != null) - { - this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox())); - } - else - { - this.SetupResultBox(); - } - } + this.places.Model.AddPlaces(this.pssApi.Model.Places.ToList()); } /// Pis API is ready. @@ -184,17 +185,7 @@ namespace CampusAppWP8.Pages.PlaceNews this.waitForApi--; this.places.Model.AddPlaces(this.pisApi.Model.Places.ToList()); - if (this.waitForApi < 1) - { - if (this.Dispatcher != null) - { - this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox())); - } - else - { - this.SetupResultBox(); - }; - } + this.CheckedSetupResultBox(); } /// API is fail. @@ -234,17 +225,7 @@ namespace CampusAppWP8.Pages.PlaceNews this.waitForApi++; } - if (this.waitForApi < 1) - { - if (this.Dispatcher != null) - { - this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox())); - } - else - { - this.SetupResultBox(); - } - } + this.CheckedSetupResultBox(); } /// Sets up the result box. @@ -293,5 +274,21 @@ namespace CampusAppWP8.Pages.PlaceNews private void ApplicationBarMenuItem_Click_1(object sender, EventArgs e) { } + + /// Checked setup result box. + /// Stubbfel, 10.09.2013. + private void CheckedSetupResultBox() { + if (this.waitForApi < 1) + { + if (this.Dispatcher != null) + { + this.Dispatcher.BeginInvoke(new Action(() => this.SetupResultBox())); + } + else + { + this.SetupResultBox(); + } + } + } } } \ No newline at end of file From 613ccd6d302e571de48ec947d9284aaf39fe7842 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 10 Sep 2013 13:32:59 +0200 Subject: [PATCH 3/6] fitler by tilte and insert noresultmessage box --- .../CampusAppWP8/Model/Lecture/LectureList.cs | 18 ++++++++++++++++++ .../Pages/Lecture/LecturePage.xaml.cs | 9 ++++++++- .../Pages/Lecture/ResultPage.xaml.cs | 19 +++++++++++++++++-- .../Resources/AppResources.Designer.cs | 18 ++++++++++++++++++ .../CampusAppWP8/Resources/AppResources.resx | 6 ++++++ .../Utility/Lui/MessageBoxes/MessageBoxes.cs | 9 +++++++++ 6 files changed, 76 insertions(+), 3 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs index 39ede37a..3229b8d0 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs @@ -52,6 +52,24 @@ namespace CampusAppWP8.Model.Lecture return activity; } + /// Filter by course string. + /// Stubbfel, 10.09.2013. + /// Specifies the filter. + public void FilterByCourseTitle(string filter) + { + ObservableCollection filteredCollection = new ObservableCollection(); + 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 } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 0ed9ee1b..f596f801 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -9,6 +9,7 @@ namespace CampusAppWP8.Pages.Lecture { using System; using System.Collections.Generic; + using System.Linq; using System.Windows; using System.Windows.Navigation; using CampusAppWP8.Api.Lecture; @@ -17,6 +18,7 @@ namespace CampusAppWP8.Pages.Lecture using CampusAppWP8.Resources; using CampusAppWP8.Utility.Lui.MessageBoxes; using Microsoft.Phone.Controls; + using System.Collections.ObjectModel; /// /// Class for the LecturePage @@ -63,7 +65,7 @@ namespace CampusAppWP8.Pages.Lecture #region methods #region protected - + /// /// Methods overrides the OnNavigatedFrom-Method /// @@ -198,6 +200,11 @@ namespace CampusAppWP8.Pages.Lecture /// private void ApiIsReady() { + string query = this.ActivtyName.Text; + if (!query.Equals(string.Empty)) + { + this.api.Model.FilterByCourseTitle(query); + } App.SaveToIsolatedStorage(Constants.IsolatedStorage_LectureModel, this.api.Model); this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; Uri url = new Uri(Constants.PathLecture_ResultPage, UriKind.Relative); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs index f464c0d3..47d94d1f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs @@ -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; /// @@ -33,6 +35,7 @@ namespace CampusAppWP8.Pages.Lecture /// Arguments of navigation protected override void OnNavigatedTo(NavigationEventArgs e) { + base.OnNavigatedTo(e); LectureList list = App.LoadFromIsolatedStorage(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(); + } + } } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index eb9cd698..8acbfeac 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -645,6 +645,24 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt. + /// + public static string MsgBox_InfoHeader { + get { + return ResourceManager.GetString("MsgBox_InfoHeader", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Es gibt keine Ergebnisse zur gestellten Anfrage ähnelt. + /// + public static string MsgBox_NoResult { + get { + return ResourceManager.GetString("MsgBox_NoResult", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die News ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 24bed03d..133f3b14 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -446,4 +446,10 @@ Placenews + + Hinweis + + + Es gibt keine Ergebnisse zur gestellten Anfrage + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs index f444fc12..98b696d5 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs @@ -33,5 +33,14 @@ namespace CampusAppWP8.Utility.Lui.MessageBoxes { return MessageBox.Show(text, AppResources.MsgBox_ErrorHeader, MessageBoxButton.OK); } + + /// Shows the main model information message box. + /// Stubbfel, 10.09.2013. + /// custom text for the box. + /// . + public static MessageBoxResult ShowMainModelInfoMessageBox(string text) + { + return MessageBox.Show(text, AppResources.MsgBox_InfoHeader, MessageBoxButton.OK); + } } } From eb29dc6aed5ee10b5eb23905ca03a3466d19519b Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 10 Sep 2013 15:48:48 +0200 Subject: [PATCH 4/6] loade courselist like a Feed --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 6 +- .../CampusAppWP8/Feed/Utility/CourseFeed.cs | 59 +++++++++++++ .../CampusAppWP8/Model/Exams/ExamListModel.cs | 23 +++++- .../Model/Lecture/LecturePageModel.cs | 55 +++++++++---- .../Utility/CampusListPickerItemListModel.cs | 1 + .../Utility/CourseListPickerItemListModel.cs | 82 ++++++++++++++++++- .../CampusAppWP8/Model/Utility/CourseModel.cs | 48 +++++++++++ .../Utility/DegreeListPickerItemListModel.cs | 1 + .../Model/Utility/ListPickerItemListModel.cs | 1 - .../Utility/RoleListPickerItemListModel.cs | 1 + .../SemesterListPickerItemListModel.cs | 1 + .../Pages/Lecture/LecturePage.xaml.cs | 9 +- .../Pages/Setting/UserProfil.xaml.cs | 23 ++++-- 13 files changed, 279 insertions(+), 31 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Feed/Utility/CourseFeed.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/CourseModel.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 69ec4569..171006aa 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -108,6 +108,7 @@ + @@ -128,6 +129,7 @@ + @@ -535,9 +537,7 @@ - - - +