fix personpage

This commit is contained in:
stubbfel
2013-10-08 12:09:25 +02:00
parent 92097cf881
commit 0f3bbc3cf6
4 changed files with 48 additions and 34 deletions

View File

@@ -10,6 +10,7 @@ namespace CampusAppWP8.Model.Person
{
using System.Xml.Serialization;
using CampusAppWPortalLib8.Model.Person;
using System.Collections.Generic;
/// <summary>Person list model.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
@@ -25,5 +26,25 @@ namespace CampusAppWP8.Model.Person
IPersonModel<IPersonFunctionModel> tmpPerson = base.GetPerson(id);
return tmpPerson as PersonWp8Model;
}
/// <summary>Removes the non function person.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
public override void RemoveNonFunctionPerson()
{
List<PersonWp8Model> removeList = new List<PersonWp8Model>();
foreach (PersonWp8Model tmpPerson in this.Persons)
{
if (tmpPerson.Functions.Count < 1)
{
removeList.Add(tmpPerson);
}
}
foreach (PersonWp8Model removePerson in removeList)
{
this.Persons.Remove(removePerson);
}
}
}
}

View File

@@ -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 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ProgressBar Name="ProgressBar" Grid.Row="1" Visibility="Collapsed" IsIndeterminate="True"/>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Path=LocalizedResources.PersonApp_Header, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle2Style}"/>
<StackPanel Grid.Row="0">
<header:DefaultHeader HeaderName="{Binding Path=LocalizedResources.PersonApp_Header, Source={StaticResource LocalizedStrings}}"/>
<ProgressBar Name="ProgressBar" Visibility="Collapsed" IsIndeterminate="True"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
@@ -46,7 +45,7 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Name="SearchName" AcceptsReturn="False" Grid.Column="0" InputScope="PersonalSurname"/>
<TextBox Name="SearchName" AcceptsReturn="False" KeyDown="SearchName_KeyDown" Grid.Column="0" InputScope="PersonalSurname" VerticalAlignment="Center" />
<Button Grid.Column="1" Click="SendRequest">
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="50"/>
</Button>
@@ -105,10 +104,10 @@
</StackPanel>
<TextBlock Text="{Binding Building}" Grid.Row="2" Grid.Column="1" TextWrapping="Wrap"/>
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal">
<lui:EmailButton EmailAddress="{Binding Mail}" Height="100" />
<lui:PhoneButton Number="{Binding Tel1}" Height="100" />
<lui:AddPersonButton Height="100" Click="Button_Click" PersonId="{Binding PersonID}" FunctionIndex="{Binding FunctionIndex}" />
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" Margin="0,0,0,0">
<lui:EmailButton EmailAddress="{Binding Mail}" Height="100" Margin="0,0,0,0" />
<lui:PhoneButton Number="{Binding Tel1}" Height="100" Margin="0,0,0,0"/>
<lui:AddPersonButton Height="100" Click="Button_Click" PersonId="{Binding PersonID}" FunctionIndex="{Binding FunctionIndex}" Margin="0,0,0,0"/>
</StackPanel>
</Grid>
</Border>

View File

@@ -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;
/// <summary>Person page.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
@@ -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);
}
}
/// <summary>Event handler. Called by Button for click events.</summary>
@@ -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
}
}

View File

@@ -16,7 +16,7 @@ namespace CampusAppWPortalLib8.Model.Person
/// <remarks>Stubbfel, 05.09.2013.</remarks>
/// <typeparam name="T">personModel template</typeparam>
[XmlRoot("Uebersicht")]
public class PersonListModel<T>
public abstract class PersonListModel<T>
{
#region Property
@@ -76,28 +76,8 @@ namespace CampusAppWPortalLib8.Model.Person
/// <summary>Removes the non function person.</summary>
/// <remarks>Stubbfel, 05.09.2013.</remarks>
public void RemoveNonFunctionPerson()
{
List<T> removeList = new List<T>();
foreach (T item in this.Persons)
{
IPersonModel<IPersonFunctionModel> tmpPerson = item as IPersonModel<IPersonFunctionModel>;
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
}