From 0f3bbc3cf6cbc8f9de074a27af3db9feb8975d77 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 8 Oct 2013 12:09:25 +0200 Subject: [PATCH] fix personpage --- .../Model/Person/PersonListWp8Model.cs | 21 +++++++++++++++ .../CampusAppWP8/Pages/Person/PersonPage.xaml | 19 +++++++------- .../Pages/Person/PersonPage.xaml.cs | 16 +++++++++++- .../Model/Person/PersonListModel.cs | 26 +++---------------- 4 files changed, 48 insertions(+), 34 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs index 474f3fea..4a95dcb9 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Person/PersonListWp8Model.cs @@ -10,6 +10,7 @@ namespace CampusAppWP8.Model.Person { using System.Xml.Serialization; using CampusAppWPortalLib8.Model.Person; + using System.Collections.Generic; /// Person list model. /// Stubbfel, 05.09.2013. @@ -25,5 +26,25 @@ namespace CampusAppWP8.Model.Person IPersonModel tmpPerson = base.GetPerson(id); return tmpPerson as PersonWp8Model; } + + + /// Removes the non function person. + /// Stubbfel, 05.09.2013. + public override void RemoveNonFunctionPerson() + { + List removeList = new List(); + foreach (PersonWp8Model tmpPerson in this.Persons) + { + if (tmpPerson.Functions.Count < 1) + { + removeList.Add(tmpPerson); + } + } + + foreach (PersonWp8Model removePerson in removeList) + { + this.Persons.Remove(removePerson); + } + } } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml index bfc4d4ca..7564bfa0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml @@ -7,6 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" + xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -21,12 +22,10 @@ - - - - - + + + @@ -46,7 +45,7 @@ - + @@ -105,10 +104,10 @@ - - - - + + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs index ac47c1e4..6681f537 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs @@ -8,8 +8,8 @@ namespace CampusAppWP8.Pages.Person { - using System.Collections.Generic; using System.Windows; + using System.Windows.Input; using CampusAppWP8.Api.Person; using CampusAppWP8.Model.Person; using CampusAppWP8.Resources; @@ -18,6 +18,7 @@ namespace CampusAppWP8.Pages.Person using CampusAppWPortalLib8.Model.Utility; using Microsoft.Phone.Controls; using Microsoft.Phone.Tasks; + using System.Collections.Generic; /// Person page. /// Stubbfel, 09.09.2013. @@ -97,6 +98,10 @@ namespace CampusAppWP8.Pages.Person { this.api.Model.RemoveNonFunctionAndSetIdsPerson(); this.ResultBox.ItemsSource = this.api.Model.Persons; + if (this.api.Model == null || this.api.Model.Persons == null || this.api.Model.Persons.Count < 1) + { + MessageBoxes.ShowMainModelInfoMessageBox(AppResources.MsgBox_NoResult); + } } /// Event handler. Called by Button for click events. @@ -138,6 +143,15 @@ namespace CampusAppWP8.Pages.Person saveContactTask.Show(); } + private void SearchName_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + this.SendRequest(sender,e); + } + } + #endregion + } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs index d79729a8..ade93416 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Person/PersonListModel.cs @@ -16,7 +16,7 @@ namespace CampusAppWPortalLib8.Model.Person /// Stubbfel, 05.09.2013. /// personModel template [XmlRoot("Uebersicht")] - public class PersonListModel + public abstract class PersonListModel { #region Property @@ -76,28 +76,8 @@ namespace CampusAppWPortalLib8.Model.Person /// Removes the non function person. /// Stubbfel, 05.09.2013. - public void RemoveNonFunctionPerson() - { - List removeList = new List(); - foreach (T item in this.Persons) - { - IPersonModel tmpPerson = item as IPersonModel; - if (tmpPerson == null) - { - continue; - } - - if (tmpPerson.Functions.Count < 1) - { - removeList.Add(item); - } - } - - foreach (T removePerson in removeList) - { - this.Persons.Remove(removePerson); - } - } + public abstract void RemoveNonFunctionPerson(); + #endregion }