add filter add placenews
This commit is contained in:
@@ -37,7 +37,7 @@ using CampusAppWP8.Resources;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,5 +172,22 @@ namespace CampusAppWP8.Model.GeoDb
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Filter by PID.</summary>
|
||||
/// <remarks>Stubbfel, 11.09.2013.</remarks>
|
||||
/// <param name="pidList">List of pids.</param>
|
||||
/// <returns>.</returns>
|
||||
public List<PlaceModel> FilterByPid(List<string> pidList)
|
||||
{
|
||||
List<PlaceModel> fitlerList = new List<PlaceModel>();
|
||||
foreach (PlaceModel place in this.Places)
|
||||
{
|
||||
if (pidList.Contains(place.PlaceId))
|
||||
{
|
||||
fitlerList.Add(place);
|
||||
}
|
||||
}
|
||||
return fitlerList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
|
||||
/// <summary>true to force reqest.</summary>
|
||||
private bool forceReqest;
|
||||
private List<string> searchPidList;
|
||||
|
||||
/// <summary>Initializes a new instance of the PlaceNews class.</summary>
|
||||
/// <remarks>Stubbfel, 09.09.2013.</remarks>
|
||||
@@ -111,6 +112,10 @@ 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);
|
||||
if (this.forceReqest)
|
||||
{
|
||||
this.spsApi.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
// init pis API
|
||||
@@ -210,22 +215,22 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
this.waitForApi--;
|
||||
this.places.Model.AddPlaces(this.spsApi.Model.Places.ToList());
|
||||
|
||||
List<string> pidlist = this.spsApi.Model.CreatePidList();
|
||||
searchPidList = this.spsApi.Model.CreatePidList();
|
||||
List<string> infoNames = new List<string>() { Constants.PisInformationName_Name };
|
||||
List<string> serviceNames = new List<string>() { Constants.PssServiceName_PlaceNews };
|
||||
|
||||
// load from pis api
|
||||
if (this.forceReqest || !this.places.Model.ContainsInformationNames(pidlist, infoNames))
|
||||
if (this.forceReqest || !this.places.Model.ContainsInformationNames(searchPidList, infoNames))
|
||||
{
|
||||
this.pisApi.SetupInformationRequest(pidlist, infoNames);
|
||||
this.pisApi.SetupInformationRequest(searchPidList, infoNames);
|
||||
this.pisApi.LoadData();
|
||||
this.waitForApi++;
|
||||
}
|
||||
|
||||
|
||||
// load from pis api
|
||||
if (this.forceReqest || !this.places.Model.ContainsServiceNames(pidlist, serviceNames))
|
||||
if (this.forceReqest || !this.places.Model.ContainsServiceNames(searchPidList, serviceNames))
|
||||
{
|
||||
this.pssApi.SetupServiceRequest(pidlist, serviceNames);
|
||||
this.pssApi.SetupServiceRequest(searchPidList, serviceNames);
|
||||
this.pssApi.LoadData();
|
||||
this.waitForApi++;
|
||||
}
|
||||
@@ -237,7 +242,7 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
/// <remarks>Stubbfel, 09.09.2013.</remarks>
|
||||
private void SetupResultBox()
|
||||
{
|
||||
this.ResultBox.ItemsSource = this.places.Model.Places;
|
||||
this.ResultBox.ItemsSource = this.places.Model.FilterByPid(this.searchPidList);
|
||||
this.ProgressBar.Visibility = Visibility.Collapsed;
|
||||
this.places.SaveData();
|
||||
App.SaveToIsolatedStorage<SpsModel>(Constants.IsolatedStorage_AllPlaces, this.places.Model);
|
||||
|
||||
@@ -907,7 +907,7 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die name ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Name ähnelt.
|
||||
/// </summary>
|
||||
public static string PisInformationName_Name {
|
||||
get {
|
||||
@@ -979,7 +979,7 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 3 ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 1 ähnelt.
|
||||
/// </summary>
|
||||
public static string SpsApi_CampusDomain {
|
||||
get {
|
||||
@@ -1015,7 +1015,7 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 1 ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 2 ähnelt.
|
||||
/// </summary>
|
||||
public static string SpsDomain_Buildings {
|
||||
get {
|
||||
|
||||
@@ -391,7 +391,7 @@
|
||||
<value>http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=Senftenberg&v=1</value>
|
||||
</data>
|
||||
<data name="SpsApi_CampusDomain" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="SpsApi_DomainParaKey" xml:space="preserve">
|
||||
<value>domain</value>
|
||||
@@ -505,7 +505,7 @@
|
||||
<value>pid</value>
|
||||
</data>
|
||||
<data name="PisInformationName_Name" xml:space="preserve">
|
||||
<value>name</value>
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="PisInformationName_Typ" xml:space="preserve">
|
||||
<value>typ</value>
|
||||
@@ -520,7 +520,7 @@
|
||||
<value>PlaceNews</value>
|
||||
</data>
|
||||
<data name="SpsDomain_Buildings" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="UrlPisService" xml:space="preserve">
|
||||
<value>http://141.43.76.140/service/pis</value>
|
||||
|
||||
Reference in New Issue
Block a user