Merge branch 'release/merged173' into develmaster
This commit is contained in:
@@ -171,11 +171,18 @@ namespace CampusAppWP8
|
||||
|
||||
if (Settings.AppSetting.GeoWatchEnable)
|
||||
{
|
||||
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPositionForce));
|
||||
Thread thread = new Thread(new ThreadStart(this.PositionThread));
|
||||
thread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Position thread. </summary>
|
||||
/// <remarks> Stubbfel, 18.11.2013. </remarks>
|
||||
private void PositionThread()
|
||||
{
|
||||
Utilities.DetermineAndStoreCurrentPositionForce();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the usersettings from the store
|
||||
/// </summary>
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Feed\TimeTable\AppointmentFeed.cs" />
|
||||
<Compile Include="Feed\Mensa\PriceFeed.cs" />
|
||||
<Compile Include="File\Departments\DepartmentFavoriteFile.cs" />
|
||||
<Compile Include="Const.cs" />
|
||||
<Compile Include="Feed\Exams\ExamFeed.cs" />
|
||||
@@ -141,6 +143,7 @@
|
||||
<Compile Include="Pages\TimeTable\AppointmentEdit.xaml.cs">
|
||||
<DependentUpon>AppointmentEdit.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\TimeTable\DayViewPageItem.cs" />
|
||||
<Compile Include="Pages\TimeTable\TimeTable.cs" />
|
||||
<Compile Include="Pages\TimeTable\TimeTableDay.xaml.cs">
|
||||
<DependentUpon>TimeTableDay.xaml</DependentUpon>
|
||||
@@ -151,6 +154,8 @@
|
||||
<Compile Include="Pages\TimeTable\TimeTableWeek.xaml.cs">
|
||||
<DependentUpon>TimeTableWeek.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\TimeTable\WeekViewPageItem.cs" />
|
||||
<Compile Include="Utility\DoubleNaNConverter.cs" />
|
||||
<Compile Include="Utility\ICalObject.cs" />
|
||||
<Compile Include="Utility\ICSClasses.cs" />
|
||||
<Compile Include="Utility\ICSManager.cs" />
|
||||
@@ -236,6 +241,7 @@
|
||||
<Compile Include="Utility\BackgroundTasks.cs" />
|
||||
<Compile Include="Utility\BoolToVisibilityConverter.cs" />
|
||||
<Compile Include="Utility\FrameworkAnimator.cs" />
|
||||
<Compile Include="Utility\IdToPlaceConverter.cs" />
|
||||
<Compile Include="Utility\ListFiller.cs" />
|
||||
<Compile Include="Utility\Lui\Button\AddButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\AddPersonButton.cs" />
|
||||
@@ -247,6 +253,12 @@
|
||||
<DependentUpon>WeekViewPivotHeader.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\Lui\ListBoxFixed.cs" />
|
||||
<Compile Include="Utility\Lui\Templates\AppointmentCanvas.xaml.cs">
|
||||
<DependentUpon>AppointmentCanvas.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\Lui\MultiValueTextBlock.xaml.cs">
|
||||
<DependentUpon>MultiValueTextBlock.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\Lui\Templates\WeekView.xaml.cs">
|
||||
<DependentUpon>WeekView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -254,6 +266,7 @@
|
||||
<DependentUpon>WeekViewDay.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\Lui\Tiles\TileCreator.cs" />
|
||||
<Compile Include="Utility\MealIdToPriceConverter.cs" />
|
||||
<Compile Include="Utility\NDEF\BTUTagMessage.cs" />
|
||||
<Compile Include="Pages\Dev\NFC.xaml.cs">
|
||||
<DependentUpon>NFC.xaml</DependentUpon>
|
||||
@@ -281,8 +294,6 @@
|
||||
<Compile Include="Model\Lecture\LectureWp8List.cs" />
|
||||
<Compile Include="Model\Lecture\LecturePageModel.cs" />
|
||||
<Compile Include="Model\MainModel.cs" />
|
||||
<Compile Include="Model\Openinghours\OpeninghoursInstitutionWp8Model.cs" />
|
||||
<Compile Include="Model\Openinghours\OpeninghoursWp8Model.cs" />
|
||||
<Compile Include="Model\XmlModel.cs" />
|
||||
<Compile Include="Pages\Campusmap\CampusMapPage.xaml.cs">
|
||||
<DependentUpon>CampusMapPage.xaml</DependentUpon>
|
||||
@@ -531,6 +542,11 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Utility\Lui\Templates\AppointmentCanvas.xaml"/>
|
||||
<Page Include="Utility\Lui\MultiValueTextBlock.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Utility\Lui\Templates\WeekView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -13,12 +13,19 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWPortalLib8.Model.Mensa;
|
||||
using CampusAppWPortalLib8.Model;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWPortalLib8.Model.Settings;
|
||||
|
||||
/// <summary> This Class is for MensaFeeds. </summary>
|
||||
/// <remarks> Stubbfel, 14.10.2013. </remarks>
|
||||
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWPortalLib8.Model.Mensa.MenuWeekModel}"/>
|
||||
public abstract class MensaFeed : XmlModel<MenuWeekModel>
|
||||
{
|
||||
#region Member
|
||||
/// <summary> The price feed. </summary>
|
||||
private PriceFeed priceFeed = null;
|
||||
|
||||
#endregion
|
||||
#region Constructor
|
||||
|
||||
/// <summary> Initializes a new instance of the <see cref="MensaFeed" /> class. </summary>
|
||||
@@ -31,6 +38,11 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
|
||||
this.priceFeed = new PriceFeed();
|
||||
this.priceFeed.OnLoaded += this.PriceFeedIsReady;
|
||||
this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
|
||||
this.priceFeed.LoadData();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -41,6 +53,10 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
/// <value> The title. </value>
|
||||
public string Title { get; protected set; }
|
||||
|
||||
/// <summary> Gets the title. </summary>
|
||||
/// <value> The title. </value>
|
||||
public Campus Campus { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
@@ -119,6 +135,79 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Data.IValueConverter.Convert(object,Type,object,System.Globalization.CultureInfo)"/>
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
int intVal = -1;
|
||||
int intParam = -1;
|
||||
|
||||
if (value is int)
|
||||
{
|
||||
intVal = (int)value;
|
||||
}
|
||||
else if (value is string)
|
||||
{
|
||||
intVal = int.Parse((string)value);
|
||||
}
|
||||
|
||||
if (parameter is int)
|
||||
{
|
||||
intParam = (int)parameter;
|
||||
}
|
||||
else if (parameter is string)
|
||||
{
|
||||
intParam = int.Parse((string)parameter);
|
||||
}
|
||||
|
||||
if ((intVal >= 0) && (intParam >= 0))
|
||||
{
|
||||
if (this.priceFeed != null && this.priceFeed.Model != null)
|
||||
{
|
||||
PriceMealModel model = this.priceFeed.Model.GetCanteen(intParam).GetPriceMealModel(intVal);
|
||||
retValue = AppResources.Students + ": " + model.PriceStudentStr + " € " + AppResources.Employees + ": " + model.PriceEmployeeStr + " € " + AppResources.Guests + ": " + model.PriceGuestStr + " €";
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Price feed is ready. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
private void PriceFeedIsReady()
|
||||
{
|
||||
this.priceFeed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary> Sets the prices. </summary>
|
||||
/// <remarks> Stubbfel, 18.11.2013. </remarks>
|
||||
public void SetPrices()
|
||||
{
|
||||
if (this.Model == null || this.Model.Menus == null || this.priceFeed == null || this.priceFeed.Model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(MenuModel menu in this.Model.Menus) {
|
||||
foreach (MealModel meal in menu.Meals)
|
||||
{
|
||||
PriceMealModel model = this.priceFeed.Model.GetCanteen(this.Campus).GetPriceMealModel(meal.MealId);
|
||||
meal.Price = AppResources.Students + ": " + model.PriceStudentStr + " € " + AppResources.Employees + ": " + model.PriceEmployeeStr + " € " + AppResources.Guests + ": " + model.PriceGuestStr + " €";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary> Price feed is failed. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
private void PriceFeedIsFailed()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
: base(Constants.FileMensa_Shedule_CBMain, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBMain)
|
||||
{
|
||||
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_CBMain;
|
||||
this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
: base(Constants.FileMensa_Shedule_CBNorth, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBNorth)
|
||||
{
|
||||
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_CBNorth;
|
||||
this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.CB_NORTH;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
: base(Constants.FileMensa_Shedule_CBSouth, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBSouth)
|
||||
{
|
||||
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_CBSouth;
|
||||
this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.CB_SOUTH;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
|
||||
: base(Constants.FileMensa_Shedule_SBFMain, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_SBFMain)
|
||||
{
|
||||
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_SFBMain;
|
||||
this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.SFB_MAIN;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
82
CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
Normal file
82
CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="PriceFeed.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>13.11.2013</date>
|
||||
// <summary>Implements the price feed class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.Mensa
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWPortalLib8.Model.Mensa;
|
||||
using CampusAppWPortalLib8.Model;
|
||||
|
||||
/// <summary> A price feed. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWPortalLib8.Model.Mensa.PriceModel}"/>
|
||||
public class PriceFeed : XmlModel<PriceModel>
|
||||
{
|
||||
/// <summary> Initializes a new instance of the PriceFeed class. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
public PriceFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileMensaPrice, Constants.UrlMensaPrice)
|
||||
{
|
||||
this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
}
|
||||
|
||||
/// <summary> Check is model up to date. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
private bool CheckIsModelUpToDate(PriceModel model)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Check is file up to date. </summary>
|
||||
/// <remarks> Fiedler, 13.11.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(PriceModel model, FileInfo fileInfo)
|
||||
{
|
||||
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.CheckIsUpToDate(fileInfo.LastWriteTime);
|
||||
}
|
||||
|
||||
/// <summary> Check is up to date. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="lastModified"> The last modified Date/Time. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
bool retValue = false;
|
||||
TimeSpan diff = DateTime.Now.Subtract(lastModified);
|
||||
|
||||
|
||||
if (diff.TotalDays < 7)
|
||||
{
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,15 +11,15 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
using System;
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Openinghours;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWPortalLib8.Model;
|
||||
using CampusAppWPortalLib8.Model.Openinghours;
|
||||
|
||||
/// <summary> This Class is for MesaFeeds. </summary>
|
||||
/// <remarks> fiedlchr, 14.10.2013. </remarks>
|
||||
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWP8.Model.Openinghours.OpeninghoursWp8Model}"/>
|
||||
public class OpeninghoursFeed : XmlModel<OpeninghoursWp8Model>
|
||||
public class OpeninghoursFeed : XmlModel<OpeninghoursModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
/// <remarks> fiedlchr, 14.10.2013. </remarks>
|
||||
/// <param name="model"> reference of the FeedModel. </param>
|
||||
/// <returns> true, if model is up-to-date, otherwise false. </returns>
|
||||
private bool CheckIsModelUpToDate(OpeninghoursWp8Model model)
|
||||
private bool CheckIsModelUpToDate(OpeninghoursModel model)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
/// <param name="model"> reference of the FeedModel. </param>
|
||||
/// <param name="info"> info about the file. </param>
|
||||
/// <returns> true, if file is up-to-date, otherwise false. </returns>
|
||||
private bool CheckIsFileUpToDateOnLoad(OpeninghoursWp8Model model, FileInfo info)
|
||||
private bool CheckIsFileUpToDateOnLoad(OpeninghoursModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
/// <param name="model"> reference of the FeedModel. </param>
|
||||
/// <param name="info"> info about the file. </param>
|
||||
/// <returns> true, if file is up-to-date, otherwise false. </returns>
|
||||
private bool CheckIsFileUpToDateOnSave(OpeninghoursWp8Model model, FileInfo info)
|
||||
private bool CheckIsFileUpToDateOnSave(OpeninghoursModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
|
||||
171
CampusAppWP8/CampusAppWP8/Feed/TimeTable/AppointmentFeed.cs
Normal file
171
CampusAppWP8/CampusAppWP8/Feed/TimeTable/AppointmentFeed.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="AppointmentFeed.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>06.11.2013</date>
|
||||
// <summary>Implements the appointment feed class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWPortalLib8.Model;
|
||||
|
||||
/// <summary> An appointment feed. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWP8.Model.TimeTable.AppointmentListModel}"/>
|
||||
public class AppointmentFeed : XmlModel<AppointmentListModel>
|
||||
{
|
||||
private TimeSpan span = TimeSpan.Zero;
|
||||
|
||||
/// <summary> Initializes a new instance of the AppointmentFeed class. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="autoLoad"> (Optional) the automatic load. </param>
|
||||
public AppointmentFeed(bool autoLoad = true)
|
||||
: base(ModelType.File, Constants.FileAppointments_Name)
|
||||
{
|
||||
this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
this.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
public AppointmentFeed(TimeSpan span, bool autoLoad = true)
|
||||
: base(ModelType.File, Constants.FileAppointments_Name)
|
||||
{
|
||||
this.span = span;
|
||||
|
||||
this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
this.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Check is model up to date. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
private bool CheckIsModelUpToDate(AppointmentListModel model)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Check is file up to date on load. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="info"> The information. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
private bool CheckIsFileUpToDateOnLoad(AppointmentListModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Check is file up to date on save. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="info"> The information. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
private bool CheckIsFileUpToDateOnSave(AppointmentListModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((info == null)
|
||||
|| (info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
if (model != null && model.HasChanged(true))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Deserialize model. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="modelData"> Information describing the model. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
protected override bool DeserializeModel(byte[] modelData)
|
||||
{
|
||||
if (this.Model == null)
|
||||
{
|
||||
this.Model = new AppointmentListModel();
|
||||
}
|
||||
|
||||
string temp = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
|
||||
string[] appStr = Regex.Split(temp, "</appointment>");
|
||||
|
||||
for (int i = 0; i < appStr.Length; i++)
|
||||
{
|
||||
if (appStr[i].Length > 0)
|
||||
{
|
||||
appStr[i] = appStr[i].Replace("<appointment>", string.Empty);
|
||||
|
||||
AppointmentModel newAppModel = new AppointmentModel(appStr[i]);
|
||||
|
||||
if (this.span.Equals(TimeSpan.Zero))
|
||||
{
|
||||
this.Model.Appointments.Add(newAppModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newAppModel.IsInRange(DateTime.Today, this.span))
|
||||
{
|
||||
this.Model.Appointments.Add(newAppModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Gets the serialize model. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <returns> A byte[]. </returns>
|
||||
protected override byte[] SerializeModel()
|
||||
{
|
||||
List<byte> retValue = new List<byte>();
|
||||
|
||||
if (this.Model != null)
|
||||
{
|
||||
for (int i = 0; i < this.Model.Appointments.Count; i++)
|
||||
{
|
||||
retValue.AddRange(Encoding.UTF8.GetBytes("<appointment>"));
|
||||
retValue.AddRange(ICSManager.ExportToICSByte(this.Model.Appointments[i].CalendarObj));
|
||||
retValue.AddRange(Encoding.UTF8.GetBytes("</appointment>"));
|
||||
}
|
||||
}
|
||||
|
||||
return retValue.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="OpeninghoursInstitutionWp8Model.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.Openinghours
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menu
|
||||
/// </summary>
|
||||
public class OpeninghoursInstitutionWp8Model : CampusAppWPortalLib8.Model.Openinghours.OpeninghoursInstitutionModel
|
||||
{
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the monday TextBlock.
|
||||
/// </summary>
|
||||
public Visibility VisibleMonday
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Monday == string.Empty) || (this.Monday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the tuesday TextBlock.
|
||||
/// </summary>
|
||||
public Visibility VisibleTuesday
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Tuesday == string.Empty) || (this.Tuesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the wednesday TextBlock.
|
||||
/// </summary>
|
||||
public Visibility VisibleWednesday
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Wednesday == string.Empty) || (this.Wednesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the thursday TextBlock.
|
||||
/// </summary>
|
||||
public Visibility VisibleThursday
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Thursday == string.Empty) || (this.Thursday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the friday TextBlock.
|
||||
/// </summary>
|
||||
public Visibility VisibleFriday
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Friday == string.Empty) || (this.Friday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the saturday TextBlock.
|
||||
/// </summary>
|
||||
public Visibility VisibleSaturday
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Saturday == string.Empty) || (this.Saturday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the sunday TextBlock.
|
||||
/// </summary>
|
||||
public Visibility VisibleSunday
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Sunday == string.Empty) || (this.Sunday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the comment.
|
||||
/// </summary>
|
||||
public Visibility VisibleComment
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Comment == string.Empty) || (this.Comment.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the email address.
|
||||
/// </summary>
|
||||
public Visibility VisibleEMail
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.EMail == string.Empty) || (this.EMail.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the phone number.
|
||||
/// </summary>
|
||||
public Visibility VisiblePhone
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Phone == string.Empty) || (this.Phone.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the room.
|
||||
/// </summary>
|
||||
public Visibility VisibleRoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Room == string.Empty) || (this.Room.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility state of the building.
|
||||
/// </summary>
|
||||
public Visibility VisibleBuilding
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((this.Building == string.Empty) || (this.Building.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="OpeninghoursWp8Model.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.Openinghours
|
||||
{
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for opening hours.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class OpeninghoursWp8Model : CampusAppWPortalLib8.Model.Openinghours.OpeninghoursModel<OpeninghoursInstitutionWp8Model>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -24,17 +24,17 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
/// <summary>
|
||||
/// Model for appointments.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class AppointmentListModel
|
||||
{
|
||||
private ObservableCollection<AppointmentModel> appointmentList;
|
||||
private int hasChangedIndex = -1;
|
||||
private bool hasChanged = false;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="AppointmentModel" /> class. </summary>
|
||||
public AppointmentListModel()
|
||||
{
|
||||
this.appointmentList = new ObservableCollection<AppointmentModel>();
|
||||
this.appointmentList.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnCollectionChanged);
|
||||
this.appointmentList.CollectionChanged += this.OnCollectionChanged;
|
||||
}
|
||||
|
||||
// for testing
|
||||
@@ -50,7 +50,6 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ObservableCollection<AppointmentModel> Appointments
|
||||
{
|
||||
get
|
||||
@@ -60,7 +59,17 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
|
||||
set
|
||||
{
|
||||
if(this.appointmentList != null)
|
||||
{
|
||||
this.appointmentList.CollectionChanged -= this.OnCollectionChanged;
|
||||
}
|
||||
|
||||
this.appointmentList = value;
|
||||
|
||||
if(this.appointmentList != null)
|
||||
{
|
||||
this.appointmentList.CollectionChanged += this.OnCollectionChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +83,28 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasChanged(bool reset = false)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
retValue = this.hasChanged;
|
||||
|
||||
if(reset == true)
|
||||
{
|
||||
this.hasChanged = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
this.hasChangedIndex = e.NewStartingIndex;
|
||||
}
|
||||
|
||||
this.hasChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,35 +10,25 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Serialization;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Utility.ICSProperties;
|
||||
|
||||
/// <summary>
|
||||
/// Model for appointments.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
/// <summary> Model for appointments. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
public class AppointmentModel
|
||||
{
|
||||
/// <summary>The Visual object.</summary>
|
||||
//private Rectangle rect = null;
|
||||
//private Canvas canvas = null;
|
||||
//private double offsetY = 0;
|
||||
//private double height = 0;
|
||||
//private double width = 100;
|
||||
|
||||
/// <summary> The ical object. </summary>
|
||||
private ICalObject icalObj = null;
|
||||
//private ICalObject eventICalObj = null;
|
||||
|
||||
/// <summary> Executes the appointment click action. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="sender"> The sender. </param>
|
||||
public delegate void OnAppointmentClick(AppointmentModel sender);
|
||||
/// <summary> Occurs when On Click. </summary>
|
||||
public event OnAppointmentClick OnClick = null;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="AppointmentModel" /> class. </summary>
|
||||
|
||||
/// <summary> Initializes a new instance of the <see cref="AppointmentModel" /> class. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
public AppointmentModel()
|
||||
{
|
||||
this.icalObj = new ICalObject();
|
||||
@@ -53,18 +43,36 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
this.icalObj.Header = newBegin;
|
||||
this.icalObj.AddProperty(newVersion);
|
||||
this.icalObj.AddProperty(newProdID);
|
||||
|
||||
//this.rect = new Rectangle();
|
||||
//this.canvas = new Canvas();
|
||||
//this.canvas.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(this.OnCanvasClick);
|
||||
//this.canvas.SizeChanged += new SizeChangedEventHandler(this.OnCanvasSizeChanged);
|
||||
}
|
||||
|
||||
/// <summary> Initializes a new instance of the AppointmentModel class. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="icsData"> Information describing the ics. </param>
|
||||
public AppointmentModel(string icsData) : this()
|
||||
{
|
||||
this.icalObj = ICSManager.ImportFromICS(icsData);
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the calendar object. </summary>
|
||||
/// <value> The calendar object. </value>
|
||||
public ICalObject CalendarObj
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.icalObj;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.icalObj = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Is date. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="date"> The date Date/Time. </param>
|
||||
/// <param name="daySpan"> (Optional) the day span. </param>
|
||||
/// <returns> An int. </returns>
|
||||
public int IsDate(DateTime date, int daySpan = 0)
|
||||
{
|
||||
int retValue = -1;
|
||||
@@ -93,6 +101,27 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Query if 'date' is in range. </summary>
|
||||
/// <remarks> Fiedler, 11.11.2013. </remarks>
|
||||
/// <param name="date"> The date Date/Time. </param>
|
||||
/// <param name="span"> The span. </param>
|
||||
/// <returns> true if in range, false if not. </returns>
|
||||
public bool IsInRange(DateTime date, TimeSpan span)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
if ((this.Start.Subtract(date) <= span) || (this.End.Subtract(date) <= span))
|
||||
{
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Intersects the given model. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
public bool Intersect(AppointmentModel model)
|
||||
{
|
||||
bool retValue = false;
|
||||
@@ -113,6 +142,10 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Intersects the given model. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="modelList"> List of models. </param>
|
||||
/// <returns> true if it succeeds, false if it fails. </returns>
|
||||
public int Intersect(AppointmentModel[] modelList)
|
||||
{
|
||||
int retValue = -1;
|
||||
@@ -128,6 +161,10 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Intersect array. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="modelList"> List of models. </param>
|
||||
/// <returns> An int[]. </returns>
|
||||
public int[] IntersectArray(AppointmentModel[] modelList)
|
||||
{
|
||||
List<int> retValue = new List<int>();
|
||||
@@ -143,6 +180,9 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
return retValue.ToArray();
|
||||
}
|
||||
|
||||
/// <summary> Sets a value. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="value"> The value. </param>
|
||||
public void SetValue(object value)
|
||||
{
|
||||
ICalObject vevent = this.GetVEventObj(true);
|
||||
@@ -150,95 +190,70 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
vevent.AddProperty(value);
|
||||
}
|
||||
|
||||
public Canvas GetCanvas(double width, double hourSpacing, DateTime date)
|
||||
/// <summary> Gets a value. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="propertyName"> Name of the property. </param>
|
||||
/// <returns> The value. </returns>
|
||||
public object GetValue(string propertyName)
|
||||
{
|
||||
Canvas retValue = new Canvas();
|
||||
//retValue.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>()
|
||||
retValue.Tag = this;
|
||||
|
||||
if (this.End.Date.Equals(this.Start.Date) == false)
|
||||
{
|
||||
DateTime realDate = date.Date;
|
||||
|
||||
if (realDate.Equals(this.Start.Date))
|
||||
{
|
||||
TimeSpan span = this.Start.Date.AddDays(1).Subtract(this.Start);
|
||||
retValue.Height = span.TotalHours * hourSpacing;
|
||||
retValue.Margin = new Thickness(0, (hourSpacing * this.Start.TimeOfDay.TotalHours), 0, 0);
|
||||
}
|
||||
else if (realDate.Equals(this.End.Date))
|
||||
{
|
||||
retValue.Height = this.End.TimeOfDay.TotalHours * hourSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue.Height = hourSpacing * 24;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TimeSpan span = this.End.Subtract(this.Start);
|
||||
retValue.Height = span.TotalHours * hourSpacing;
|
||||
retValue.Margin = new Thickness(0, (hourSpacing * this.Start.TimeOfDay.TotalHours), 0, 0);
|
||||
}
|
||||
|
||||
retValue.Width = width;
|
||||
|
||||
this.CreateRect(retValue);
|
||||
this.CreateContent(retValue, hourSpacing);
|
||||
object retValue = this.GetVEventObj().GetProperty(propertyName);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private void CreateRect(Canvas can)
|
||||
/// <summary> Gets total hours. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <returns> The total hours. </returns>
|
||||
public double GetTotalHours()
|
||||
{
|
||||
// can.Children.Clear();
|
||||
|
||||
Rectangle rect = new Rectangle();
|
||||
rect.Width = can.Width;
|
||||
rect.Height = can.Height;
|
||||
|
||||
rect.StrokeThickness = 1;
|
||||
rect.Stroke = new SolidColorBrush(Colors.DarkGray);
|
||||
rect.Fill = new SolidColorBrush(Colors.Green);
|
||||
rect.RadiusX = 5;
|
||||
rect.RadiusY = 5;
|
||||
|
||||
can.Children.Add(rect);
|
||||
return this.End.Subtract(this.Start).TotalHours;
|
||||
}
|
||||
|
||||
private void CreateContent(Canvas can, double hourSpacing)
|
||||
/// <summary> Gets total hours. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="date"> The date Date/Time. </param>
|
||||
/// <returns> The total hours. </returns>
|
||||
public double GetTotalHours(DateTime date)
|
||||
{
|
||||
if (this.icalObj != null)
|
||||
double retValue = 0;
|
||||
|
||||
if (date.Date.Equals(this.Start.Date))
|
||||
{
|
||||
ICalObject eventObj = this.GetVEventObj();
|
||||
Summary title = eventObj.GetProperty(ICSTag.SUMMARY) as Summary;
|
||||
|
||||
TextBlock txtTitle = new TextBlock();
|
||||
txtTitle.FontSize = hourSpacing / 3;
|
||||
txtTitle.FontWeight = FontWeights.Bold;
|
||||
txtTitle.TextWrapping = TextWrapping.Wrap;
|
||||
txtTitle.Width = can.Width - 4.0;
|
||||
txtTitle.SetValue(Canvas.LeftProperty, 3.0);
|
||||
txtTitle.SetValue(Canvas.TopProperty, 3.0);
|
||||
|
||||
if (can.Height >= ((hourSpacing / 2)))
|
||||
if (this.End.Date.Equals(this.Start.Date))
|
||||
{
|
||||
txtTitle.Margin = new Thickness(0, -2, 0, 0);
|
||||
txtTitle.Text = title.Value;
|
||||
retValue = this.GetTotalHours();
|
||||
}
|
||||
else
|
||||
{
|
||||
txtTitle.Height = can.Height;
|
||||
txtTitle.VerticalAlignment = VerticalAlignment.Center;
|
||||
txtTitle.Margin = new Thickness(0, -10, 0, 0);
|
||||
txtTitle.Text = "...";
|
||||
retValue = date.Date.AddDays(1).Subtract(this.Start).TotalHours;
|
||||
}
|
||||
|
||||
can.Children.Add(txtTitle);
|
||||
}
|
||||
else if (date.Date.Equals(this.End.Date))
|
||||
{
|
||||
retValue = this.End.Subtract(date.Date).TotalHours;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.Start.Date <= date && date <= this.End.Date)
|
||||
{
|
||||
retValue = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Gets v event object. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <exception cref="NullReferenceException">
|
||||
/// Thrown when a value was unexpectedly null.
|
||||
/// </exception>
|
||||
/// <param name="create"> (Optional) the create. </param>
|
||||
/// <returns> The v event object. </returns>
|
||||
private ICalObject GetVEventObj(bool create = false)
|
||||
{
|
||||
ICalObject retValue = this.icalObj.GetProperty(ICSTag.VEVENT) as ICalObject;
|
||||
@@ -262,8 +277,12 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
|
||||
return retValue;
|
||||
}
|
||||
/*
|
||||
private void OnCanvasClick(object sender, EventArgs e)
|
||||
|
||||
/// <summary> Raises the canvas click event. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
public void OnCanvasClick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.OnClick != null)
|
||||
{
|
||||
@@ -271,12 +290,10 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCanvasSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
// ------------------------------------------------------
|
||||
|
||||
/// <summary> Gets the title. </summary>
|
||||
/// <value> The title. </value>
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
@@ -288,6 +305,8 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets the date. </summary>
|
||||
/// <value> The date. </value>
|
||||
public string Date
|
||||
{
|
||||
get
|
||||
@@ -314,6 +333,8 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets the location. </summary>
|
||||
/// <value> The location. </value>
|
||||
public string Location
|
||||
{
|
||||
get
|
||||
@@ -332,6 +353,8 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets the description. </summary>
|
||||
/// <value> The description. </value>
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
@@ -350,6 +373,8 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets the Date/Time of the start. </summary>
|
||||
/// <value> The start. </value>
|
||||
public DateTime Start
|
||||
{
|
||||
get
|
||||
@@ -366,6 +391,8 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets the Date/Time of the end. </summary>
|
||||
/// <value> The end. </value>
|
||||
public DateTime End
|
||||
{
|
||||
get
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
shell:SystemTray.IsVisible="True"
|
||||
x:Name="root">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
@@ -26,34 +27,43 @@
|
||||
<StackPanel Grid.Row="0">
|
||||
<header:DefaultHeader Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.CampusMapApp_RoomListTitle, Source={StaticResource LocalizedStrings}}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Margin="24,0,0,0">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LayerListPicker_Label, Source={StaticResource LocalizedStrings}}"/>
|
||||
<!-- Listpicket of courses -->
|
||||
<toolkit:ListPicker Name="Layer" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeader_Layer, Source={StaticResource LocalizedStrings}}" SelectionChanged="Layer_SelectionChanged" >
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
</StackPanel>
|
||||
<ViewportControl Name="VPC" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Bounds="0,-200,720,1200" Margin="24,12,12,0" >
|
||||
<Canvas Name="MapCanvas" Height="800" Width="480" VerticalAlignment="Top" HorizontalAlignment="Left" ManipulationDelta="MapCanvas_ManipulationDelta" ManipulationStarted="MapCanvas_ManipulationStarted" ManipulationCompleted="MapCanvas_ManipulationCompleted" Margin="-188,-200,-188,-200">
|
||||
<Image Name="imgMap" Height="{Binding ImageHeigh}" Width="{Binding ImageWidth}" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<Canvas.RenderTransform>
|
||||
<ScaleTransform/>
|
||||
</Canvas.RenderTransform>
|
||||
</Canvas>
|
||||
</ViewportControl>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="{Binding Path=LocalizedResources.LayerListPicker_Label, Source={StaticResource LocalizedStrings}}" Margin="24,0,24,0"/>
|
||||
<TextBlock x:Name="LayerTag" Grid.Column="1" Text="" HorizontalAlignment="Center" />
|
||||
</Grid>
|
||||
<Canvas Grid.Row="2" x:Name="MainCanvas" Margin="12">
|
||||
<ViewportControl Name="VPC" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Bounds="0,-200,720,1200" Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=MainCanvas, Mode=OneWay}">
|
||||
<Canvas Name="MapCanvas" Height="800" Width="480" VerticalAlignment="Top" HorizontalAlignment="Left" ManipulationDelta="MapCanvas_ManipulationDelta" ManipulationStarted="MapCanvas_ManipulationStarted" ManipulationCompleted="MapCanvas_ManipulationCompleted" Margin="-188,-200,-188,-200">
|
||||
<Image Name="imgMap" Height="{Binding ImageHeigh}" Width="{Binding ImageWidth}" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<Canvas.RenderTransform>
|
||||
<ScaleTransform/>
|
||||
</Canvas.RenderTransform>
|
||||
</Canvas>
|
||||
</ViewportControl>
|
||||
|
||||
<Grid x:Name="BtnGrid" Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay}" Height="60">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Grid.Column="0" BorderThickness="2" BorderBrush="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<TextBlock Text="ZoomIn" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}" Tap="ZoomIn_Tap"/>
|
||||
</Border>
|
||||
<Border Grid.Column="1" BorderThickness="2" BorderBrush="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<TextBlock Text="ZoomOut" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}" Tap="ZoomOut_Tap"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" />
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -8,6 +8,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Campusmap
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
@@ -23,6 +24,7 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
using CampusAppWPortalLib8.Model.Campusmap.Pin;
|
||||
using CampusAppWPortalLib8.Model.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWPortalLib8.Model.GeoDb;
|
||||
|
||||
/// <summary> Class of the RoomListPage. </summary>
|
||||
@@ -49,8 +51,7 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
/// <summary> The offset point. </summary>
|
||||
private MapPoint offsetPoint;
|
||||
|
||||
/// <summary> The layer list picker. </summary>
|
||||
private ListPickerItemListModel layerListPicker;
|
||||
private string selectedLayer = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -65,6 +66,20 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
|
||||
#endregion
|
||||
|
||||
private string SelectedLayer
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.selectedLayer;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.selectedLayer = value;
|
||||
this.LayerTag.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
@@ -122,12 +137,12 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
string layerKey = this.building.GetLayerKey(NavigationContext.QueryString[Constants.ParamRoomId]);
|
||||
if (layerKey != null)
|
||||
{
|
||||
this.Layer.SelectedIndex = this.layerListPicker.GetIndexOrDefault(layerKey);
|
||||
this.SelectedLayer = layerKey;
|
||||
this.ShowCurrentRoom(NavigationContext.QueryString[Constants.ParamRoomId]);
|
||||
}
|
||||
}
|
||||
|
||||
this.ShowLayerPlaces(((ListPickerItemModel)this.Layer.SelectedItem).Value);
|
||||
this.ShowLayerPlaces((this.selectedLayer.Length > 0) ? this.selectedLayer : (this.ApplicationBar.MenuItems[0] as ApplicationBarMenuItem).Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,14 +284,19 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
/// <remarks> Stubbfel, 14.10.2013. </remarks>
|
||||
private void CreateLayerListPicker()
|
||||
{
|
||||
this.layerListPicker = new ListPickerItemListModel();
|
||||
this.ApplicationBar.MenuItems.Clear();
|
||||
|
||||
foreach (string layername in this.building.Layers.Keys)
|
||||
{
|
||||
this.layerListPicker.AddItem(layername, layername);
|
||||
ApplicationBarMenuItem newMenuItem = new ApplicationBarMenuItem(layername);
|
||||
newMenuItem.Click += this.OnMenuItemClicked;
|
||||
this.ApplicationBar.MenuItems.Add(newMenuItem);
|
||||
}
|
||||
|
||||
this.Layer.ItemsSource = this.layerListPicker.List;
|
||||
if (this.ApplicationBar.MenuItems.Count > 0)
|
||||
{
|
||||
this.SelectedLayer = (this.ApplicationBar.MenuItems[0] as ApplicationBarMenuItem).Text;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Shows the layer places. </summary>
|
||||
@@ -360,13 +380,13 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
Canvas.SetZIndex(this.imgMap, 0);
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by Layer for selection changed events. </summary>
|
||||
/// <remarks> Stubbfel, 14.10.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Selection changed event information. </param>
|
||||
private void Layer_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
private void OnMenuItemClicked(object sender, System.EventArgs e)
|
||||
{
|
||||
this.ShowLayerPlaces(((ListPickerItemModel)this.Layer.SelectedItem).Value);
|
||||
if (this.SelectedLayer.Equals((sender as ApplicationBarMenuItem).Text) == false)
|
||||
{
|
||||
this.SelectedLayer = (sender as ApplicationBarMenuItem).Text;
|
||||
this.ShowLayerPlaces((sender as ApplicationBarMenuItem).Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Clears the map described by removeTags. </summary>
|
||||
@@ -400,6 +420,28 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary> Event handler. Called by ZoomIn for tap events. </summary>
|
||||
/// <remarks> Fiedler, 15.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Gesture event information. </param>
|
||||
private void ZoomIn_Tap(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
//throw new NotImplementedException("TODO");
|
||||
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX *= 1.5;
|
||||
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY *= 1.5;
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by ZoomOut for tap events. </summary>
|
||||
/// <remarks> Fiedler, 15.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Gesture event information. </param>
|
||||
private void ZoomOut_Tap(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
//throw new NotImplementedException("TODO");
|
||||
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX /= 1.5;
|
||||
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY /= 1.5;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,18 @@
|
||||
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"
|
||||
xmlns:lu="clr-namespace:CampusAppWP8.Utility.Lui"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page"
|
||||
xmlns:utility="clr-namespace:CampusAppWP8.Utility"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
shell:SystemTray.IsVisible="True"
|
||||
x:Name="root">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
@@ -25,7 +29,7 @@
|
||||
<StackPanel Grid.Row="0">
|
||||
<header:DefaultHeader Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.LocalizedResources.MensaApp_Title, Source={StaticResource LocalizedStrings}}"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot Grid.Row="1" Name="MensaPivot">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
@@ -44,18 +48,26 @@
|
||||
<DataTemplate>
|
||||
<Border Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0" Margin="0,0,0,12" MinWidth="100">
|
||||
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
|
||||
<TextBlock Text=" : "/>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel HorizontalAlignment="Left" Grid.Column="0">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,12" MinWidth="100">
|
||||
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<Image HorizontalAlignment="Left" Source="{Binding IconUrl}" Width="100" Margin="-12,-25,0,-21"></Image>
|
||||
</StackPanel>
|
||||
<Image HorizontalAlignment="Left" Source="{Binding IconUrl}" Width="100" Margin="-12,-25,0,-21"></Image>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
|
||||
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding Price}" TextWrapping="Wrap" Grid.Row="1" FontSize="14" HorizontalAlignment="Left" Margin="0,10,0,0" TextAlignment="Left" />
|
||||
</Grid>
|
||||
<toolkit:ContextMenuService.ContextMenu>
|
||||
<toolkit:ContextMenu>
|
||||
@@ -79,6 +91,9 @@
|
||||
<shell:ApplicationBarMenuItem Text="Campus1" Click="ApplicationBarMenuItem_Click"/>
|
||||
<shell:ApplicationBarMenuItem Text="Campus2" Click="ApplicationBarMenuItem2_Click"/>
|
||||
<shell:ApplicationBarMenuItem Text="Campus3" Click="ApplicationBarMenuItem3_Click"/>
|
||||
<shell:ApplicationBarMenuItem Text="Tagesplan kopieren" Click="CopyDay"/>
|
||||
<shell:ApplicationBarMenuItem Text="Wochenplan kopieren" Click="CopyWeek"/>
|
||||
|
||||
</shell:ApplicationBar.MenuItems>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
|
||||
@@ -48,6 +48,9 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <summary> Flag for forcing webLoad. </summary>
|
||||
private bool forceLoad = false;
|
||||
|
||||
/// <summary> Identifier for the location. </summary>
|
||||
public int locationID = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -56,10 +59,14 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <remarks> Stubbfel, 15.10.2013. </remarks>
|
||||
public MensaPage()
|
||||
{
|
||||
this.locationID = 0;
|
||||
|
||||
this.InitializeComponent();
|
||||
ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem2 = ApplicationBar.MenuItems[1] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem3 = ApplicationBar.MenuItems[2] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem4 = ApplicationBar.MenuItems[3] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem5 = ApplicationBar.MenuItems[4] as ApplicationBarMenuItem;
|
||||
|
||||
if (menuItem1 != null)
|
||||
{
|
||||
@@ -76,11 +83,36 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
menuItem3.Text = CampusAppWPortalLib8.Resources.AppResources.Campus_SFBMain;
|
||||
}
|
||||
|
||||
if (menuItem4 != null)
|
||||
{
|
||||
menuItem4.Text = AppResources.MensaApp_Dayplan + " " + AppResources.Copy;
|
||||
}
|
||||
|
||||
if (menuItem5 != null)
|
||||
{
|
||||
menuItem5.Text = AppResources.MensaApp_Weekplan + " " + AppResources.Copy;
|
||||
}
|
||||
|
||||
this.DefHeader.ProgressVisibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary> Gets or sets the identifier of the location. </summary>
|
||||
/// <value> The identifier of the location. </value>
|
||||
public int LocationID
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.locationID;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.locationID = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
@@ -165,12 +197,12 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
this.InitializeFeed(mensaCampus);
|
||||
}
|
||||
}
|
||||
|
||||
/* this.campusApi = new CampusSpsApi();
|
||||
this.campusApi.OnLoaded += new SpsApi.OnIO(this.SpsApiIsReady);
|
||||
this.campusApi.OnFailedLoad += new SpsApi.OnFailed(this.SpsApiIsFail);
|
||||
this.campusApi.SetupCurrentCampusRequest();
|
||||
this.campusApi.LoadData();*/
|
||||
|
||||
/* this.campusApi = new CampusSpsApi();
|
||||
this.campusApi.OnLoaded += new SpsApi.OnIO(this.SpsApiIsReady);
|
||||
this.campusApi.OnFailedLoad += new SpsApi.OnFailed(this.SpsApiIsFail);
|
||||
this.campusApi.SetupCurrentCampusRequest();
|
||||
this.campusApi.LoadData();*/
|
||||
}
|
||||
|
||||
/// <summary> Method initialize the Feed depends of a campus. </summary>
|
||||
@@ -214,6 +246,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <remarks> Stubbfel, 15.10.2013. </remarks>
|
||||
private void FeedIsReady()
|
||||
{
|
||||
this.feed.SetPrices();
|
||||
this.SetupMensaPivot();
|
||||
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
|
||||
}
|
||||
@@ -341,6 +374,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <param name="e"> Event information. </param>
|
||||
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.LocationID = 0;
|
||||
this.DefHeader.ProgressVisibility = Visibility.Visible;
|
||||
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN);
|
||||
}
|
||||
@@ -351,6 +385,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <param name="e"> Event information. </param>
|
||||
private void ApplicationBarMenuItem2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.LocationID = 1;
|
||||
this.DefHeader.ProgressVisibility = Visibility.Visible;
|
||||
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.CB_SOUTH);
|
||||
}
|
||||
@@ -361,6 +396,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <param name="e"> Event information. </param>
|
||||
private void ApplicationBarMenuItem3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.LocationID = 2;
|
||||
this.DefHeader.ProgressVisibility = Visibility.Visible;
|
||||
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.SFB_MAIN);
|
||||
}
|
||||
@@ -381,6 +417,80 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
Clipboard.SetText(copyText);
|
||||
}
|
||||
|
||||
/// <summary> Copies the menu of the selected day. </summary>
|
||||
/// <remarks> Stubbfel, 18.11.2013. </remarks>
|
||||
/// <param name="sender"> button object. </param>
|
||||
/// <param name="e"> Event information. </param>
|
||||
private void CopyDay(object sender, EventArgs e)
|
||||
{
|
||||
if (this.MensaPivot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int selecetdIndex = this.MensaPivot.SelectedIndex;
|
||||
|
||||
if (this.feed == null || this.feed.Model == null || selecetdIndex >= this.feed.Model.Menus.Count || selecetdIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MenuModel menu = this.feed.Model.Menus[selecetdIndex];
|
||||
string copyText = AppResources.MensaApp_Dayplan + " (" + menu.Day + " - " + menu.Date + ") - " + AppResources.Setting_UserCampus + " " + this.feed.Title + " :";
|
||||
copyText = Wp8StringManager.AddNewLine(copyText);
|
||||
|
||||
foreach (MealModel meal in menu.Meals)
|
||||
{
|
||||
copyText += meal.MealName + ": " + meal.MealDesc;
|
||||
copyText = Wp8StringManager.AddNewLine(copyText);
|
||||
}
|
||||
|
||||
|
||||
Clipboard.SetText(copyText);
|
||||
}
|
||||
|
||||
/// <summary> Copies all meals from the week. </summary>
|
||||
/// <remarks> Stubbfel, 18.11.2013. </remarks>
|
||||
/// <param name="sender"> button object. </param>
|
||||
/// <param name="e"> Event information. </param>
|
||||
private void CopyWeek(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (this.MensaPivot == null || this.feed == null || this.feed.Model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string startDate = null;
|
||||
string endDate = null;
|
||||
|
||||
string copyText = string.Empty;
|
||||
foreach (MenuModel menu in this.feed.Model.Menus)
|
||||
{
|
||||
if (startDate == null)
|
||||
{
|
||||
startDate = menu.Date;
|
||||
}
|
||||
endDate = menu.Date;
|
||||
|
||||
copyText += menu.Day + " (" + menu.Date + "):";
|
||||
copyText = Wp8StringManager.AddNewLine(copyText);
|
||||
|
||||
foreach (MealModel meal in menu.Meals)
|
||||
{
|
||||
copyText += meal.MealName + ": " + meal.MealDesc;
|
||||
copyText = Wp8StringManager.AddNewLine(copyText);
|
||||
}
|
||||
copyText = Wp8StringManager.AddNewLine(copyText);
|
||||
|
||||
}
|
||||
|
||||
string headline = AppResources.MensaApp_Weekplan + " (" + startDate + " - " + endDate + ") - " + AppResources.Setting_UserCampus + " " + this.feed.Title + " :";
|
||||
headline = Wp8StringManager.AddNewLine(headline);
|
||||
|
||||
Clipboard.SetText(headline + copyText);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
|
||||
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
|
||||
xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page"
|
||||
xmlns:utility="clr-namespace:CampusAppWP8.Utility"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
@@ -16,6 +17,11 @@
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<page:PortraitLandscapePage.Resources>
|
||||
<utility:BoolToVisibilityConverter x:Key="VisConverter"/>
|
||||
<utility:IdToPlaceConverter x:Key="PlaceConverter"/>
|
||||
</page:PortraitLandscapePage.Resources>
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
@@ -27,105 +33,116 @@
|
||||
<header:DefaultHeader x:Name="DefHeader" Grid.Row="0" HeaderName="{Binding Path=LocalizedResources.OpenHoursApp_Title, Source={StaticResource LocalizedStrings}}"/>
|
||||
|
||||
<!-- Content -->
|
||||
<ListBox x:Name="InstitutionPanel" Grid.Row="1" SelectionMode="Single" SelectionChanged="InstitutionPanel_SelectionChanged" Margin="24,0,12,0">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<phone:Pivot x:Name="ThePivot" Grid.Row="1">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
|
||||
<StackPanel>
|
||||
<lui:ToggleButton Content="{Binding Title}" ToggleContentTag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}"/>
|
||||
<StackPanel Visibility="Collapsed" Tag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!--day-->
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<!--time-->
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<!--monday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--tuesday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--wednesday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--thursday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--friday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--saturday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--sunday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--row 0 monday-->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Monday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleMonday}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Monday}" Visibility="{Binding VisibleMonday}" HorizontalAlignment="Left"/>
|
||||
<!--row 1 tuesday-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Tuesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleTuesday}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Tuesday}" Visibility="{Binding VisibleTuesday}" HorizontalAlignment="Left"/>
|
||||
<!--row 2 wednesday-->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Wednesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleWednesday}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Wednesday}" Visibility="{Binding VisibleWednesday}" HorizontalAlignment="Left"/>
|
||||
<!--row 3 thursday-->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Thursday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleThursday}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Thursday}" Visibility="{Binding VisibleThursday}" HorizontalAlignment="Left"/>
|
||||
<!--row 4 friday-->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Friday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleFriday}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Friday}" Visibility="{Binding VisibleFriday}" HorizontalAlignment="Left"/>
|
||||
<!--row 5 saturday-->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Saturday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSaturday}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding Saturday}" Visibility="{Binding VisibleSaturday}" HorizontalAlignment="Left"/>
|
||||
<!--row 6 sunday-->
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Sunday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSunday}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Sunday}" Visibility="{Binding VisibleSunday}" HorizontalAlignment="Left"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,12,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--building-->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Building, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleBuilding}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Building}" Visibility="{Binding VisibleBuilding}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
|
||||
<!--room-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Room, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleRoom}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Room}" Visibility="{Binding VisibleRoom}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
|
||||
</Grid>
|
||||
<!--hint text-->
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Hint, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleComment}" Padding="10,3,10,0" Margin="0,12,0,0" FontStyle="Italic"/>
|
||||
<TextBlock Text="{Binding Comment}" Visibility="{Binding VisibleComment}" TextWrapping="Wrap" Padding="10,3,10,0"/>
|
||||
<Grid Margin="6,6,6,6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--mail button-->
|
||||
<lui:EmailButton Grid.Column="0" EmailAddress="{Binding EMail}" Height="100" Visibility="{Binding VisibleEMail}" Padding="0" Margin="0"/>
|
||||
<!--phone button-->
|
||||
<lui:PhoneButton Grid.Column="1" Number="{Binding Phone}" DisplayName="{Binding Title}" Height="100" Visibility="{Binding VisiblePhone}" Padding="0" Margin="0"/>
|
||||
<!--location button -->
|
||||
<lui:GoToMapButton Grid.Column="2" SearchTerm="{Binding Building}" Height="100" Visibility="{Binding VisibleBuilding}" Padding="0" Margin="0" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Text="{Binding Path=LocationID, Mode=OneTime, Converter={StaticResource PlaceConverter}, ConverterParameter=Name}" Margin="0,-36,0,0"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox x:Name="InstitutionPanel" Grid.Row="1" SelectionMode="Single" SelectionChanged="InstitutionPanel_SelectionChanged" Margin="24,0,12,0" ItemsSource="{Binding Institutions}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
|
||||
<StackPanel>
|
||||
<lui:ToggleButton Content="{Binding Title}" ToggleContentTag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}"/>
|
||||
<StackPanel Visibility="Collapsed" Tag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!--day-->
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<!--time-->
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<!--monday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--tuesday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--wednesday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--thursday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--friday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--saturday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
<!--sunday-->
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--row 0 monday-->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Monday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleMonday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Monday}" Visibility="{Binding VisibleMonday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
|
||||
<!--row 1 tuesday-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Tuesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleTuesday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Tuesday}" Visibility="{Binding VisibleTuesday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
|
||||
<!--row 2 wednesday-->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Wednesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleWednesday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Wednesday}" Visibility="{Binding VisibleWednesday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
|
||||
<!--row 3 thursday-->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Thursday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleThursday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Thursday}" Visibility="{Binding VisibleThursday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
|
||||
<!--row 4 friday-->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Friday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleFriday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Friday}" Visibility="{Binding VisibleFriday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
|
||||
<!--row 5 saturday-->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Saturday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSaturday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding Saturday}" Visibility="{Binding VisibleSaturday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
|
||||
<!--row 6 sunday-->
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Sunday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSunday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Sunday}" Visibility="{Binding VisibleSunday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,12,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--building-->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Building, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleBuilding, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Building}" Visibility="{Binding VisibleBuilding, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
|
||||
<!--room-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Room, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleRoom, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Room}" Visibility="{Binding VisibleRoom, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
|
||||
</Grid>
|
||||
<!--hint text-->
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Hint, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleComment, Converter={StaticResource VisConverter}}" Padding="10,3,10,0" Margin="0,12,0,0" FontStyle="Italic"/>
|
||||
<TextBlock Text="{Binding Comment}" Visibility="{Binding VisibleComment, Converter={StaticResource VisConverter}}" TextWrapping="Wrap" Padding="10,3,10,0"/>
|
||||
<Grid Margin="6,6,6,6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--mail button-->
|
||||
<lui:EmailButton Grid.Column="0" EmailAddress="{Binding EMail}" Height="100" Visibility="{Binding VisibleEMail, Converter={StaticResource VisConverter}}" Padding="0" Margin="0"/>
|
||||
<!--phone button-->
|
||||
<lui:PhoneButton Grid.Column="1" Number="{Binding Phone}" DisplayName="{Binding Title}" Height="100" Visibility="{Binding VisiblePhone, Converter={StaticResource VisConverter}}" Padding="0" Margin="0"/>
|
||||
<!--location button -->
|
||||
<lui:GoToMapButton Grid.Column="2" SearchTerm="{Binding Building}" Height="100" Visibility="{Binding VisibleBuilding, Converter={StaticResource VisConverter}}" Padding="0" Margin="0" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
|
||||
@@ -9,38 +9,34 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.Openinghours;
|
||||
using CampusAppWP8.Model.Openinghours;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Utility.Lui.MessageBoxes;
|
||||
using CampusAppWP8.Utility.Lui.Page;
|
||||
using CampusAppWPortalLib8.Model.Openinghours;
|
||||
|
||||
/// <summary>
|
||||
/// Opening hours page.
|
||||
/// </summary>
|
||||
/// <summary> Opening hours page. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <seealso cref="T:CampusAppWP8.Utility.Lui.Page.PortraitLandscapePage"/>
|
||||
public partial class OpeninghoursPage : PortraitLandscapePage
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// Opening hours feed object.
|
||||
/// </summary>
|
||||
/// <summary> Opening hours feed object. </summary>
|
||||
private OpeninghoursFeed feed = null;
|
||||
|
||||
/// <summary>
|
||||
/// for checking if the instance is new or a tombstone.
|
||||
/// </summary>
|
||||
/// <summary> for checking if the instance is new or a tombstone. </summary>
|
||||
private bool isNewInstance = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OpeninghoursPage" /> class.
|
||||
/// </summary>
|
||||
/// <summary> Initializes a new instance of the <see cref="OpeninghoursPage" /> class. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
public OpeninghoursPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
@@ -52,7 +48,7 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
this.feed.OnLoaded += new OpeninghoursFeed.OnIO(this.FeedIsReady);
|
||||
this.feed.OnFailedWeb += new OpeninghoursFeed.OnFailed(this.FeedIsFailedWeb);
|
||||
this.feed.OnFailedFile += new OpeninghoursFeed.OnFailed(this.FeedIsFailedFile);
|
||||
this.feed.LoadData(Utilities.GetLoadModus<Model.Openinghours.OpeninghoursWp8Model>());
|
||||
this.feed.LoadData(Utilities.GetLoadModus<OpeninghoursModel>());
|
||||
}
|
||||
|
||||
this.isNewInstance = true;
|
||||
@@ -64,10 +60,9 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
|
||||
#region protected
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedTo method.
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
/// <summary> Override the OnNavigatedTo method. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <seealso cref="M:CampusAppWP8.Utility.Lui.Page.PortraitLandscapePage.OnNavigatedTo(NavigationEventArgs)"/>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
@@ -76,9 +71,9 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
{
|
||||
if ((this.feed == null) || (this.feed.Model == null))
|
||||
{
|
||||
OpeninghoursWp8Model tempModel = null;
|
||||
OpeninghoursModel tempModel = null;
|
||||
|
||||
if ((tempModel = App.LoadFromIsolatedStorage<OpeninghoursWp8Model>(Constants.IsolatedStorage_OpeninghoursModel)) != null)
|
||||
if ((tempModel = App.LoadFromIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel)) != null)
|
||||
{
|
||||
this.feed.Model = tempModel;
|
||||
this.FeedIsReady();
|
||||
@@ -89,20 +84,23 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedFrom method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
/// <summary> Override the OnNavigatedFrom method. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedFrom(NavigationEventArgs)"/>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
this.feed.SaveData();
|
||||
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
App.SaveToIsolatedStorage<OpeninghoursWp8Model>(Constants.IsolatedStorage_OpeninghoursModel, this.feed.Model);
|
||||
App.SaveToIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel, this.feed.Model);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the tap grid event. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="sender"> button object. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnTapGrid(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -113,55 +111,51 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Will be execute if the feed is ready.
|
||||
/// </summary>
|
||||
/// <summary> Will be execute if the feed is ready. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
private void FeedIsReady()
|
||||
{
|
||||
this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions;
|
||||
this.ThePivot.ItemsSource = this.feed.Model.Locations;
|
||||
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
|
||||
|
||||
this.feed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// On clicking the update button in the ApplicationBar. Force a data update from the web.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="sender"> button object. </param>
|
||||
/// <param name="e"> event args. </param>
|
||||
private void OpenHoursForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DefHeader.ProgressVisibility = Visibility.Visible;
|
||||
this.feed.ForceWebUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the feed is failed
|
||||
/// </summary>
|
||||
/// <summary> Method will be execute if the feed is failed. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
private void FeedIsFailedWeb()
|
||||
{
|
||||
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
|
||||
this.feed.ForceReadFile();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the feed is failed
|
||||
/// </summary>
|
||||
/// <summary> Method will be execute if the feed is failed. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
private void FeedIsFailedFile()
|
||||
{
|
||||
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
|
||||
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the selection is change in the listbox.
|
||||
/// </summary>
|
||||
/// <param name="sender">listbox object.</param>
|
||||
/// <param name="e">event args.</param>
|
||||
/// <summary> Method will be execute if the selection is change in the listbox. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="sender"> listbox object. </param>
|
||||
/// <param name="e"> event args. </param>
|
||||
private void InstitutionPanel_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
this.InstitutionPanel.SelectedIndex = -1;
|
||||
(sender as ListBox).SelectedIndex = -1;
|
||||
}
|
||||
|
||||
// private
|
||||
|
||||
@@ -276,6 +276,8 @@
|
||||
<shell:ApplicationBarMenuItem Text="Setting3" Click="ApplicationBarMenuItem3_Click"/>
|
||||
<shell:ApplicationBarMenuItem Text="Setting4" Click="ApplicationBarMenuItem4_Click"/>
|
||||
<shell:ApplicationBarMenuItem Text="Setting4" Click="ApplicationBarMenuItem5_Click"/>
|
||||
<shell:ApplicationBarMenuItem Text="Setting5" Click="ApplicationBarMenuItem_Click_1"/>
|
||||
<shell:ApplicationBarMenuItem Text="NFC" Click="ApplicationBarMenuItem_Click_2"/>
|
||||
</shell:ApplicationBar.MenuItems>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace CampusAppWP8.Pages
|
||||
using CampusAppWP8.Feed.Utility;
|
||||
using CampusAppWP8.File.Places;
|
||||
using CampusAppWP8.Model.Setting;
|
||||
using CampusAppWP8.Pages.TimeTable;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Utility.Lui.MessageBoxes;
|
||||
@@ -58,6 +59,7 @@ namespace CampusAppWP8.Pages
|
||||
ApplicationBarMenuItem menuItem3 = ApplicationBar.MenuItems[2] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem4 = ApplicationBar.MenuItems[3] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem5 = ApplicationBar.MenuItems[4] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem6 = ApplicationBar.MenuItems[5] as ApplicationBarMenuItem;
|
||||
|
||||
if (menuItem1 != null)
|
||||
{
|
||||
@@ -85,10 +87,22 @@ namespace CampusAppWP8.Pages
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
ApplicationBar.MenuItems.RemoveAt(ApplicationBar.MenuItems.Count - 1);
|
||||
ApplicationBar.MenuItems.RemoveAt(ApplicationBar.MenuItems.Count - 1);
|
||||
*/
|
||||
ApplicationBar.MenuItems.Remove(menuItem3);
|
||||
ApplicationBar.MenuItems.Remove(menuItem4);
|
||||
}
|
||||
|
||||
if (menuItem6 != null)
|
||||
{
|
||||
menuItem6.Text = AppResources.TimeTableApp_Title;
|
||||
}
|
||||
|
||||
TimeTable.TimeTable.InitFeed();
|
||||
|
||||
|
||||
if (!Settings.AppSetting.InitApp)
|
||||
{
|
||||
this.InitPlaceFile();
|
||||
@@ -307,7 +321,7 @@ namespace CampusAppWP8.Pages
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
Settings.AppSetting.GeoWatchEnable = true;
|
||||
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
|
||||
Thread thread = new Thread(new ThreadStart(this.PositionThread));
|
||||
thread.Start();
|
||||
}
|
||||
else
|
||||
@@ -316,6 +330,13 @@ namespace CampusAppWP8.Pages
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Position thread. </summary>
|
||||
/// <remarks> Stubbfel, 18.11.2013. </remarks>
|
||||
private void PositionThread()
|
||||
{
|
||||
Utilities.DetermineAndStoreCurrentPosition();
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by PintoStart for click events. </summary>
|
||||
/// <remarks> Stubbfel, 15.10.2013. </remarks>
|
||||
/// <param name="sender"> Caller of the function. </param>
|
||||
@@ -416,6 +437,8 @@ namespace CampusAppWP8.Pages
|
||||
}
|
||||
else
|
||||
{
|
||||
this.GoToAppointment(nfcContent);
|
||||
/* removed for testing
|
||||
if (AppSettings.BTUTagDefaultHandler.CampusMap == Settings.AppSetting.TagDefaultHandler)
|
||||
{
|
||||
// search for placeId
|
||||
@@ -432,6 +455,7 @@ namespace CampusAppWP8.Pages
|
||||
this.ShowBtuTagMessageBox();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);
|
||||
@@ -443,9 +467,27 @@ namespace CampusAppWP8.Pages
|
||||
private void GoToCampusMappage(string tagContent)
|
||||
{
|
||||
string pid = Wp8StringManager.FilterPlaceIdinNFCResultString(tagContent);
|
||||
string urlString = Constants.PathCampusmap_Campusmap;
|
||||
urlString += "?" + Constants.ParamModelMap_SearchTermAlias + "=" + pid;
|
||||
Uri url = new Uri(urlString as string, UriKind.Relative);
|
||||
string urlString = Constants.PathCampusmap_Campusmap + "?" + Constants.ParamModelMap_SearchTermAlias + "=" + pid;
|
||||
Uri url = new Uri(urlString, UriKind.Relative);
|
||||
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() => NavigationService.Navigate(url)));
|
||||
}
|
||||
else
|
||||
{
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Go to appointment. </summary>
|
||||
/// <remarks> Fiedler, 15.11.2013. </remarks>
|
||||
/// <param name="tagContent"> The tag content. </param>
|
||||
private void GoToAppointment(string tagContent)
|
||||
{
|
||||
string pid = Wp8StringManager.FilterPlaceIdinNFCResultString(tagContent);
|
||||
string urlStr = Constants.PathTimeTable_AppointmentEdit + "?" + Constants.ParamPID + "=" + pid;
|
||||
Uri url = new Uri(urlStr, UriKind.Relative);
|
||||
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
@@ -473,6 +515,18 @@ namespace CampusAppWP8.Pages
|
||||
|
||||
#endregion
|
||||
|
||||
private void ApplicationBarMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
Uri url = new Uri(Constants.PathTimeTable_Day, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void ApplicationBarMenuItem_Click_2(object sender, EventArgs e)
|
||||
{
|
||||
Uri url = new Uri("/Pages/Dev/NFC.xaml", UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
if (e.NavigationMode == NavigationMode.Back)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
this.DataContext = this.appModel;
|
||||
}
|
||||
else
|
||||
@@ -61,10 +61,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
int appointmentIndex = int.Parse(appointmentIndexStr);
|
||||
|
||||
// if the index is in the range of the array
|
||||
if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
|
||||
if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.Feed.Model.Appointments.Count()))
|
||||
{
|
||||
this.appModel = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
|
||||
this.DataContext = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
|
||||
this.appModel = TimeTable.Feed.Model.Appointments[appointmentIndex];
|
||||
this.DataContext = TimeTable.Feed.Model.Appointments[appointmentIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,9 +93,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
if (this.appModel != null)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
|
||||
string urlString = "/Pages/TimeTable/AppointmentEdit.xaml?" + Constants.Param_Appointment_Index + "=" + TimeTable.AppointmentsModel.Appointments.IndexOf(this.appModel);
|
||||
string urlString = "/Pages/TimeTable/AppointmentEdit.xaml?" + Constants.Param_Appointment_Index + "=" + TimeTable.Feed.Model.Appointments.IndexOf(this.appModel);
|
||||
|
||||
Uri url = new Uri(urlString, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
@@ -105,7 +105,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
private void OnClickDelete(object sender, EventArgs e)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.Remove(this.appModel);
|
||||
TimeTable.Feed.Model.Appointments.Remove(this.appModel);
|
||||
this.NavigationService.GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<phone:PhoneApplicationPage
|
||||
<page:PortraitLandscapePage
|
||||
x:Class="CampusAppWP8.Pages.TimeTable.AppointmentEdit"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -7,6 +7,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
@@ -166,8 +167,8 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<page:PortraitLandscapePage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
</page:PortraitLandscapePage.ApplicationBar>
|
||||
</page:PortraitLandscapePage>
|
||||
@@ -16,13 +16,17 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.File.Places;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Utility.ICSProperties;
|
||||
using CampusAppWP8.Utility.Lui.Page;
|
||||
|
||||
public partial class AppointmentEdit : PhoneApplicationPage
|
||||
public partial class AppointmentEdit : PortraitLandscapePage
|
||||
{
|
||||
private PlacesFile placeFile = null;
|
||||
|
||||
private readonly string[] DurationListText = new string[] { "15 Minuten", "30 Minuten", "1 Stunde", "90 Minuten", "2 Stunden", "Ganztägig", "Benutzerdefiniert" };
|
||||
private readonly string[] RepeatListText = new string[] { "Einmal", "Täglich", "Jeden Mo-Fr", "Wöchentlich", "Monatlich", "Jährlich" };
|
||||
private readonly string[] AccessClassListText = new string[] { "Öffentlich", "Privat", "Vertraulich" };
|
||||
@@ -41,6 +45,11 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
this.InCategories.ItemsSource = CategoriesListText;
|
||||
this.InPriority.ItemsSource = PriorityListText;
|
||||
|
||||
this.placeFile = new PlacesFile();
|
||||
this.placeFile.OnLoaded += this.PlaceFileIsReady;
|
||||
this.placeFile.OnFailedLoad += this.PlaceFileIsFailed;
|
||||
this.placeFile.LoadData();
|
||||
|
||||
ApplicationBarIconButton saveBtn = new ApplicationBarIconButton();
|
||||
saveBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
|
||||
saveBtn.Text = AppResources.Save;
|
||||
@@ -60,18 +69,20 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
string appointmentIndexStr = string.Empty;
|
||||
string pid = string.Empty;
|
||||
|
||||
// Navigate to the selected pivotitem
|
||||
|
||||
if (NavigationContext.QueryString.TryGetValue(Constants.Param_Appointment_Index, out appointmentIndexStr))
|
||||
{
|
||||
this.appointmentIndex = int.Parse(appointmentIndexStr);
|
||||
|
||||
// if the index is in the range of the array
|
||||
if ((this.appointmentIndex >= 0) && (this.appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
|
||||
if ((this.appointmentIndex >= 0) && (this.appointmentIndex < TimeTable.Feed.Model.Appointments.Count()))
|
||||
{
|
||||
this.HeadLine.Text = AppResources.Edit;
|
||||
//this.DataContext = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
|
||||
AppointmentModel tempModel = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
|
||||
AppointmentModel tempModel = TimeTable.Feed.Model.Appointments[this.appointmentIndex];
|
||||
|
||||
this.InTitle.Text = tempModel.Title;
|
||||
this.InLocation.Text = tempModel.Location;
|
||||
@@ -88,12 +99,51 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
MessageBox.Show("ERROR: appointment index out of range!!! (" + o + ")");
|
||||
}
|
||||
}
|
||||
else if(NavigationContext.QueryString.TryGetValue(Constants.ParamPID, out pid))
|
||||
{
|
||||
this.HeadLine.Text = AppResources.Creating;
|
||||
CampusAppWPortalLib8.Model.GeoDb.PlaceModel m = this.placeFile.Model.GetPlaceById(pid);
|
||||
|
||||
if (m != null)
|
||||
{
|
||||
CampusAppWPortalLib8.Model.GeoDb.PlaceModel mParent = this.placeFile.Model.GetPlaceById(m.ParentId);
|
||||
|
||||
string roomStr = m.GetInformationsValue(Constants.PisInformationName_Room);
|
||||
|
||||
if (mParent != null)
|
||||
{
|
||||
string buildingStr = mParent.GetInformationsValue(Constants.PisInformationName_ShortName);
|
||||
|
||||
if (roomStr != null)
|
||||
{
|
||||
if (buildingStr != null)
|
||||
{
|
||||
roomStr = roomStr.Replace(buildingStr, string.Empty);
|
||||
|
||||
this.InLocation.Text = buildingStr + ", " + roomStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.InLocation.Text = roomStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.HeadLine.Text = AppResources.Creating;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaceFileIsReady()
|
||||
{
|
||||
}
|
||||
|
||||
private void PlaceFileIsFailed()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnClickSaveBtn(object sender, EventArgs e)
|
||||
{
|
||||
AppointmentModel newItem = new AppointmentModel();
|
||||
@@ -229,10 +279,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
if (this.appointmentIndex >= 0)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.RemoveAt(this.appointmentIndex);
|
||||
TimeTable.Feed.Model.Appointments.RemoveAt(this.appointmentIndex);
|
||||
}
|
||||
|
||||
TimeTable.AppointmentsModel.Appointments.Add(newItem);
|
||||
TimeTable.Feed.Model.Appointments.Add(newItem);
|
||||
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
page.NavigationService.GoBack();
|
||||
|
||||
73
CampusAppWP8/CampusAppWP8/Pages/TimeTable/DayViewPageItem.cs
Normal file
73
CampusAppWP8/CampusAppWP8/Pages/TimeTable/DayViewPageItem.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Utility.Lui.Templates;
|
||||
|
||||
public class DayViewPageItem : INotifyPropertyChanged
|
||||
{
|
||||
private DateTime day;
|
||||
private WeekView weekView = null;
|
||||
private ObservableCollection<AppointmentModel> appointmentList = null;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public DayViewPageItem(DateTime day)
|
||||
{
|
||||
this.day = day;
|
||||
this.appointmentList = new ObservableCollection<AppointmentModel>();
|
||||
}
|
||||
|
||||
public DateTime Day
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.day;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.day = value;
|
||||
this.NotifyPropertyChanged("Day");
|
||||
}
|
||||
}
|
||||
|
||||
public WeekView View
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.weekView;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.weekView = value;
|
||||
this.NotifyPropertyChanged("View");
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<AppointmentModel> AppointmentList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.appointmentList;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.appointmentList = value;
|
||||
this.NotifyPropertyChanged("AppointmentList");
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyPropertyChanged(string info)
|
||||
{
|
||||
if (this.PropertyChanged != null)
|
||||
{
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(info));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,45 +8,93 @@
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Media;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Feed.TimeTable;
|
||||
|
||||
/// <summary> A time table. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <seealso cref="T:Microsoft.Phone.Controls.PhoneApplicationPage"/>
|
||||
public partial class TimeTable : PhoneApplicationPage
|
||||
{
|
||||
private static AppointmentListModel appList //= null;
|
||||
= new AppointmentListModel(new AppointmentModel[] {
|
||||
new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:ownCloud Calendar 0.6.3\r\nX-WR-CALNAME:Das is der Titel\r\nBEGIN:VEVENT\r\nCREATED;VALUE=DATE-TIME:20130827T113216Z\r\nUID:c9904ea73c\r\nLAST-MODIFIED;VALUE=DATE-TIME:20130827T113216Z\r\nDTSTAMP;VALUE=DATE-TIME:20130827T113216Z\r\nSUMMARY:Das is der Titel\r\nDTSTART;VALUE=DATE-TIME:20131002T113500Z\r\nDTEND;VALUE=DATE-TIME:20131002T212000Z\r\nCLASS:PUBLIC\r\nLOCATION:BTU Campus\r\nDESCRIPTION:For Outlook 2003, the behavior is peculiar. It can save the sa\r\n me calendar entry in both .ics and .vcs format, but it only read & displa\r\n y .vcs file correctly. It can read .ics file but it omits some fields and \r\n does not display it in calendar mode. My guess is that back then Microsoft\r\n wanted to provide .ics to be compatible with Mac's iCal but not quite com\r\n mitted to v2.0 yet.\r\nCATEGORIES:Projekte\r\nEND:VEVENT\r\nEND:VCALENDAR"),
|
||||
new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:http://www.example.com/calendarapplication/\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nUID:461092315540@example.com\r\nORGANIZER:MAILTO:alice@example.com\r\nLOCATION:Somewhere\r\nSUMMARY:Eine Kurzinfo\r\nDESCRIPTION:Beschreibung des Termines\r\nCLASS:PUBLIC\r\nDTSTART:20131002T110000Z\r\nDTEND:20131004T113000Z\r\nDTSTAMP:20131003T125900Z\r\nEND:VEVENT\r\nEND:VCALENDAR"),
|
||||
new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\nBEGIN:VEVENT\r\nUID:uid1@example.com\r\nDTSTAMP:19970714T170000Z\r\nORGANIZER;CN=John Doe:MAILTO:john.doe@example.com\r\nDTSTART:20131003T150000Z\r\nDTEND:20131003T170000Z\r\nSUMMARY:Bastille Day Party\r\nEND:VEVENT\r\nEND:VCALENDAR"),
|
||||
new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:1.0\r\nBEGIN:VEVENT\r\nCATEGORIES:MEETING\r\nSTATUS:TENTATIVE\r\nDTSTART:20130917T033000Z\r\nDTEND:20130917T043000Z\r\nSUMMARY:Your Proposal Review\r\nDESCRIPTION:Steve and John to review newest proposal material bla fsdfasfsdfsdfgsdafg sfdgfdsgf dsfg dsfgds fgds\r\nCLASS:PRIVATE\r\nEND:VEVENT\r\nEND:VCALENDAR"),
|
||||
new AppointmentModel("BEGIN:VCALENDAR\r\nPRODID:-//bobbin v0.1//NONSGML iCal Writer//EN\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nDTSTART:20130918T080000Z\r\nDTEND:20130918T110000Z\r\nDTSTAMP:20091130T213238Z\r\nUID:1285935469767a7c7c1a9b3f0df8003a@yoursever.com\r\nCREATED:20091130T213238Z\r\nDESCRIPTION:Example event 1\r\nLAST-MODIFIED:20091130T213238Z\r\nSEQUENCE:0\r\nSTATUS:CONFIRMED\r\nSUMMARY:Example event 1\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR"),
|
||||
new AppointmentModel("BEGIN:VCALENDAR\r\nPRODID:-//bobbin v0.1//NONSGML iCal Writer//EN\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nDTSTART:20130914T120000Z\r\nDTEND:20130914T140000Z\r\nDTSTAMP:20091130T213238Z\r\nUID:1285935469767a7c7c1a9b3f0df8003a@yoursever.com\r\nCREATED:20091130T213238Z\r\nDESCRIPTION:Example event 1\r\nLAST-MODIFIED:20091130T213238Z\r\nSEQUENCE:0\r\nSTATUS:CONFIRMED\r\nSUMMARY:Example event 1\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR")
|
||||
});
|
||||
/// <summary> The setting automatic scroll to hour. </summary>
|
||||
public static int Setting_AutoScrollToHour = 7;
|
||||
/// <summary> 0 - small, 1 - medium, 2 - large UNUSED ATM. </summary>
|
||||
public static int Setting_VisualScale = 0;
|
||||
/// <summary> The setting hour spacing. </summary>
|
||||
public static double Setting_Hour_Spacing = 40;
|
||||
/// <summary> Height of the setting view. </summary>
|
||||
public static double Setting_View_Height = Setting_Hour_Spacing * 24;
|
||||
/// <summary> Zero-based index of the setting maximum z coordinate. </summary>
|
||||
public static int Setting_Max_Z_Index = 10;
|
||||
/// <summary> The setting z coordinate spacing. </summary>
|
||||
public static double Setting_Z_Spacing = 10;
|
||||
/// <summary> List of colors of the setting priorities. </summary>
|
||||
public static SolidColorBrush[] Setting_Priority_Colors = new SolidColorBrush[]
|
||||
{
|
||||
new SolidColorBrush(Colors.Green),
|
||||
new SolidColorBrush(Colors.Orange),
|
||||
new SolidColorBrush(Colors.Blue),
|
||||
new SolidColorBrush(Colors.Brown),
|
||||
new SolidColorBrush(Colors.Cyan),
|
||||
new SolidColorBrush(Colors.DarkGray),
|
||||
new SolidColorBrush(Colors.Magenta),
|
||||
new SolidColorBrush(Colors.Purple),
|
||||
new SolidColorBrush(Colors.Yellow),
|
||||
new SolidColorBrush(Colors.Red)
|
||||
};
|
||||
|
||||
public static int AutoScrollToHour = 7;
|
||||
public static int VisualScale = 0; //0 - small, 1 - medium, 2 - large
|
||||
|
||||
public TimeTable()
|
||||
{
|
||||
//this.InitializeComponent();
|
||||
/// <summary> The feed. </summary>
|
||||
private static AppointmentFeed feed = null;
|
||||
|
||||
TimeTable.appList = new AppointmentListModel();
|
||||
}
|
||||
|
||||
public static AppointmentListModel AppointmentsModel
|
||||
/// <summary> Gets the feed. </summary>
|
||||
/// <value> The feed. </value>
|
||||
public static AppointmentFeed Feed
|
||||
{
|
||||
get
|
||||
{
|
||||
return TimeTable.appList;
|
||||
if (TimeTable.feed == null)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
return TimeTable.feed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Initialises the feed. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
public static void InitFeed()
|
||||
{
|
||||
TimeTable.InitFeed(TimeSpan.Zero);
|
||||
}
|
||||
|
||||
public static void InitFeed(TimeSpan span)
|
||||
{
|
||||
if (TimeTable.feed == null)
|
||||
{
|
||||
if (span.Equals(TimeSpan.Zero))
|
||||
{
|
||||
TimeTable.feed = new AppointmentFeed(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
TimeTable.feed = new AppointmentFeed(span, false);
|
||||
}
|
||||
TimeTable.feed.OnFailedFile += new CampusAppWPortalLib8.Model.AbstractMainModel<AppointmentListModel>.OnFailed(TimeTable.OnLoadFailed);
|
||||
TimeTable.feed.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Executes the load failed action. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
private static void OnLoadFailed()
|
||||
{
|
||||
if (TimeTable.feed.Model == null)
|
||||
{
|
||||
TimeTable.feed.Model = new AppointmentListModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templ="clr-namespace:CampusAppWP8.Utility.Lui.Templates"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
@@ -16,11 +17,26 @@
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<phone:Pivot x:Name="ThePivot" Title="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Day, Mode=OneWay, StringFormat='ddd dd.MM.yy'}"/>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<templ:WeekView
|
||||
x:Name="TheWeekView"
|
||||
Margin="0,-36,0,0"
|
||||
DateFrom="{Binding Path=Day, Mode=OneWay}"
|
||||
Appointments="{Binding Path=AppointmentList, Mode=OneWay}"
|
||||
Days="1"
|
||||
HeadVisible="False"/>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0"/>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -23,25 +24,10 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
public partial class TimeTableDay : PhoneApplicationPage
|
||||
{
|
||||
private readonly double DAY_TABLE_HEAD_WIDTH = 48;// * (1 + (TimeTable.VisualScale / 4));
|
||||
private readonly double DAY_TABLE_HEAD_HALF = 8;// * (1 + (TimeTable.VisualScale / 4));
|
||||
private readonly double DAY_TABLE_CELL_HEIGHT = 72;// * (1 + (TimeTable.VisualScale / 2));
|
||||
private readonly double DAY_TABLE_HEAD_THICKNESS = 2;
|
||||
private readonly double DAY_TABLE_INNER_THICKNESS = 1;
|
||||
private readonly double DAY_TABLE_ZINDEX_SHIFT = 10;
|
||||
private readonly int DAY_TABLE_ZINDEX_MAX = 10;
|
||||
|
||||
private static readonly int PIVOT_ITEM_PAGES = 5;
|
||||
private static readonly int PIVOT_ITEM_PAGES_HALF_DOWN = 2;
|
||||
|
||||
private struct PageItem
|
||||
{
|
||||
public Canvas Content { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public List<List<AppointmentModel>> Stacks { get; set; }
|
||||
}
|
||||
|
||||
private PageItem[] itemPages = new PageItem[PIVOT_ITEM_PAGES];
|
||||
private ObservableCollection<DayViewPageItem> itemList = new ObservableCollection<DayViewPageItem>();
|
||||
|
||||
private int lastSelectedIndex = 0;
|
||||
|
||||
@@ -53,12 +39,13 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
|
||||
{
|
||||
this.itemPages[i].Stacks = new List<List<AppointmentModel>>();
|
||||
this.CreatePage(i, firstDay.AddDays(i));
|
||||
DayViewPageItem newItem = new DayViewPageItem(firstDay);
|
||||
|
||||
this.itemList.Add(newItem);
|
||||
|
||||
firstDay = firstDay.AddDays(1);
|
||||
}
|
||||
|
||||
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
|
||||
this.ThePivot.SelectionChanged += new SelectionChangedEventHandler(this.EventPivotSelectionChanged);
|
||||
|
||||
ApplicationBarIconButton weekBtn = new ApplicationBarIconButton();
|
||||
@@ -92,12 +79,15 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
if (e.NavigationMode == NavigationMode.Back)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ThePivot.ItemsSource = this.itemList;
|
||||
this.lastSelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
|
||||
this.CheckAppointments();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +102,6 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
3<->4: 1
|
||||
4<->0: 2
|
||||
*/
|
||||
|
||||
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
|
||||
|
||||
if(delta < -1) delta = 1;
|
||||
@@ -124,25 +113,24 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.itemPages[indexToChange].Date = this.itemPages[this.ThePivot.SelectedIndex].Date.AddDays(delta * PIVOT_ITEM_PAGES_HALF_DOWN);
|
||||
}
|
||||
|
||||
this.SetupPage(indexToChange);
|
||||
this.itemList[indexToChange].Day = this.itemList[this.ThePivot.SelectedIndex].Day.AddDays(delta * PIVOT_ITEM_PAGES_HALF_DOWN);
|
||||
this.itemList[indexToChange].AppointmentList.Clear();
|
||||
|
||||
this.CheckAppointments(indexToChange);
|
||||
|
||||
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
|
||||
}
|
||||
|
||||
private void OnAppointmentClick(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
private void OnAppointmentClick(AppointmentModel model)
|
||||
{
|
||||
int index = TimeTable.AppointmentsModel.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
|
||||
int index = TimeTable.Feed.Model.Appointments.IndexOf(model);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged += this.OnListChanged;
|
||||
|
||||
string urlString = "/Pages/TimeTable/Appointment.xaml?" + Constants.Param_Appointment_Index + "=" + index;
|
||||
string urlString = Constants.PathTimeTable_Appointment + "?" + Constants.Param_Appointment_Index + "=" + index;
|
||||
|
||||
Uri url = new Uri(urlString, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
@@ -150,441 +138,135 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
private void EventOnMultiBubbleClick(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
int indexVal = (int)(sender as Canvas).Tag;
|
||||
int index = indexVal >> 12;
|
||||
int listIndex = indexVal & 0x00000FFF;
|
||||
|
||||
AppointmentModel tempModelCan = this.itemPages[index].Stacks[listIndex].First();
|
||||
this.itemPages[index].Stacks[listIndex].Remove(tempModelCan);
|
||||
this.itemPages[index].Stacks[listIndex].Add(tempModelCan);
|
||||
|
||||
for (int i = 0; i < this.itemPages[index].Stacks[listIndex].Count(); i++)
|
||||
{
|
||||
this.RemoveContentUIElement(index, this.itemPages[index].Stacks[listIndex][i]);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
this.DrawAppointmentModel(this.itemPages[index].Stacks[listIndex][i], index, 0.5, i, this.itemPages[index].Stacks[listIndex].Count() - 1 - i);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DrawAppointmentModel(this.itemPages[index].Stacks[listIndex][i], index, 1.0, i, this.itemPages[index].Stacks[listIndex].Count() - 1 - i);
|
||||
}
|
||||
}
|
||||
|
||||
this.RemoveContentUIElement(index, sender as Canvas);
|
||||
|
||||
Canvas tempCan = this.GetModelCanvasFromContent(index, this.itemPages[index].Stacks[listIndex][0]);
|
||||
|
||||
this.DrawMultiBubble(
|
||||
index,
|
||||
listIndex,
|
||||
this.itemPages[index].Stacks[listIndex].Count(),
|
||||
tempCan.Width + tempCan.Margin.Left,
|
||||
tempCan.Margin.Top);
|
||||
}
|
||||
|
||||
private void EventAutoScroll(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if ((sender as ScrollViewer).VerticalOffset == 0.0)
|
||||
{
|
||||
(sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickWeek(object sender, EventArgs e)
|
||||
{
|
||||
Uri url = new Uri("/Pages/TimeTable/TimeTableWeek.xaml", UriKind.Relative);
|
||||
Uri url = new Uri(Constants.PathTimeTable_Week, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
page.NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
private void OnClickToDay(object sender, EventArgs e)
|
||||
{
|
||||
DateTime firstDay = DateTime.Now.Date.AddDays(PIVOT_ITEM_PAGES_HALF_DOWN * -1);
|
||||
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
|
||||
for (int i = 0; i < this.itemList.Count; i++)
|
||||
{
|
||||
this.itemPages[i].Date = firstDay.AddDays(i);
|
||||
if (this.itemList[i].Day.Date.Equals(DateTime.Today.Date))
|
||||
{
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
this.SetupPage(i);
|
||||
if (index < 0)
|
||||
{
|
||||
DateTime firstDay = DateTime.Now;
|
||||
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
firstDay = firstDay.AddDays(-1 * PIVOT_ITEM_PAGES_HALF_DOWN);
|
||||
|
||||
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
|
||||
{
|
||||
this.itemList[i].Day = firstDay;
|
||||
this.itemList[i].AppointmentList.Clear();
|
||||
|
||||
this.CheckAppointments(i);
|
||||
|
||||
firstDay = firstDay.AddDays(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ThePivot.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickProperties(object sender, EventArgs e)
|
||||
{
|
||||
Uri url = new Uri("/Pages/TimeTable/TimeTableProperties.xaml", UriKind.Relative);
|
||||
Uri url = new Uri(Constants.PathTimeTable_Properties, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
page.NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
private void OnClickAdd(object sender, EventArgs e)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged += this.OnListChanged;
|
||||
|
||||
Uri url = new Uri("/Pages/TimeTable/AppointmentEdit.xaml", UriKind.Relative);
|
||||
Uri url = new Uri(Constants.PathTimeTable_AppointmentEdit, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
page.NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
AppointmentModel tempModel = null;
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
tempModel = e.NewItems[0] as AppointmentModel;
|
||||
for(int i = 0; i < e.NewItems.Count; i++)
|
||||
{
|
||||
AppointmentModel m = e.NewItems[i] as AppointmentModel;
|
||||
|
||||
for(int a = 0; a < PIVOT_ITEM_PAGES; a++)
|
||||
{
|
||||
if(m.IsDate(this.itemList[a].Day) == 0)
|
||||
{
|
||||
this.itemList[a].AppointmentList.Add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
tempModel = e.OldItems[0] as AppointmentModel;
|
||||
}
|
||||
for (int i = 0; i < e.OldItems.Count; i++)
|
||||
{
|
||||
AppointmentModel m = e.OldItems[i] as AppointmentModel;
|
||||
|
||||
if (tempModel != null)
|
||||
for (int a = 0; a < PIVOT_ITEM_PAGES; a++)
|
||||
{
|
||||
if (m.IsDate(this.itemList[a].Day) == 0)
|
||||
{
|
||||
this.itemList[a].AppointmentList.Remove(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
|
||||
{
|
||||
if (tempModel.IsDate(this.itemPages[i].Date.Date) > -1)
|
||||
this.itemList[i].AppointmentList.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckAppointments(int index = -1)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
|
||||
{
|
||||
AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
|
||||
|
||||
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
|
||||
{
|
||||
this.SetupPage(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddContentUIElement(int index, UIElement elem)
|
||||
{
|
||||
this.itemPages[index].Content.Children.Add(elem);
|
||||
}
|
||||
|
||||
private void RemoveContentUIElement(int index, UIElement elem)
|
||||
{
|
||||
this.itemPages[index].Content.Children.Remove(elem);
|
||||
}
|
||||
|
||||
private void RemoveContentUIElement(int index, AppointmentModel model)
|
||||
{
|
||||
Canvas tempCan = this.GetModelCanvasFromContent(index, model);
|
||||
|
||||
if (tempCan != null)
|
||||
{
|
||||
this.RemoveContentUIElement(index, tempCan);
|
||||
}
|
||||
}
|
||||
|
||||
private Canvas GetModelCanvasFromContent(int index, AppointmentModel model)
|
||||
{
|
||||
Canvas retValue = null;
|
||||
|
||||
foreach (Canvas tempCan in this.itemPages[index].Content.Children)
|
||||
{
|
||||
if (tempCan.Tag.GetType().Equals(typeof(AppointmentModel)))
|
||||
{
|
||||
if ((tempCan.Tag as AppointmentModel).Equals(model))
|
||||
{
|
||||
retValue = tempCan;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private void SetupPage(int index)
|
||||
{
|
||||
// Header
|
||||
|
||||
(this.ThePivot.Items[index] as PivotItem).Header = string.Format("{0:ddd dd.MM.yy}", this.itemPages[index].Date);
|
||||
|
||||
// Items
|
||||
|
||||
List<AppointmentModel> tempList = new List<AppointmentModel>();
|
||||
|
||||
this.itemPages[index].Stacks.Clear();
|
||||
this.itemPages[index].Content.Children.Clear();
|
||||
|
||||
for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
|
||||
{
|
||||
int appointmentIndex = -1;
|
||||
|
||||
if ((appointmentIndex = TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemPages[index].Date)) > -1)
|
||||
{
|
||||
tempList.Add(TimeTable.AppointmentsModel.Appointments[i]);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------
|
||||
for (int i = 0; i < tempList.Count(); i++)
|
||||
{
|
||||
int[] intersectIndex = tempList[i].IntersectArray(tempList.ToArray());
|
||||
|
||||
if (intersectIndex.Count() == 0)
|
||||
{
|
||||
this.DrawAppointmentModel(tempList[i], index);
|
||||
}
|
||||
else if (intersectIndex.Count() == 1)
|
||||
{
|
||||
int addIndex = -1;
|
||||
|
||||
for (int k = 0; k < this.itemPages[index].Stacks.Count(); k++)
|
||||
{
|
||||
if(this.itemPages[index].Stacks[k].IndexOf(tempList[intersectIndex[0]]) > -1)
|
||||
if (temp.IsDate(this.itemList[i].Day) == 0)
|
||||
{
|
||||
addIndex = k;
|
||||
temp.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Add(temp);
|
||||
}
|
||||
}
|
||||
|
||||
if (addIndex >= 0)
|
||||
{
|
||||
this.itemPages[index].Stacks[addIndex].Add(tempList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
newList.Add(tempList[i]);
|
||||
this.itemPages[index].Stacks.Add(newList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<List<AppointmentModel>> intersectLists = new List<List<AppointmentModel>>();
|
||||
|
||||
for (int k = 0; k < intersectIndex.Count(); k++)
|
||||
{
|
||||
for (int m = 0; m < this.itemPages[index].Stacks.Count(); m++)
|
||||
{
|
||||
if (this.itemPages[index].Stacks[m].IndexOf(tempList[intersectIndex[k]]) > -1)
|
||||
{
|
||||
if(intersectLists.IndexOf(this.itemPages[index].Stacks[m]) < 0)
|
||||
{
|
||||
intersectLists.Add(this.itemPages[index].Stacks[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(intersectLists.Count() == 0)
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
newList.Add(tempList[i]);
|
||||
this.itemPages[index].Stacks.Add(newList);
|
||||
}
|
||||
else if(intersectLists.Count() == 1)
|
||||
{
|
||||
intersectLists[0].Add(tempList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int k = 1; k < intersectLists.Count(); k++)
|
||||
{
|
||||
intersectLists[0].AddRange(intersectLists[k].ToArray());
|
||||
this.itemPages[index].Stacks.Remove(intersectLists[k]);
|
||||
}
|
||||
|
||||
intersectLists[0].Add(tempList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.itemPages[index].Stacks.Count(); i++)
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < this.itemPages[index].Stacks[i].Count(); k++)
|
||||
for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
|
||||
{
|
||||
if (k > 0)
|
||||
AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
|
||||
|
||||
if (temp.IsDate(this.itemList[index].Day) == 0)
|
||||
{
|
||||
this.DrawAppointmentModel(this.itemPages[index].Stacks[i][k], index, 0.5, k, this.itemPages[index].Stacks[i].Count() - 1 - k);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DrawAppointmentModel(this.itemPages[index].Stacks[i][k], index, 1.0, k, this.itemPages[index].Stacks[i].Count() - 1 - k);
|
||||
temp.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[index].AppointmentList.Add(temp);
|
||||
}
|
||||
}
|
||||
|
||||
Canvas tempCan = this.GetModelCanvasFromContent(index, this.itemPages[index].Stacks[i][0]);
|
||||
|
||||
this.DrawMultiBubble(
|
||||
index,
|
||||
i,
|
||||
this.itemPages[index].Stacks[i].Count(),
|
||||
tempCan.Width + tempCan.Margin.Left,
|
||||
tempCan.Margin.Top);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCanvasSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (e.NewSize.Width.Equals(e.PreviousSize.Width) == false)
|
||||
{
|
||||
Canvas tempContainer = (sender as Canvas);
|
||||
Canvas tempBG = (tempContainer.Children[0] as Canvas);
|
||||
Canvas tempContent = (tempContainer.Children[1] as Canvas);
|
||||
tempBG.Width = e.NewSize.Width;
|
||||
tempBG.Height = e.NewSize.Height;
|
||||
tempContent.Width = e.NewSize.Width;
|
||||
tempContent.Height = e.NewSize.Height;
|
||||
|
||||
PivotItem pvItem = ((tempContainer.Parent as ScrollViewer).Parent as PivotItem);
|
||||
int index = this.ThePivot.Items.IndexOf(pvItem);
|
||||
|
||||
this.DrawBackground(tempBG);
|
||||
|
||||
this.SetupPage(index);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreatePage(int index, DateTime date)
|
||||
{
|
||||
this.itemPages[index].Content = new Canvas();
|
||||
this.itemPages[index].Content.Height = DAY_TABLE_CELL_HEIGHT * 24;
|
||||
this.itemPages[index].Date = date;
|
||||
|
||||
ScrollViewer sv = new ScrollViewer();
|
||||
sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
|
||||
Canvas container = new Canvas();
|
||||
container.Height = DAY_TABLE_CELL_HEIGHT * 24;
|
||||
Canvas canBG = new Canvas();
|
||||
canBG.Height = DAY_TABLE_CELL_HEIGHT * 24;
|
||||
PivotItem pvItem = new PivotItem();
|
||||
|
||||
container.Children.Add(canBG);
|
||||
container.Children.Add(this.itemPages[index].Content);
|
||||
container.SizeChanged += new SizeChangedEventHandler(this.OnCanvasSizeChanged);
|
||||
sv.Content = container;
|
||||
pvItem.Content = sv;
|
||||
|
||||
this.ThePivot.Items.Add(pvItem);
|
||||
}
|
||||
|
||||
private void DrawAppointmentCanvas(Canvas modelCan, int index, double opacity = 1.0, int zIndex = 0, int modelCount = 0)
|
||||
{
|
||||
modelCan.Opacity = opacity;
|
||||
modelCan.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX - zIndex);
|
||||
modelCan.Margin = new Thickness(
|
||||
(DAY_TABLE_HEAD_WIDTH + 2 + (zIndex * DAY_TABLE_ZINDEX_SHIFT)),
|
||||
modelCan.Margin.Top,
|
||||
0,
|
||||
0);
|
||||
this.AddContentUIElement(index, modelCan);
|
||||
}
|
||||
|
||||
private void DrawAppointmentModel(AppointmentModel model, int index, double opacity = 1.0, int zIndex = 0, int modelCount = 0)
|
||||
{
|
||||
Canvas modelCan = model.GetCanvas(
|
||||
((this.itemPages[index].Content.Width - DAY_TABLE_HEAD_WIDTH) - 2 - 2 - (modelCount * DAY_TABLE_ZINDEX_SHIFT)),
|
||||
DAY_TABLE_CELL_HEIGHT,
|
||||
this.itemPages[index].Date.Date);
|
||||
|
||||
modelCan.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(this.OnAppointmentClick);
|
||||
|
||||
this.DrawAppointmentCanvas(modelCan, index, opacity, zIndex, modelCount);
|
||||
}
|
||||
|
||||
private void DrawMultiBubble(int stackIndex, int listIndex, int number, double xOffset, double yOffset)
|
||||
{
|
||||
Canvas can = new Canvas();
|
||||
|
||||
Rectangle rect = new Rectangle();
|
||||
rect.Width = DAY_TABLE_CELL_HEIGHT / 2;
|
||||
rect.Height = DAY_TABLE_CELL_HEIGHT / 2;
|
||||
rect.RadiusX = DAY_TABLE_CELL_HEIGHT / 4;
|
||||
rect.RadiusY = DAY_TABLE_CELL_HEIGHT / 4;
|
||||
rect.StrokeThickness = 1;
|
||||
rect.Stroke = new SolidColorBrush(Colors.DarkGray);
|
||||
rect.Fill = new SolidColorBrush(Colors.Black);
|
||||
|
||||
TextBlock block = new TextBlock();
|
||||
block.Height = DAY_TABLE_CELL_HEIGHT / 2;
|
||||
block.Width = DAY_TABLE_CELL_HEIGHT / 2;
|
||||
block.Text = "" + number;
|
||||
block.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
block.VerticalAlignment = VerticalAlignment.Center;
|
||||
block.FontWeight = FontWeights.Bold;
|
||||
block.FontSize = DAY_TABLE_CELL_HEIGHT / 3;
|
||||
block.Padding = new Thickness(DAY_TABLE_CELL_HEIGHT / 6.5, 0, 0, 0);
|
||||
|
||||
can.Children.Add(rect);
|
||||
can.Children.Add(block);
|
||||
can.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(this.EventOnMultiBubbleClick);
|
||||
can.Tag = (stackIndex << 12) | (listIndex & 0x00000FFF);
|
||||
can.SetValue(Canvas.LeftProperty, xOffset - rect.Width);
|
||||
can.SetValue(Canvas.TopProperty, yOffset);
|
||||
can.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX + 1);
|
||||
|
||||
this.AddContentUIElement(stackIndex, can);
|
||||
}
|
||||
|
||||
private void DrawBackground(Canvas dayView)
|
||||
{
|
||||
Line vertLine = new Line();
|
||||
vertLine.X1 = 0;
|
||||
vertLine.Y1 = 0;
|
||||
vertLine.X2 = 0;
|
||||
vertLine.Y2 = (DAY_TABLE_CELL_HEIGHT * 24);
|
||||
vertLine.Stroke = new SolidColorBrush(Colors.White);
|
||||
vertLine.Stretch = Stretch.Fill;
|
||||
vertLine.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
vertLine.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH, 0, 0, 0);
|
||||
vertLine.StrokeThickness = DAY_TABLE_HEAD_THICKNESS;
|
||||
|
||||
for (int i = 0; i <= 24; i++)
|
||||
{
|
||||
// lines
|
||||
Line hLineHead = new Line();
|
||||
hLineHead.X1 = 0;
|
||||
hLineHead.Y1 = 0;
|
||||
hLineHead.X2 = DAY_TABLE_HEAD_WIDTH;
|
||||
hLineHead.Y2 = 0;
|
||||
hLineHead.Stroke = new SolidColorBrush(Colors.White);
|
||||
hLineHead.Stretch = Stretch.Fill;
|
||||
hLineHead.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
hLineHead.Margin = new Thickness(0, (DAY_TABLE_CELL_HEIGHT * i), 0, 0);
|
||||
hLineHead.StrokeThickness = DAY_TABLE_HEAD_THICKNESS;
|
||||
|
||||
Line hLineHalf = new Line();
|
||||
hLineHalf.X1 = 0;
|
||||
hLineHalf.Y1 = 0;
|
||||
hLineHalf.X2 = DAY_TABLE_HEAD_HALF;
|
||||
hLineHalf.Y2 = 0;
|
||||
hLineHalf.Stroke = new SolidColorBrush(Colors.Gray);
|
||||
hLineHalf.Stretch = Stretch.Fill;
|
||||
hLineHalf.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
hLineHalf.Margin = new Thickness((DAY_TABLE_HEAD_WIDTH - DAY_TABLE_HEAD_HALF), (DAY_TABLE_CELL_HEIGHT * i) + (DAY_TABLE_CELL_HEIGHT / 2), 0, 0);
|
||||
hLineHalf.StrokeThickness = DAY_TABLE_HEAD_THICKNESS;
|
||||
|
||||
Line hLineInn = new Line();
|
||||
hLineInn.X1 = 0;
|
||||
hLineInn.Y1 = 0;
|
||||
hLineInn.X2 = 1000;
|
||||
hLineInn.Y2 = 0;
|
||||
hLineInn.Stroke = new SolidColorBrush(Colors.DarkGray);
|
||||
hLineInn.Stretch = Stretch.Fill;
|
||||
hLineInn.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
hLineInn.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH, (DAY_TABLE_CELL_HEIGHT * i), 0, 0);
|
||||
hLineInn.StrokeDashArray = new DoubleCollection();
|
||||
hLineInn.StrokeDashArray.Add(2);
|
||||
hLineInn.StrokeDashArray.Add(4);
|
||||
hLineInn.StrokeThickness = DAY_TABLE_INNER_THICKNESS;
|
||||
|
||||
dayView.Children.Add(hLineHead);
|
||||
dayView.Children.Add(hLineInn);
|
||||
|
||||
if (i < 24)
|
||||
{
|
||||
dayView.Children.Add(hLineHalf);
|
||||
|
||||
// text
|
||||
TextBlock timeStamp = new TextBlock();
|
||||
timeStamp.Text = i.ToString("00") + ":00";
|
||||
timeStamp.Margin = new Thickness(0, (DAY_TABLE_CELL_HEIGHT * i) + 2, 0, 0);
|
||||
timeStamp.FontSize = DAY_TABLE_CELL_HEIGHT / 4;
|
||||
|
||||
dayView.Children.Add(timeStamp);
|
||||
}
|
||||
}
|
||||
|
||||
dayView.Children.Add(vertLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,19 +35,19 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
|
||||
this.AutoScroll.ItemsSource = tempAutoScroll;
|
||||
this.AutoScroll.SelectedIndex = TimeTable.AutoScrollToHour;
|
||||
this.AutoScroll.SelectedIndex = TimeTable.Setting_AutoScrollToHour;
|
||||
|
||||
// VisualSize
|
||||
this.VisualScale.ItemsSource = VisualScaleText;
|
||||
this.VisualScale.SelectedIndex = TimeTable.VisualScale;
|
||||
this.VisualScale.SelectedIndex = TimeTable.Setting_VisualScale;
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
TimeTable.AutoScrollToHour = this.AutoScroll.SelectedIndex;
|
||||
TimeTable.VisualScale = this.VisualScale.SelectedIndex;
|
||||
TimeTable.Setting_AutoScrollToHour = this.AutoScroll.SelectedIndex;
|
||||
TimeTable.Setting_VisualScale = this.VisualScale.SelectedIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:templ="clr-namespace:CampusAppWP8.Utility.Lui.Templates"
|
||||
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
@@ -12,21 +13,28 @@
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Landscape" Orientation="Landscape"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
shell:SystemTray.IsVisible="True"
|
||||
>
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<phone:Pivot x:Name="ThePivot" SelectionChanged="OnPivotSelectionChanged" LoadedPivotItem="ThePivot_LoadedPivotItem">
|
||||
<phone:Pivot x:Name="ThePivot" SelectionChanged="OnPivotSelectionChanged">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
<TextBlock Text="header" Visibility="Collapsed"/>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible" Loaded="ScrollViewer_Loaded" Background="LightGoldenrodYellow">
|
||||
<templ:WeekView x:Name="TheWeekView" Loaded="TheWeekView_Loaded" StartDate="{Binding DateFrom, Mode=OneTime}"/>
|
||||
</ScrollViewer>
|
||||
<templ:WeekView
|
||||
x:Name="TheWeekView"
|
||||
Margin="0,-36,0,0"
|
||||
DateFrom="{Binding Path=FromDT, Mode=OneWay}"
|
||||
WeekName="{Binding Path=WeekStr, Mode=OneWay}"
|
||||
Appointments="{Binding Path=AppointmentList, Mode=OneWay}"
|
||||
WeekNumber="{Binding Path=WeekNr, Mode=OneWay}"
|
||||
Days="5"
|
||||
ToDayColoring="True"/>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@@ -20,48 +19,33 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility.Lui.Templates;
|
||||
|
||||
public partial class TimeTableWeek : PhoneApplicationPage
|
||||
{
|
||||
private static readonly double WEEK_TABLE_CELL_HEIGHT = 40;
|
||||
private static readonly double WEEK_TABLE_HEAD_WIDTH = 40;
|
||||
private static readonly double WEEK_TABLE_HEAD_THICKNESS = 2;
|
||||
private static readonly double WEEK_TABLE_HEAD_HALF = 15;
|
||||
private static readonly double WEEK_TABLE_INNER_THICKNESS = 1;
|
||||
private static readonly int WEEK_TABLE_ZINDEX_MAX = 10;
|
||||
|
||||
|
||||
private struct PageItem
|
||||
{
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public char WeekChar { get; set; }
|
||||
public int WeekNumber { get; set; }
|
||||
public WeekView weekView { get; set; }
|
||||
//???
|
||||
public List<Appointment> appointmentList { get; set; }
|
||||
public PivotItem pItemPtr { get; set; }
|
||||
}
|
||||
|
||||
private static readonly int PIVOT_PAGES = 3;
|
||||
private static readonly int PIVOT_PAGES_HALF_DOWN = 1;
|
||||
private static readonly int PIVOT_PAGES_COLUMNS = 5; // days in week
|
||||
|
||||
private PageItem[] itemPages = new PageItem[PIVOT_PAGES];
|
||||
private int lastSelectedIndex = 0;
|
||||
private int loadedWeekView = 0;
|
||||
|
||||
private int lastSelectedIndex = 0;
|
||||
|
||||
private ObservableCollection<WeekViewPageItem> itemList = new ObservableCollection<WeekViewPageItem>();
|
||||
|
||||
public TimeTableWeek()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
TimeTable.InitFeed();
|
||||
|
||||
DateTime firstDay = this.GetFirstDayOfWeek(DateTime.Now).AddDays(-7 * PIVOT_PAGES_HALF_DOWN);
|
||||
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
{
|
||||
this.itemPages[i].DateFrom = firstDay;
|
||||
this.itemPages[i].DateTo = firstDay.AddDays(6);
|
||||
int weekNr = this.GetWeekNumber(firstDay);
|
||||
string weekStr = ((weekNr % 2) != 0) ? "A" : "B";
|
||||
|
||||
WeekViewPageItem newItem = new WeekViewPageItem(firstDay, weekStr, weekNr, 6);
|
||||
|
||||
this.itemList.Add(newItem);
|
||||
|
||||
firstDay = firstDay.AddDays(7);
|
||||
}
|
||||
|
||||
@@ -96,16 +80,25 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
if (e.NavigationMode == NavigationMode.Back)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ThePivot.ItemsSource = this.itemPages;
|
||||
this.ThePivot.ItemsSource = this.itemList;
|
||||
this.lastSelectedIndex = PIVOT_PAGES_HALF_DOWN;
|
||||
this.ThePivot.SelectedIndex = PIVOT_PAGES_HALF_DOWN;
|
||||
|
||||
this.CheckAppointments();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
TimeTable.Feed.SaveData();
|
||||
}
|
||||
|
||||
private DateTime GetFirstDayOfWeek(DateTime dayInWeek)
|
||||
{
|
||||
DateTime retValue = dayInWeek.Date;
|
||||
@@ -118,6 +111,16 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private int GetWeekNumber(DateTime date)
|
||||
{
|
||||
int retValue = 0;
|
||||
|
||||
var cal = System.Globalization.DateTimeFormatInfo.CurrentInfo.Calendar;
|
||||
retValue = cal.GetWeekOfYear(date, System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private int GetDayOfWeekIndex(DateTime dayInWeek)
|
||||
{
|
||||
int retValue = -1;
|
||||
@@ -138,36 +141,46 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
private void OnClickDayView(object sender, EventArgs e)
|
||||
{
|
||||
/********* REMOVED FOR TESTING ********
|
||||
Uri url = new Uri(Constants.PathTimeTable_Day, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
page.NavigationService.Navigate(url);
|
||||
*/
|
||||
// this.itemPages[this.ThePivot.SelectedIndex].weekView.SetColumnBackground(0, new SolidColorBrush(Colors.Red));
|
||||
}
|
||||
|
||||
private void OnClickToday(object sender, EventArgs e)
|
||||
{
|
||||
/******* REMOVED FOR TESTING ********
|
||||
DateTime firstDay = this.GetFirstDayOfWeek(DateTime.Now).AddDays(-7 * PIVOT_PAGES_HALF_DOWN);
|
||||
this.ThePivot.SelectedIndex = PIVOT_PAGES_HALF_DOWN;
|
||||
DateTime firstDay = this.GetFirstDayOfWeek(DateTime.Now);
|
||||
int testIndex = -1;
|
||||
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
for (int i = 0; i < this.itemList.Count; i++)
|
||||
{
|
||||
this.itemPages[i].DateFrom = firstDay;
|
||||
this.itemPages[i].DateTo = this.itemPages[i].DateFrom.AddDays(6);
|
||||
this.itemPages[i].WeekNumber = System.Globalization.DateTimeFormatInfo.CurrentInfo.Calendar.GetWeekOfYear(
|
||||
this.itemPages[i].DateFrom,
|
||||
System.Globalization.CalendarWeekRule.FirstDay,
|
||||
DayOfWeek.Monday);
|
||||
this.itemPages[i].WeekChar = ((this.itemPages[i].WeekNumber % 2) == 0) ? 'B' : 'A';
|
||||
|
||||
firstDay = firstDay.AddDays(7);
|
||||
|
||||
this.SetupPage(i);
|
||||
if (this.itemList[i].FromDT.Equals(firstDay) == true)
|
||||
{
|
||||
testIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (testIndex < 0)
|
||||
{
|
||||
this.ThePivot.SelectedIndex = PIVOT_PAGES_HALF_DOWN;
|
||||
firstDay = firstDay.AddDays(-7 * PIVOT_PAGES_HALF_DOWN);
|
||||
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
{
|
||||
this.itemList[i].FromDT = firstDay;
|
||||
this.itemList[i].ToDT = this.itemList[i].FromDT.AddDays(6);
|
||||
this.itemList[i].WeekNr = this.GetWeekNumber(this.itemList[i].FromDT);
|
||||
this.itemList[i].WeekStr = ((this.itemList[i].WeekNr % 2) != 0) ? "A" : "B";
|
||||
this.itemList[i].AppointmentList.Clear();
|
||||
|
||||
this.CheckAppointments(i);
|
||||
|
||||
firstDay = firstDay.AddDays(7);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ThePivot.SelectedIndex = testIndex;
|
||||
}
|
||||
*/
|
||||
//this.itemPages[this.ThePivot.SelectedIndex].weekView.SetColumnBackground(0);
|
||||
}
|
||||
|
||||
private void OnClickProperties(object sender, EventArgs e)
|
||||
@@ -179,7 +192,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
private void OnClickCreate(object sender, EventArgs e)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
|
||||
Uri url = new Uri(Constants.PathTimeTable_AppointmentEdit, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
@@ -189,7 +202,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
private void OnPivotSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
|
||||
|
||||
|
||||
if (delta < -1) delta = 1;
|
||||
else if (delta > 1) delta = -1;
|
||||
|
||||
@@ -199,39 +212,26 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.itemPages[index].DateFrom = this.itemPages[this.ThePivot.SelectedIndex].DateFrom.AddDays((7 * delta));
|
||||
this.itemPages[index].DateTo = this.itemPages[this.ThePivot.SelectedIndex].DateTo.AddDays((7 * delta));
|
||||
}
|
||||
|
||||
this.itemList[index].FromDT = this.itemList[this.ThePivot.SelectedIndex].FromDT.AddDays((7 * delta));
|
||||
this.itemList[index].ToDT = this.itemList[this.ThePivot.SelectedIndex].ToDT.AddDays((7 * delta));
|
||||
this.itemList[index].WeekNr = this.GetWeekNumber(this.itemList[index].FromDT);
|
||||
this.itemList[index].WeekStr = ((this.itemList[index].WeekNr % 2) != 0) ? "A" : "B";
|
||||
|
||||
//this.itemPages[index].Content.Children.Clear();
|
||||
// this.itemPages[index].WeekNumber = System.Globalization.DateTimeFormatInfo.CurrentInfo.Calendar.GetWeekOfYear(
|
||||
// this.itemPages[index].DateFrom,
|
||||
// System.Globalization.CalendarWeekRule.FirstDay,
|
||||
// DayOfWeek.Monday);
|
||||
// this.itemPages[index].WeekChar = ((this.itemPages[index].WeekNumber % 2) == 0) ? 'B' : 'A';
|
||||
|
||||
//this.SetupPage(index);
|
||||
this.itemList[index].AppointmentList.Clear();
|
||||
|
||||
this.CheckAppointments(index);
|
||||
|
||||
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
|
||||
}
|
||||
|
||||
private void OnAutoScroll(object sender, RoutedEventArgs e)
|
||||
private void OnAppointmentClick(AppointmentModel model)
|
||||
{
|
||||
if ((sender as ScrollViewer).VerticalOffset == 0.0)
|
||||
{
|
||||
(sender as ScrollViewer).ScrollToVerticalOffset(WEEK_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAppointmentClick(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
int index = TimeTable.AppointmentsModel.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
|
||||
int index = TimeTable.Feed.Model.Appointments.IndexOf(model);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
|
||||
string urlString = Constants.PathTimeTable_Appointment + "?" + Constants.Param_Appointment_Index + "=" + index;
|
||||
|
||||
@@ -241,68 +241,6 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMultiBubbleClick(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
int indexVal = (int)(sender as Canvas).Tag;
|
||||
int dayIndex = (indexVal >> 24) & 0xF;
|
||||
int index = (indexVal >> 12) & 0xFFF;
|
||||
int listIndex = (indexVal) & 0xFFF;
|
||||
/*
|
||||
//AppointmentModel tempModel = this.itemPages[index].Stacks[dayIndex][listIndex].First();
|
||||
//this.itemPages[index].Stacks[dayIndex][listIndex].Remove(tempModel);
|
||||
//this.itemPages[index].Stacks[dayIndex][listIndex].Add(tempModel);
|
||||
AppointmentModel tempModel = this.itemPages[index].Stacks[listIndex].First();
|
||||
this.itemPages[index].Stacks[listIndex].Remove(tempModel);
|
||||
this.itemPages[index].Stacks[listIndex].Add(tempModel);
|
||||
|
||||
//for (int i = 0; i < this.itemPages[index].Stacks[dayIndex][listIndex].Count(); i++)
|
||||
for (int i = 0; i < this.itemPages[index].Stacks[listIndex].Count(); i++)
|
||||
{
|
||||
//tempModel = this.itemPages[index].Stacks[dayIndex][listIndex][i];
|
||||
tempModel = this.itemPages[index].Stacks[listIndex][i];
|
||||
|
||||
this.RemoveContentUIElement(index, tempModel);
|
||||
|
||||
for (int day = 0; day < 5; day++)
|
||||
{
|
||||
if (tempModel.IsDate(this.itemPages[index].DateFrom.Date.AddDays(day)) > -1)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
//this.DrawAppointment(this.itemPages[index].Stacks[dayIndex][listIndex][i], index, day, 0.5, i, this.itemPages[index].Stacks[dayIndex][listIndex].Count - 1 - i);
|
||||
this.DrawAppointment(this.itemPages[index].Stacks[listIndex][i], index, day, 0.5, i, this.itemPages[index].Stacks[listIndex].Count - 1 - i);
|
||||
}
|
||||
else
|
||||
{
|
||||
//this.DrawAppointment(this.itemPages[index].Stacks[dayIndex][listIndex][i], index, day, 1.0, i, this.itemPages[index].Stacks[dayIndex][listIndex].Count - 1 - i);
|
||||
this.DrawAppointment(this.itemPages[index].Stacks[listIndex][i], index, day, 1.0, i, this.itemPages[index].Stacks[listIndex].Count - 1 - i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// this.RemoveContentUIElement(index, sender as Canvas);
|
||||
|
||||
bool bubbleDrawn = false;
|
||||
/*
|
||||
for (int day = 0; day < 5; day++)
|
||||
{
|
||||
if (this.itemPages[index].Stacks[listIndex][0].IsDate(this.itemPages[index].DateFrom.Date.AddDays(day)) > -1 && bubbleDrawn == false)
|
||||
{
|
||||
bubbleDrawn = true;
|
||||
Canvas[] tempCan = this.GetModelCanvasFromContent(index, this.itemPages[index].Stacks[listIndex][0]);
|
||||
this.DrawMultiBubble(
|
||||
index,
|
||||
day,
|
||||
listIndex,
|
||||
this.itemPages[index].Stacks[listIndex].Count(),
|
||||
tempCan[0].Width + tempCan[0].Margin.Left,
|
||||
tempCan[0].Margin.Top);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
AppointmentModel tempModel = null;
|
||||
@@ -310,524 +248,75 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
tempModel = e.NewItems[0] as AppointmentModel;
|
||||
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
{
|
||||
if (tempModel.IsDate(this.itemList[i].FromDT, 4) >= 0)
|
||||
{
|
||||
tempModel.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Add(tempModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
tempModel = e.OldItems[0] as AppointmentModel;
|
||||
}
|
||||
|
||||
if (tempModel != null)
|
||||
{
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
{
|
||||
if (tempModel.IsDate(this.itemPages[i].DateFrom, 4) > -1)
|
||||
if (this.itemList[i].AppointmentList.IndexOf(tempModel) >= 0)
|
||||
{
|
||||
this.SetupPage(i);
|
||||
tempModel.OnClick -= this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Remove(tempModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCanvasSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
private void CheckAppointments(int pageIndex = -1)
|
||||
{
|
||||
/*
|
||||
if (e.NewSize.Width.Equals(e.PreviousSize.Width) == false)
|
||||
if (TimeTable.Feed == null)
|
||||
{
|
||||
Canvas tempContainer = (sender as Canvas);
|
||||
Canvas tempBG = (tempContainer.Children[0] as Canvas);
|
||||
Canvas tempContent = (tempContainer.Children[1] as Canvas);
|
||||
tempBG.Width = e.NewSize.Width;
|
||||
tempBG.Height = e.NewSize.Height;
|
||||
tempContent.Width = e.NewSize.Width;
|
||||
tempContent.Height = e.NewSize.Height;
|
||||
|
||||
PivotItem pvItem = ((tempContainer.Parent as ScrollViewer).Parent as PivotItem);
|
||||
Grid headGrid = pvItem.Header as Grid;
|
||||
int index = this.ThePivot.Items.IndexOf(pvItem);
|
||||
|
||||
headGrid.Width = e.NewSize.Width;
|
||||
|
||||
this.SetupPage(index);
|
||||
throw new NullReferenceException("feed == null");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void SetupPage(int index)
|
||||
{
|
||||
// Header
|
||||
|
||||
//((this.ThePivot.Items[index] as PivotItem).Header as Grid).Children.Clear();
|
||||
|
||||
//this.DrawHeader(index);
|
||||
|
||||
// Items
|
||||
|
||||
// List<AppointmentModel>[] tempList = new List<AppointmentModel>[5];
|
||||
List<AppointmentModel> tempList = new List<AppointmentModel>();
|
||||
|
||||
/*
|
||||
for(int i = 0; i < 5; i++)
|
||||
else if (TimeTable.Feed.Model == null)
|
||||
{
|
||||
this.itemPages[index].Stacks[i].Clear();
|
||||
throw new NullReferenceException("model == null");
|
||||
}
|
||||
/**/
|
||||
// this.itemPages[index].Stacks.Clear();
|
||||
|
||||
// this.itemPages[index].Content.Children.Clear();
|
||||
/*
|
||||
for(int i = 0; i < 5; i++)
|
||||
else if (TimeTable.Feed.Model.Appointments == null)
|
||||
{
|
||||
tempList[i] = new List<AppointmentModel>();
|
||||
throw new NullReferenceException("Appointments == null");
|
||||
}
|
||||
*/
|
||||
for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
|
||||
|
||||
if (pageIndex < 0)
|
||||
{
|
||||
/*
|
||||
for (int k = 0; k < 5; k++)
|
||||
for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
|
||||
{
|
||||
if (TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemPages[index].DateFrom.Date.AddDays(k)) > -1)
|
||||
AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
|
||||
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
{
|
||||
tempList[k].Add(TimeTable.AppointmentsModel.Appointments[i]);
|
||||
if (temp.IsDate(this.itemList[i].FromDT, 4) >= 0)
|
||||
{
|
||||
temp.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Add(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemPages[index].DateFrom.Date, 4) > -1)
|
||||
{
|
||||
tempList.Add(TimeTable.AppointmentsModel.Appointments[i]);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------
|
||||
/*
|
||||
for (int i = 0; i < tempList.Count(); i++)
|
||||
else
|
||||
{
|
||||
int[] intersectIndex = tempList[i].IntersectArray(tempList.ToArray());
|
||||
|
||||
if (intersectIndex.Count() == 0)
|
||||
for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
|
||||
{
|
||||
for (int day = 0; day < 5; day++)
|
||||
{
|
||||
if (tempList[i].IsDate(this.itemPages[index].DateFrom.Date.AddDays(day)) > -1)
|
||||
{
|
||||
this.DrawAppointment(tempList[i], index, day);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (intersectIndex.Count() == 1)
|
||||
{
|
||||
int addIndex = -1;
|
||||
AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
|
||||
|
||||
for (int k = 0; k < this.itemPages[index].Stacks.Count(); k++)
|
||||
if (temp.IsDate(this.itemList[pageIndex].FromDT, 4) >= 0)
|
||||
{
|
||||
//if (this.itemPages[index].Stacks[day][k].IndexOf(tempList[day][intersectIndex[0]]) > -1)
|
||||
if(this.itemPages[index].Stacks[k].IndexOf(tempList[intersectIndex[0]]) > -1)
|
||||
{
|
||||
addIndex = k;
|
||||
}
|
||||
}
|
||||
|
||||
if (addIndex >= 0)
|
||||
{
|
||||
//this.itemPages[index].Stacks[day][addIndex].Add(tempList[day][i]);
|
||||
this.itemPages[index].Stacks[addIndex].Add(tempList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
//newList.Add(tempList[day][i]);
|
||||
//this.itemPages[index].Stacks[day].Add(newList);
|
||||
newList.Add(tempList[i]);
|
||||
this.itemPages[index].Stacks.Add(newList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<List<AppointmentModel>> intersectLists = new List<List<AppointmentModel>>();
|
||||
|
||||
for (int k = 0; k < intersectIndex.Count(); k++)
|
||||
{
|
||||
//for (int m = 0; m < this.itemPages[index].Stacks[day].Count(); m++)
|
||||
for(int m = 0; m < this.itemPages[index].Stacks.Count(); m++)
|
||||
{
|
||||
//if (this.itemPages[index].Stacks[day][m].IndexOf(tempList[day][intersectIndex[k]]) > -1)
|
||||
if(this.itemPages[index].Stacks[m].IndexOf(tempList[intersectIndex[k]]) > -1)
|
||||
{
|
||||
//if (intersectLists.IndexOf(this.itemPages[index].Stacks[day][m]) < 0)
|
||||
if(intersectLists.IndexOf(this.itemPages[index].Stacks[m]) < 0)
|
||||
{
|
||||
//intersectLists.Add(this.itemPages[index].Stacks[day][m]);
|
||||
intersectLists.Add(this.itemPages[index].Stacks[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (intersectLists.Count() == 0)
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
//newList.Add(tempList[day][i]);
|
||||
//this.itemPages[index].Stacks[day].Add(newList);
|
||||
newList.Add(tempList[i]);
|
||||
this.itemPages[index].Stacks.Add(newList);
|
||||
}
|
||||
else if (intersectLists.Count() == 1)
|
||||
{
|
||||
//intersectLists[0].Add(tempList[day][i]);
|
||||
intersectLists[0].Add(tempList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 1; k < intersectLists.Count(); k++)
|
||||
{
|
||||
intersectLists[0].AddRange(intersectLists[k].ToArray());
|
||||
//this.itemPages[index].Stacks[day].Remove(intersectLists[k]);
|
||||
this.itemPages[index].Stacks.Remove(intersectLists[k]);
|
||||
}
|
||||
|
||||
//intersectLists[0].Add(tempList[day][i]);
|
||||
intersectLists[0].Add(tempList[i]);
|
||||
temp.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[pageIndex].AppointmentList.Add(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
for (int day = 0; day < 5; day++)
|
||||
{
|
||||
for (int i = 0; i < tempList[day].Count(); i++)
|
||||
{
|
||||
int[] intersectIndex = tempList[day][i].IntersectArray(tempList[day].ToArray());
|
||||
|
||||
if (intersectIndex.Count() == 0)
|
||||
{
|
||||
this.DrawAppointment(tempList[day][i], index, day);
|
||||
}
|
||||
else if (intersectIndex.Count() == 1)
|
||||
{
|
||||
int addIndex = -1;
|
||||
|
||||
for (int k = 0; k < this.itemPages[index].Stacks[day].Count(); k++)
|
||||
{
|
||||
if (this.itemPages[index].Stacks[day][k].IndexOf(tempList[day][intersectIndex[0]]) > -1)
|
||||
{
|
||||
addIndex = k;
|
||||
}
|
||||
}
|
||||
|
||||
if (addIndex >= 0)
|
||||
{
|
||||
this.itemPages[index].Stacks[day][addIndex].Add(tempList[day][i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
newList.Add(tempList[day][i]);
|
||||
this.itemPages[index].Stacks[day].Add(newList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<List<AppointmentModel>> intersectLists = new List<List<AppointmentModel>>();
|
||||
|
||||
for (int k = 0; k < intersectIndex.Count(); k++)
|
||||
{
|
||||
for (int m = 0; m < this.itemPages[index].Stacks[day].Count(); m++)
|
||||
{
|
||||
if (this.itemPages[index].Stacks[day][m].IndexOf(tempList[day][intersectIndex[k]]) > -1)
|
||||
{
|
||||
if (intersectLists.IndexOf(this.itemPages[index].Stacks[day][m]) < 0)
|
||||
{
|
||||
intersectLists.Add(this.itemPages[index].Stacks[day][m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (intersectLists.Count() == 0)
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
newList.Add(tempList[day][i]);
|
||||
this.itemPages[index].Stacks[day].Add(newList);
|
||||
}
|
||||
else if (intersectLists.Count() == 1)
|
||||
{
|
||||
intersectLists[0].Add(tempList[day][i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 1; k < intersectLists.Count(); k++)
|
||||
{
|
||||
intersectLists[0].AddRange(intersectLists[k].ToArray());
|
||||
this.itemPages[index].Stacks[day].Remove(intersectLists[k]);
|
||||
}
|
||||
|
||||
intersectLists[0].Add(tempList[day][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// stack draw
|
||||
//for (int day = 0; day < 5; day++)
|
||||
{
|
||||
//for (int i = 0; i < this.itemPages[index].Stacks[day].Count(); i++)
|
||||
for(int i = 0; i < this.itemPages[index].Stacks.Count(); i++)
|
||||
{
|
||||
//for (int k = 0; k < this.itemPages[index].Stacks[day][i].Count(); k++)
|
||||
for(int k = 0; k < this.itemPages[index].Stacks[i].Count(); k++)
|
||||
{
|
||||
if (k > 0)
|
||||
{
|
||||
//this.DrawAppointment(this.itemPages[index].Stacks[day][i][k], index, day, 0.5, k, this.itemPages[index].Stacks[day][i].Count() - 1 - k);
|
||||
for (int day = 0; day < 5; day++)
|
||||
{
|
||||
this.DrawAppointment(this.itemPages[index].Stacks[i][k], index, day, 0.5, k, this.itemPages[index].Stacks[i].Count() - 1 - k);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//this.DrawAppointment(this.itemPages[index].Stacks[day][i][k], index, day, 1.0, k, this.itemPages[index].Stacks[day][i].Count() - 1 - k);
|
||||
for (int day = 0; day < 5; day++)
|
||||
{
|
||||
this.DrawAppointment(this.itemPages[index].Stacks[i][k], index, day, 1.0, k, this.itemPages[index].Stacks[i].Count() - 1 - k);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
Canvas[] tempCan = this.GetModelCanvasFromContent(index, this.itemPages[index].Stacks[day][i][0]);
|
||||
// FIXME: tempCan[0] ->
|
||||
this.DrawMultiBubble(
|
||||
index,
|
||||
day,
|
||||
i,
|
||||
this.itemPages[index].Stacks[day][i].Count(),
|
||||
tempCan[0].Width + tempCan[0].Margin.Left,
|
||||
tempCan[0].Margin.Top);
|
||||
*/
|
||||
/*
|
||||
for (int day = 0; day < 5; day++)
|
||||
{
|
||||
if (this.itemPages[index].Stacks[i][0].IsDate(this.itemPages[index].DateFrom.Date.AddDays(day)) > -1)
|
||||
{
|
||||
Canvas[] tempCan = this.GetModelCanvasFromContent(index, this.itemPages[index].Stacks[i][0]);
|
||||
this.DrawMultiBubble(
|
||||
index,
|
||||
day,
|
||||
i,
|
||||
this.itemPages[index].Stacks[i].Count(),
|
||||
tempCan[0].Width + tempCan[0].Margin.Left,
|
||||
tempCan[0].Margin.Top);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void CreatePage(int itemIndex, DateTime weekStart)
|
||||
{
|
||||
// this.itemPages[itemIndex].Content = new Canvas();
|
||||
// this.itemPages[itemIndex].Content.Height = WEEK_TABLE_CELL_HEIGHT * 24;
|
||||
this.itemPages[itemIndex].DateFrom = weekStart;
|
||||
this.itemPages[itemIndex].DateTo = weekStart.AddDays(6);
|
||||
// this.itemPages[itemIndex].WeekNumber = System.Globalization.DateTimeFormatInfo.CurrentInfo.Calendar.GetWeekOfYear(
|
||||
// weekStart,
|
||||
// System.Globalization.CalendarWeekRule.FirstDay,
|
||||
// DayOfWeek.Monday);
|
||||
// this.itemPages[itemIndex].WeekChar = ((this.itemPages[itemIndex].WeekNumber % 2) == 0) ? 'B' : 'A';
|
||||
|
||||
//PivotItem pvItem = new PivotItem();
|
||||
//Grid headGrid = new Grid();
|
||||
//pvItem.Header = headGrid;
|
||||
|
||||
//this.ThePivot.Items.Add(pvItem);
|
||||
}
|
||||
|
||||
private void RemoveContentUIElement(int index, UIElement elem)
|
||||
{
|
||||
// if (this.itemPages[index].Content.Children.Remove(elem) == false)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveContentUIElement(int index, AppointmentModel model)
|
||||
{
|
||||
Canvas[] list = this.GetModelCanvasFromContent(index, model);
|
||||
|
||||
if (list.Count() > 0)
|
||||
{
|
||||
foreach (Canvas can in list)
|
||||
{
|
||||
// this.itemPages[index].Content.Children.Remove(can);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Canvas[] GetModelCanvasFromContent(int index, AppointmentModel model)
|
||||
{
|
||||
List<Canvas> retValue = new List<Canvas>();
|
||||
|
||||
// foreach (FrameworkElement elem in this.itemPages[index].Content.Children)
|
||||
{
|
||||
// if (elem.Tag.GetType().Equals(typeof(AppointmentModel)))
|
||||
{
|
||||
// if ((elem.Tag as AppointmentModel).Equals(model))
|
||||
{
|
||||
// retValue.Add(elem as Canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retValue.ToArray();
|
||||
}
|
||||
|
||||
|
||||
private void DrawAppointment(AppointmentModel model, int index, int xIndex, double opacity = 1.0, int zIndex = 0, int modelCount = 0)
|
||||
{
|
||||
/*
|
||||
Canvas modelCan = model.GetCanvas(
|
||||
((this.itemPages[index].Content.Width - WEEK_TABLE_HEAD_WIDTH) / 5) - 2 - 2 - (modelCount * WEEK_TABLE_ZINDEX_SHIFT),
|
||||
WEEK_TABLE_CELL_HEIGHT,
|
||||
this.itemPages[index].DateFrom.Date.AddDays(xIndex));
|
||||
|
||||
modelCan.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(this.OnAppointmentClick);
|
||||
modelCan.Opacity = opacity;
|
||||
modelCan.SetValue(Canvas.ZIndexProperty, WEEK_TABLE_ZINDEX_MAX - zIndex);
|
||||
modelCan.Margin = new Thickness(
|
||||
(WEEK_TABLE_HEAD_WIDTH + 2 + (zIndex * WEEK_TABLE_ZINDEX_SHIFT) + (xIndex * ((this.itemPages[index].Content.Width - WEEK_TABLE_HEAD_WIDTH) / 5))),
|
||||
modelCan.Margin.Top,
|
||||
0,
|
||||
0);
|
||||
|
||||
this.itemPages[index].Content.Children.Add(modelCan);
|
||||
*/
|
||||
}
|
||||
|
||||
private void DrawMultiBubble(int index, int dayIndex, int listIndex, int number, double xOffset, double yOffset)
|
||||
{
|
||||
Canvas can = new Canvas();
|
||||
|
||||
can.Width = WEEK_TABLE_CELL_HEIGHT * 2;
|
||||
can.Height = WEEK_TABLE_CELL_HEIGHT * 2;
|
||||
|
||||
Rectangle rect = new Rectangle();
|
||||
rect.Width = WEEK_TABLE_CELL_HEIGHT / 2;
|
||||
rect.Height = WEEK_TABLE_CELL_HEIGHT / 2;
|
||||
rect.RadiusX = WEEK_TABLE_CELL_HEIGHT / 4;
|
||||
rect.RadiusY = WEEK_TABLE_CELL_HEIGHT / 4;
|
||||
rect.StrokeThickness = 1;
|
||||
rect.Stroke = new SolidColorBrush(Colors.DarkGray);
|
||||
rect.Fill = new SolidColorBrush(Colors.Black);
|
||||
|
||||
TextBlock block = new TextBlock();
|
||||
block.Height = WEEK_TABLE_CELL_HEIGHT / 2;
|
||||
block.Width = WEEK_TABLE_CELL_HEIGHT / 2;
|
||||
block.Text = "" + number;
|
||||
block.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
block.VerticalAlignment = VerticalAlignment.Center;
|
||||
block.FontWeight = FontWeights.Bold;
|
||||
block.FontSize = WEEK_TABLE_CELL_HEIGHT / 3;
|
||||
block.Padding = new Thickness(WEEK_TABLE_CELL_HEIGHT / 6.5, 0, 0, 0);
|
||||
|
||||
can.Children.Add(rect);
|
||||
rect.SetValue(Canvas.TopProperty, WEEK_TABLE_CELL_HEIGHT / 2);
|
||||
rect.SetValue(Canvas.LeftProperty, WEEK_TABLE_CELL_HEIGHT / 2);
|
||||
|
||||
can.Children.Add(block);
|
||||
block.SetValue(Canvas.TopProperty, WEEK_TABLE_CELL_HEIGHT / 2);
|
||||
block.SetValue(Canvas.LeftProperty, WEEK_TABLE_CELL_HEIGHT / 2);
|
||||
|
||||
can.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(this.OnMultiBubbleClick);
|
||||
can.Tag = ((dayIndex & 0xF) << 24) | ((index & 0xFFF) << 12) | (listIndex & 0xFFF);
|
||||
can.SetValue(Canvas.LeftProperty, xOffset - rect.Width - (WEEK_TABLE_CELL_HEIGHT / 2));
|
||||
can.SetValue(Canvas.TopProperty, yOffset - (WEEK_TABLE_CELL_HEIGHT / 2));
|
||||
can.SetValue(Canvas.ZIndexProperty, WEEK_TABLE_ZINDEX_MAX + 1);
|
||||
|
||||
// this.itemPages[index].Content.Children.Add(can);
|
||||
}
|
||||
|
||||
private void DrawHeader(int index)
|
||||
{
|
||||
Grid grid = ((this.ThePivot.Items[index] as PivotItem).Header as Grid);
|
||||
string text = string.Format("{0:dd.MM.yyyy} < {1:c} > {2:dd.MM.yyyy}", this.itemPages[index].DateFrom, this.itemPages[index].WeekChar, this.itemPages[index].DateTo);
|
||||
|
||||
RowDefinition row_0 = new RowDefinition();
|
||||
RowDefinition row_1 = new RowDefinition();
|
||||
row_0.Height = GridLength.Auto;
|
||||
row_1.Height = GridLength.Auto;
|
||||
|
||||
grid.RowDefinitions.Add(row_0);
|
||||
grid.RowDefinitions.Add(row_1);
|
||||
|
||||
TextBlock newTB = new TextBlock();
|
||||
newTB.Text = text;
|
||||
newTB.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
newTB.FontSize = 24;
|
||||
newTB.SetValue(Grid.RowProperty, 0);
|
||||
|
||||
grid.Children.Add(newTB);
|
||||
|
||||
Canvas headCan = new Canvas();
|
||||
|
||||
string[] dayStr = new string[] {"Mo", "Di", "Mi", "Do", "Fr" };
|
||||
|
||||
double w = (grid.Width - WEEK_TABLE_HEAD_WIDTH) / 5;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Rectangle dayRect = new Rectangle();
|
||||
TextBlock dayTB = new TextBlock();
|
||||
|
||||
dayRect.Width = w;
|
||||
dayRect.Height = 30;
|
||||
dayRect.StrokeThickness = WEEK_TABLE_HEAD_THICKNESS;
|
||||
dayRect.Stroke = new SolidColorBrush(Colors.White);
|
||||
dayRect.Stretch = Stretch.Fill;
|
||||
dayRect.Margin = new Thickness(WEEK_TABLE_HEAD_WIDTH - 9 + i * w, 0, 0, 0);
|
||||
|
||||
if (this.itemPages[index].DateFrom.Date.AddDays(i).Equals(DateTime.Now.Date))
|
||||
{
|
||||
dayRect.Fill = new SolidColorBrush(Colors.White);
|
||||
dayTB.Foreground = new SolidColorBrush(Colors.Black);
|
||||
}
|
||||
|
||||
headCan.Children.Add(dayRect);
|
||||
|
||||
dayTB.Text = dayStr[i];
|
||||
dayTB.TextAlignment = TextAlignment.Center;
|
||||
dayTB.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
dayTB.Width = w;
|
||||
dayTB.FontSize = 16;
|
||||
dayTB.Margin = new Thickness(WEEK_TABLE_HEAD_WIDTH - 9 + i * w, 4, 0, 0);
|
||||
|
||||
headCan.Children.Add(dayTB);
|
||||
}
|
||||
|
||||
headCan.SetValue(Grid.RowProperty, 1);
|
||||
|
||||
grid.Children.Add(headCan);
|
||||
}
|
||||
|
||||
private void ScrollViewer_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void TheWeekView_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// this.itemPages[this.loadedWeekView].weekView = sender as WeekView;
|
||||
this.loadedWeekView++;
|
||||
}
|
||||
|
||||
private void ThePivot_LoadedPivotItem(object sender, PivotItemEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Grid_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
163
CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs
Normal file
163
CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="WeekViewPageItem.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>06.11.2013</date>
|
||||
// <summary>Implements the week view page item class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Utility.Lui.Templates;
|
||||
|
||||
/// <summary> A week view page item. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.ComponentModel.INotifyPropertyChanged"/>
|
||||
public class WeekViewPageItem : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> from dt Date/Time. </summary>
|
||||
private DateTime fromDT;
|
||||
/// <summary> to dt Date/Time. </summary>
|
||||
private DateTime toDT;
|
||||
/// <summary> The days. </summary>
|
||||
private int days;
|
||||
/// <summary> The week string. </summary>
|
||||
private string weekStr = string.Empty;
|
||||
/// <summary> The week number. </summary>
|
||||
private int weekNumber = -1;
|
||||
/// <summary> The week view. </summary>
|
||||
private WeekView weekView = null;
|
||||
/// <summary> List of appointments. </summary>
|
||||
private ObservableCollection<AppointmentModel> appointmentList = null;
|
||||
|
||||
/// <summary> Tritt ein, wenn sich ein Eigenschaftswert ändert. </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary> Initializes a new instance of the WeekViewPageItem class. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="from"> from Date/Time. </param>
|
||||
/// <param name="str"> The. </param>
|
||||
/// <param name="number"> Number of. </param>
|
||||
/// <param name="days"> The days. </param>
|
||||
public WeekViewPageItem(DateTime from, string str, int number, int days)
|
||||
{
|
||||
this.fromDT = from;
|
||||
this.toDT = from.Date.AddDays(days);
|
||||
this.days = days;
|
||||
this.weekStr = str;
|
||||
this.weekNumber = number;
|
||||
this.appointmentList = new ObservableCollection<AppointmentModel>();
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the Date/Time of from dt. </summary>
|
||||
/// <value> from dt. </value>
|
||||
public DateTime FromDT
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fromDT;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.fromDT = value;
|
||||
this.NotifyPropertyChanged("FromDT");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the Date/Time of to dt. </summary>
|
||||
/// <value> to dt. </value>
|
||||
public DateTime ToDT
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.toDT;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.toDT = value;
|
||||
this.NotifyPropertyChanged("ToDT");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the week string. </summary>
|
||||
/// <value> The week string. </value>
|
||||
public string WeekStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.weekStr;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.weekStr = value;
|
||||
this.NotifyPropertyChanged("WeekStr");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the week nr. </summary>
|
||||
/// <value> The week nr. </value>
|
||||
public int WeekNr
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.weekNumber;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.weekNumber = value;
|
||||
this.NotifyPropertyChanged("WeekNr");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the view. </summary>
|
||||
/// <value> The view. </value>
|
||||
public WeekView View
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.weekView;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.weekView = value;
|
||||
this.NotifyPropertyChanged("View");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets a list of appointments. </summary>
|
||||
/// <value> A List of appointments. </value>
|
||||
public ObservableCollection<AppointmentModel> AppointmentList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.appointmentList;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.appointmentList = value;
|
||||
this.NotifyPropertyChanged("AppointmentList");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Notifies a property changed. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="info"> The information. </param>
|
||||
private void NotifyPropertyChanged(string info)
|
||||
{
|
||||
if (this.PropertyChanged != null)
|
||||
{
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(info));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die KW ähnelt.
|
||||
/// </summary>
|
||||
public static string Calendar_Week_Short {
|
||||
get {
|
||||
return ResourceManager.GetString("Calendar_Week_Short", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Gebäudeinfos ausblenden ähnelt.
|
||||
/// </summary>
|
||||
@@ -276,6 +285,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Kopieren ähnelt.
|
||||
/// </summary>
|
||||
public static string Copy {
|
||||
get {
|
||||
return ResourceManager.GetString("Copy", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Erstellen ähnelt.
|
||||
/// </summary>
|
||||
@@ -375,6 +393,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Angestellte ähnelt.
|
||||
/// </summary>
|
||||
public static string Employees {
|
||||
get {
|
||||
return ResourceManager.GetString("Employees", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
|
||||
/// </summary>
|
||||
@@ -420,6 +447,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Gäste ähnelt.
|
||||
/// </summary>
|
||||
public static string Guests {
|
||||
get {
|
||||
return ResourceManager.GetString("Guests", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
|
||||
/// </summary>
|
||||
@@ -726,6 +762,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Tagesplan ähnelt.
|
||||
/// </summary>
|
||||
public static string MensaApp_Dayplan {
|
||||
get {
|
||||
return ResourceManager.GetString("MensaApp_Dayplan", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 84 ähnelt.
|
||||
/// </summary>
|
||||
@@ -744,6 +789,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Wochenplan ähnelt.
|
||||
/// </summary>
|
||||
public static string MensaApp_Weekplan {
|
||||
get {
|
||||
return ResourceManager.GetString("MensaApp_Weekplan", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die BTU-Tag ähnelt.
|
||||
/// </summary>
|
||||
@@ -1266,6 +1320,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Studenten ähnelt.
|
||||
/// </summary>
|
||||
public static string Students {
|
||||
get {
|
||||
return ResourceManager.GetString("Students", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -596,4 +596,25 @@
|
||||
<data name="Time_Day_Wednesday_Short" xml:space="preserve">
|
||||
<value>Mi</value>
|
||||
</data>
|
||||
<data name="Calendar_Week_Short" xml:space="preserve">
|
||||
<value>KW</value>
|
||||
</data>
|
||||
<data name="Employees" xml:space="preserve">
|
||||
<value>Angestellte</value>
|
||||
</data>
|
||||
<data name="Guests" xml:space="preserve">
|
||||
<value>Gäste</value>
|
||||
</data>
|
||||
<data name="Students" xml:space="preserve">
|
||||
<value>Studenten</value>
|
||||
</data>
|
||||
<data name="Copy" xml:space="preserve">
|
||||
<value>Kopieren</value>
|
||||
</data>
|
||||
<data name="MensaApp_Dayplan" xml:space="preserve">
|
||||
<value>Tagesplan</value>
|
||||
</data>
|
||||
<data name="MensaApp_Weekplan" xml:space="preserve">
|
||||
<value>Wochenplan</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -247,7 +247,7 @@
|
||||
<value>OpeninghoursFeed.xml</value>
|
||||
</data>
|
||||
<data name="UrlOpeningHours_OpeningHours" xml:space="preserve">
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1</value>
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2</value>
|
||||
</data>
|
||||
<data name="FileNews_Name" xml:space="preserve">
|
||||
<value>NewsFeed.xml</value>
|
||||
@@ -594,4 +594,19 @@
|
||||
<data name="GeoWatch_CurrentPositionPoint" xml:space="preserve">
|
||||
<value>CurrentPositionPoint</value>
|
||||
</data>
|
||||
<data name="FileAppointments_Name" xml:space="preserve">
|
||||
<value>Appointments.xaml</value>
|
||||
</data>
|
||||
<data name="ParamPID" xml:space="preserve">
|
||||
<value>pid</value>
|
||||
</data>
|
||||
<data name="PisInformationName_Room" xml:space="preserve">
|
||||
<value>Raumnummer</value>
|
||||
</data>
|
||||
<data name="FileMensaPrice" xml:space="preserve">
|
||||
<value>mensaprice.xml</value>
|
||||
</data>
|
||||
<data name="UrlMensaPrice" xml:space="preserve">
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -249,6 +249,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Appointments.xaml ähnelt.
|
||||
/// </summary>
|
||||
public static string FileAppointments_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("FileAppointments_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
|
||||
/// </summary>
|
||||
@@ -375,6 +384,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die mensaprice.xml ähnelt.
|
||||
/// </summary>
|
||||
public static string FileMensaPrice {
|
||||
get {
|
||||
return ResourceManager.GetString("FileMensaPrice", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die NewsFeed.xml ähnelt.
|
||||
/// </summary>
|
||||
@@ -708,6 +726,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die pid ähnelt.
|
||||
/// </summary>
|
||||
public static string ParamPID {
|
||||
get {
|
||||
return ResourceManager.GetString("ParamPID", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die pivotindex ähnelt.
|
||||
/// </summary>
|
||||
@@ -1176,6 +1203,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Raumnummer ähnelt.
|
||||
/// </summary>
|
||||
public static string PisInformationName_Room {
|
||||
get {
|
||||
return ResourceManager.GetString("PisInformationName_Room", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Kurzbeschreibung ähnelt.
|
||||
/// </summary>
|
||||
@@ -1357,7 +1393,16 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1 ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1 ähnelt.
|
||||
/// </summary>
|
||||
public static string UrlMensaPrice {
|
||||
get {
|
||||
return ResourceManager.GetString("UrlMensaPrice", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2 ähnelt.
|
||||
/// </summary>
|
||||
public static string UrlOpeningHours_OpeningHours {
|
||||
get {
|
||||
|
||||
22
CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs
Normal file
22
CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
|
||||
public sealed class DoubleNaNConverter : IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
return (value is double && value.Equals(double.NaN) == false) ? value : 0.0;
|
||||
}
|
||||
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
return (value is double && value.Equals(double.NaN) == false) ? value : 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,16 +204,16 @@ namespace CampusAppWP8.Utility
|
||||
int val = 0;
|
||||
char typeChar;
|
||||
|
||||
for (int i = 0; i < durStr.Length; i++)
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
if (durStr[i] >= '0' && durStr[i] <= '9')
|
||||
if (str[i] >= '0' && str[i] <= '9')
|
||||
{
|
||||
val *= 10;
|
||||
val += durStr[0] - '0';
|
||||
val += str[i] - '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
typeChar = durStr[i];
|
||||
typeChar = str[i];
|
||||
retValue.Add(new Tuple<int, char>(val, typeChar));
|
||||
val = 0;
|
||||
}
|
||||
@@ -276,6 +276,8 @@ namespace CampusAppWP8.Utility
|
||||
/// <remarks>Fiedler, 05.09.2013.</remarks>
|
||||
public abstract class Interface
|
||||
{
|
||||
protected string privateName = string.Empty;
|
||||
|
||||
/// <summary>Sets the property/class values. Used for import from a ICS file.</summary>
|
||||
/// <remarks>Fiedler, 05.09.2013.</remarks>
|
||||
/// <param name="valueStr">The value string.</param>
|
||||
|
||||
@@ -48,52 +48,55 @@ namespace CampusAppWP8.Utility
|
||||
|
||||
foreach (string e in elems)
|
||||
{
|
||||
ContentLine prop = ICSManager.ToContentLine(e);
|
||||
ICSDict.ICSElemDesc tempElem = null;
|
||||
|
||||
if ((tempElem = parentList.Last().GetValue(prop.Name)) != null)
|
||||
if (e.Length > 0)
|
||||
{
|
||||
object propObj = tempElem.CreateObj(prop.ValueString, (prop.ParamList == null) ? null : prop.ParamList.ToArray());
|
||||
ContentLine prop = ICSManager.ToContentLine(e);
|
||||
ICSDict.ICSElemDesc tempElem = null;
|
||||
|
||||
if (ICSManager.Is((propObj as ICSClasses.Interface).GetName(), ICSTag.BEGIN))
|
||||
if ((tempElem = parentList.Last().GetValue(prop.Name)) != null)
|
||||
{
|
||||
retPointer = new ICalObject();
|
||||
object propObj = tempElem.CreateObj(prop.ValueString, (prop.ParamList == null) ? null : prop.ParamList.ToArray());
|
||||
|
||||
if (retValue == null)
|
||||
if (ICSManager.Is((propObj as ICSClasses.Interface).GetName(), ICSTag.BEGIN))
|
||||
{
|
||||
retValue = retPointer;
|
||||
retPointer = new ICalObject();
|
||||
|
||||
if (retValue == null)
|
||||
{
|
||||
retValue = retPointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME
|
||||
retValue.PropertieList.Add(retPointer);
|
||||
}
|
||||
|
||||
retPointer.Header = propObj as ICSProperties.Begin;
|
||||
|
||||
parentList.Add(ICSManager.GetSubValue((propObj as ICSProperties.Begin).Value, tempElem));
|
||||
}
|
||||
else if (ICSManager.Is((propObj as ICSClasses.Interface).GetName(), ICSTag.END))
|
||||
{
|
||||
if (ICSManager.GetSubValue((propObj as ICSProperties.End).Value, tempElem) != null)
|
||||
{
|
||||
parentList.RemoveAt(parentList.Count - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME
|
||||
retValue.PropertieList.Add(retPointer);
|
||||
retPointer.PropertieList.Add(propObj);
|
||||
}
|
||||
|
||||
retPointer.Header = propObj as ICSProperties.Begin;
|
||||
|
||||
parentList.Add(ICSManager.GetSubValue((propObj as ICSProperties.Begin).Value, tempElem));
|
||||
}
|
||||
else if (ICSManager.Is((propObj as ICSClasses.Interface).GetName(), ICSTag.END))
|
||||
else
|
||||
{
|
||||
if (ICSManager.GetSubValue((propObj as ICSProperties.End).Value, tempElem) != null)
|
||||
if (prop.Name.IndexOf("X-") == 0)
|
||||
{
|
||||
parentList.RemoveAt(parentList.Count - 1);
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("Tag (" + prop.Name + ") was not found in (" + parentList.Last().Name + ")");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
retPointer.PropertieList.Add(propObj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prop.Name.IndexOf("X-") == 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("Tag (" + prop.Name + ") was not found in (" + parentList.Last().Name + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
ICSValue.PRIVATE,
|
||||
ICSValue.CONFIDENTIAL
|
||||
});
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -76,7 +77,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList.Count() > 0)
|
||||
{
|
||||
throw new NotSupportedException("in (" + Name + ") is no param supported");
|
||||
throw new NotSupportedException("in (" + this.privateName + ") is no param supported");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +96,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <returns>The string. </returns>
|
||||
public override string GetString()
|
||||
{
|
||||
return Name + ":" + this.value;
|
||||
return this.privateName + ":" + this.value;
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Action()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -95,7 +96,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Attachment()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value bytes. </summary>
|
||||
@@ -182,7 +183,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (this.formatType.Equals(string.Empty) == false)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Attendee()
|
||||
{
|
||||
this.paramList = new List<Tuple<string, string>>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -112,7 +113,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
|
||||
if (p.Count() != 2)
|
||||
{
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")");
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
|
||||
@@ -121,7 +122,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[i] + ") in (" + Name + ")");
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[i] + ") in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +137,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
for (int i = 0; i < this.paramList.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Begin()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -99,7 +100,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public CalendarScale()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -91,7 +92,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Categories()
|
||||
{
|
||||
this.valueList = new List<string>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -114,7 +115,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (this.languageType.Equals(string.Empty) == false)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Comment()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -132,7 +133,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (this.altrep.Equals(string.Empty) == false)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Contact()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public DTCompleted()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the Date/Time of the value. </summary>
|
||||
@@ -60,7 +61,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
this.value = ICSClasses.UTCStringToDateTime(valueStr);
|
||||
@@ -86,7 +87,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + ICSClasses.DateTimeToString(this.value);
|
||||
retValue += this.privateName + ":" + ICSClasses.DateTimeToString(this.value);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public DTCreated()
|
||||
{
|
||||
this.paramList = new List<Tuple<string, string>>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the Date/Time of the value. </summary>
|
||||
@@ -95,7 +96,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
|
||||
if (p.Count() != 2)
|
||||
{
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")");
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
|
||||
@@ -104,7 +105,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[i] + ") in (" + Name + ")");
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[i] + ") in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +120,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + ICSClasses.DateTimeToString(this.value);
|
||||
retValue += this.privateName + ":" + ICSClasses.DateTimeToString(this.value);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public DTDue()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public DTEnd()
|
||||
{
|
||||
this.paramList = new List<Tuple<string, string>>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the Date/Time of the value. </summary>
|
||||
@@ -135,7 +136,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList.Count() > 2)
|
||||
{
|
||||
throw new NotSupportedException("too many params in (" + Name + ")");
|
||||
throw new NotSupportedException("too many params in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
for (int i = 0; i < paramStrList.Count(); i++)
|
||||
@@ -162,7 +163,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("param (" + p[0] + ") is not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("param (" + p[0] + ") is not supported in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +179,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
|
||||
if (isDate != tempIsDate)
|
||||
{
|
||||
throw new NotSupportedException("time value has not the same type as declared in param in(" + Name + ")");
|
||||
throw new NotSupportedException("time value has not the same type as declared in param in(" + this.privateName + ")");
|
||||
}
|
||||
|
||||
this.value = ICSClasses.UTCStringToDateTime(valueStr);
|
||||
@@ -191,7 +192,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
for (int i = 0; i < this.paramList.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public DTException()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
this.values = new List<Tuple<DateTime, DateTime, TimeSpan, bool>>();
|
||||
this.paramList = new List<Tuple<string, string>>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -120,7 +121,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
|
||||
if (p.Count() != 2)
|
||||
{
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")");
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
|
||||
@@ -129,7 +130,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[0] + ") in (" + Name + ")");
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[0] + ") in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,7 +189,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
for (int i = 0; i < this.paramList.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public DTStamp()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public DTStart()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Description()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Duration()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -83,7 +84,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("params are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("params are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (valueStr[0].Equals('-') || valueStr[0].Equals('+'))
|
||||
@@ -102,7 +103,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + ICSClasses.TimeSpanToString(this.value, this.isNegative);
|
||||
retValue += this.privateName + ":" + ICSClasses.TimeSpanToString(this.value, this.isNegative);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public End()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public FreeBusyTime()
|
||||
{
|
||||
this.valueList = new List<Tuple<DateTime, TimeSpan, DateTime, bool>>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a list of values. </summary>
|
||||
@@ -91,7 +92,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList.Count() > 1)
|
||||
{
|
||||
throw new NotSupportedException("there is only 1 param in (" + Name + ") supported");
|
||||
throw new NotSupportedException("there is only 1 param in (" + this.privateName + ") supported");
|
||||
}
|
||||
|
||||
string[] p = paramStrList[0].Split('=');
|
||||
@@ -161,7 +162,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (!this.freebusyType.Equals(string.Empty))
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Geo()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -61,7 +62,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
string[] valSplit = valueStr.Split(';');
|
||||
@@ -96,11 +97,11 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (this.value == null)
|
||||
{
|
||||
throw new NotSupportedException("there is no value set for (" + Name + ")");
|
||||
throw new NotSupportedException("there is no value set for (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
retValue += ":" + this.value.Item1.ToString() + ";" + this.value.Item2.ToString();
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public LastModified()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Location()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Method()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -70,7 +71,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Organizer()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public PercentComplete()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -49,7 +50,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value must be in rang of [0..100] in (" + Name + ")");
|
||||
throw new ArgumentOutOfRangeException("value must be in rang of [0..100] in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +68,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
this.value = int.Parse(valueStr);
|
||||
@@ -94,11 +95,11 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (this.value < 0)
|
||||
{
|
||||
throw new NotSupportedException("there is no value set for (" + Name + ")");
|
||||
throw new NotSupportedException("there is no value set for (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
retValue += ":" + this.value.ToString();
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Priority()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -49,7 +50,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value must be in rage of [0..9] in (" + Name + ")");
|
||||
throw new ArgumentOutOfRangeException("value must be in rage of [0..9] in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +68,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,14 +84,14 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
this.value = int.Parse(valueStr);
|
||||
|
||||
if ((this.value < 0) || (this.value > 9))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value must be in the range of [0..9] in (" + Name + ")");
|
||||
throw new ArgumentOutOfRangeException("value must be in the range of [0..9] in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,11 +103,11 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (this.value < 0 || this.value > 9)
|
||||
{
|
||||
throw new NotSupportedException("there is no value set for (" + Name + ")");
|
||||
throw new NotSupportedException("there is no value set for (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
retValue += ":" + this.value.ToString();
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public ProductID()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -70,7 +71,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public RecurrenceID()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public RecurrenceRule()
|
||||
{
|
||||
this.values = new List<Tuple<string, List<string>>>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -119,7 +120,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":";
|
||||
retValue += this.privateName + ":";
|
||||
|
||||
for (int i = 0; i < this.values.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public RelatedTo()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -98,7 +99,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
|
||||
if (p.Count() != 2)
|
||||
{
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")");
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
|
||||
@@ -107,7 +108,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[0] + ") in (" + Name + ")");
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[0] + ") in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +123,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (!this.realType.Equals(string.Empty))
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public RepeatCount()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -75,7 +76,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value.ToString();
|
||||
retValue += this.privateName + ":" + this.value.ToString();
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
this.paramList = new List<Tuple<string, string>>();
|
||||
this.valueList = new List<string>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -142,7 +143,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
for (int i = 0; i < this.paramList.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Resources()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public SequenceNumber()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
ICSValue.FINAL,
|
||||
ICSValue.CANCELLED
|
||||
});
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -84,7 +85,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("value (" + value + ") is not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("value (" + value + ") is not supported in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +103,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,14 +116,14 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("parameter are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if ((this.ValueListEvent.IndexOf(valueStr) < 0)
|
||||
&& (this.ValueListToDo.IndexOf(valueStr) < 0)
|
||||
&& (this.ValueListJournal.IndexOf(valueStr) < 0))
|
||||
{
|
||||
throw new NotSupportedException("value (" + valueStr + ") is not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("value (" + valueStr + ") is not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
this.value = valueStr;
|
||||
@@ -135,7 +136,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Summary()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
ICSValue.OPAQUE,
|
||||
ICSValue.TRANSPARENT
|
||||
});
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -81,7 +82,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("params are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("params are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (this.ValueList.IndexOf(valueStr) < 0)
|
||||
@@ -99,7 +100,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public TimeZoneIdentifier()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -65,7 +66,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("params are not supported in (" + Name + ")");
|
||||
throw new NotSupportedException("params are not supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
this.value = valueStr;
|
||||
@@ -78,7 +79,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public TimeZoneName()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -81,7 +82,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList.Count() > 1)
|
||||
{
|
||||
throw new NotSupportedException("there is only 1 param supported in (" + Name + ")");
|
||||
throw new NotSupportedException("there is only 1 param supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (paramStrList.Count() == 1)
|
||||
@@ -114,7 +115,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
if (!this.language.Equals(string.Empty))
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public TimeZoneOffsetFrom()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -84,7 +85,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("no param supported in (" + Name + ")");
|
||||
throw new NotSupportedException("no param supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
if (valueStr[0].Equals('+'))
|
||||
@@ -110,7 +111,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + (this.isNegative ? "-" : "+") + string.Format("{0:HHmm}", this.value);
|
||||
retValue += this.privateName + ":" + (this.isNegative ? "-" : "+") + string.Format("{0:HHmm}", this.value);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public TimeZoneOffsetTo()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public TimeZoneUrl()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -65,7 +66,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("no param supported in (" + Name + ")");
|
||||
throw new NotSupportedException("no param supported in (" + this.privateName + ")");
|
||||
}
|
||||
|
||||
this.value = valueStr;
|
||||
@@ -78,7 +79,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":" + this.value;
|
||||
retValue += this.privateName + ":" + this.value;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Trigger()
|
||||
{
|
||||
this.paramList = new List<Tuple<string, string>>();
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the Date/Time of the value. </summary>
|
||||
@@ -164,7 +165,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name;
|
||||
retValue += this.privateName;
|
||||
|
||||
for (int i = 0; i < this.paramList.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public UniqueID()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
public Url()
|
||||
: base()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets the name. </summary>
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public Version()
|
||||
{
|
||||
this.privateName = this.GetName();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value. </summary>
|
||||
@@ -132,7 +133,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
retValue += Name + ":";
|
||||
retValue += this.privateName + ":";
|
||||
|
||||
if (this.minVer >= 0.0f)
|
||||
{
|
||||
|
||||
113
CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs
Normal file
113
CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="IdToPlaceConverter.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>13.11.2013</date>
|
||||
// <summary>Implements the identifier to place converter class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
using CampusAppWP8.File.Places;
|
||||
using CampusAppWPortalLib8.Model.GeoDb;
|
||||
|
||||
/// <summary> An identifier to place converter. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.Windows.Data.IValueConverter"/>
|
||||
public sealed class IdToPlaceConverter : IValueConverter
|
||||
{
|
||||
/// <summary> The place file. </summary>
|
||||
private PlacesFile placeFile = null;
|
||||
|
||||
/// <summary> Initializes a new instance of the IdToPlaceConverter class. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
public IdToPlaceConverter()
|
||||
{
|
||||
this.placeFile = new PlacesFile();
|
||||
this.placeFile.OnLoaded += this.PlaceFileIsReady;
|
||||
this.placeFile.OnFailedLoad += this.PlaceFileIsFailed;
|
||||
this.placeFile.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <returns>info string of the place.</returns>
|
||||
/// <seealso cref="M:System.Windows.Data.IValueConverter.Convert(object,Type,object,System.Globalization.CultureInfo)"/>
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
string paramStr = "Name";
|
||||
|
||||
if (parameter is string)
|
||||
{
|
||||
paramStr = (string)parameter;
|
||||
}
|
||||
|
||||
if (value is string)
|
||||
{
|
||||
retValue = this.GetInfo((string)value, paramStr);
|
||||
}
|
||||
else if (value is int)
|
||||
{
|
||||
retValue = this.GetInfo(string.Empty + (int)value, paramStr);
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in
|
||||
/// <see cref="F:System.Windows.Data.BindingMode.TwoWay" />-Bindungen aufgerufen.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <returns>null</returns>
|
||||
/// <seealso cref="M:System.Windows.Data.IValueConverter.ConvertBack(object,Type,object,System.Globalization.CultureInfo)"/>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
object retValue = null;
|
||||
|
||||
/*
|
||||
if(targetType.Equals(typeof(int)))
|
||||
{
|
||||
retValue = new int();
|
||||
retValue =
|
||||
}
|
||||
*/
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Gets an information. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="placeID"> Identifier for the place. </param>
|
||||
/// <param name="searchInfo"> Information describing the search. </param>
|
||||
/// <returns> The information. </returns>
|
||||
private string GetInfo(string placeID, string searchInfo)
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
if (this.placeFile.Model != null)
|
||||
{
|
||||
PlaceModel model = this.placeFile.Model.GetPlaceById(placeID);
|
||||
retValue = model.GetInformationsValue(searchInfo);
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary> Place file is failed. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
private void PlaceFileIsFailed()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> Place file is ready. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
private void PlaceFileIsReady()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding DateFrom, Mode=OneWay, StringFormat='dd.MM.yyyy'}" HorizontalAlignment="Right" FontSize="24"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="0" Text="<" HorizontalAlignment="Center" FontSize="24"/>
|
||||
<TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding WeekChar, Mode=OneWay}" HorizontalAlignment="Center" FontSize="24"/>
|
||||
<TextBlock Grid.Column="2" Grid.Row="0" Text="A" HorizontalAlignment="Center" FontSize="24"/>
|
||||
<TextBlock Grid.Column="3" Grid.Row="0" Text=">" HorizontalAlignment="Center" FontSize="24"/>
|
||||
<TextBlock Grid.Column="4" Grid.Row="0" Text="{Binding DateTo, Mode=OneWay, StringFormat='dd.MM.yyyy'}" HorizontalAlignment="Left" FontSize="24"/>
|
||||
</Grid>
|
||||
|
||||
@@ -12,11 +12,41 @@
|
||||
|
||||
public partial class WeekViewPivotHeader : UserControl
|
||||
{
|
||||
|
||||
public static readonly DependencyProperty DateFromProperty = DependencyProperty.Register("DateFrom", typeof(DateTime), typeof(WeekViewPivotHeader), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty DateToProperty = DependencyProperty.Register("DateTo", typeof(DateTime), typeof(WeekViewPivotHeader), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty DaysProperty = DependencyProperty.Register("Days", typeof(int), typeof(WeekViewPivotHeader), new PropertyMetadata(null));
|
||||
|
||||
public WeekViewPivotHeader()
|
||||
{
|
||||
this.Days = 5;
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public DateTime DateFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DateTime)this.GetValue(DateFromProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(DateFromProperty, value);
|
||||
this.SetValue(DateToProperty, value.AddDays(this.Days));
|
||||
}
|
||||
}
|
||||
|
||||
public int Days
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)this.GetValue(DaysProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(DaysProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<UserControl x:Class="CampusAppWP8.Utility.Lui.MultiValueTextBlock"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
>
|
||||
|
||||
<!--
|
||||
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
|
||||
|
||||
</Grid>
|
||||
-->
|
||||
<TextBlock x:Name="TheText"/>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,94 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MultiValueTextBlock.xaml.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>14.11.2013</date>
|
||||
// <summary>Implements the multi value text block.xaml class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility.Lui
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
/// <summary> A multi value text block. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.Windows.Controls.UserControl"/>
|
||||
public partial class MultiValueTextBlock : UserControl
|
||||
{
|
||||
/// <summary> The value 1 property. </summary>
|
||||
public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
|
||||
/// <summary> The value 2 property. </summary>
|
||||
public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
|
||||
|
||||
/// <summary> The converter property. </summary>
|
||||
public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
|
||||
|
||||
/// <summary> Initializes a new instance of the MultiValueTextBlock class. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
public MultiValueTextBlock() : base()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the converter. </summary>
|
||||
/// <value> The converter. </value>
|
||||
public IValueConverter Converter
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IValueConverter)this.GetValue(ConverterProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(ConverterProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the value 1. </summary>
|
||||
/// <value> The value 1. </value>
|
||||
public object Value1
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue(Value_1_Property);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(Value_1_Property, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the value 2. </summary>
|
||||
/// <value> The value 2. </value>
|
||||
public object Value2
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue(Value_2_Property);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(Value_2_Property, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the dependency property changed event. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <param name="d"> The DependencyObject to process. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private static void OnLoaded(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
MultiValueTextBlock obj = d as MultiValueTextBlock;
|
||||
|
||||
if ((obj.Value1 != null) && (obj.Value2 != null) && (obj.Converter != null))
|
||||
{
|
||||
obj.TheText.Text = (string)obj.Converter.Convert(obj.Value1, typeof(string), obj.Value2, System.Globalization.CultureInfo.CurrentCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<UserControl x:Class="CampusAppWP8.Utility.Lui.Templates.AppointmentCanvas"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
>
|
||||
|
||||
<Canvas
|
||||
SizeChanged="TheMainCanvas_SizeChanged">
|
||||
|
||||
<Rectangle x:Name="TheRect"
|
||||
Stroke="{StaticResource PhoneForegroundBrush}"
|
||||
StrokeThickness="1"
|
||||
Fill="{StaticResource PhoneAccentBrush}"
|
||||
RadiusX="5"
|
||||
RadiusY="5"
|
||||
/>
|
||||
<TextBlock x:Name="TheText"
|
||||
FontSize="14"
|
||||
Padding="3"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="White"
|
||||
/>
|
||||
</Canvas>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,129 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="AppointmentCanvas.xaml.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>28.10.2013</date>
|
||||
// <summary>Implements the appointment canvas.xaml class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility.Lui.Templates
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Pages.TimeTable;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
public partial class AppointmentCanvas : UserControl
|
||||
{
|
||||
private AppointmentModel appPtr = null;
|
||||
|
||||
public AppointmentCanvas() : base()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public AppointmentCanvas(AppointmentModel model) : this(model, new DateTime(0))
|
||||
{
|
||||
}
|
||||
|
||||
public AppointmentCanvas(AppointmentModel model, DateTime day) : this()
|
||||
{
|
||||
this.appPtr = model;
|
||||
|
||||
double totalHours = model.GetTotalHours(day);
|
||||
|
||||
this.Height = ((totalHours < 0.25) ? 0.25 : totalHours) * TimeTable.Setting_Hour_Spacing;
|
||||
this.SetText(model.Title);
|
||||
this.SetValue(Canvas.TopProperty, (day.Date.Equals(model.Start.Date)) ? (model.Start.TimeOfDay.TotalHours * TimeTable.Setting_Hour_Spacing) : 0);
|
||||
|
||||
object tempProp = null;
|
||||
|
||||
if ((tempProp = model.GetValue(ICSTag.PRIORITY)) != null)
|
||||
{
|
||||
this.SetBGColorByPriority((tempProp as ICSProperties.Priority).Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SetBGColorByPriority(0);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Is(AppointmentModel model)
|
||||
{
|
||||
return (this.appPtr.Equals(model));
|
||||
}
|
||||
|
||||
public void SetListPosition(int index, int count)
|
||||
{
|
||||
this.Margin = new Thickness(
|
||||
(TimeTable.Setting_Z_Spacing * index),
|
||||
0,
|
||||
(TimeTable.Setting_Z_Spacing * (count - 1)),
|
||||
0);
|
||||
|
||||
this.SetValue(Canvas.ZIndexProperty, ((TimeTable.Setting_Max_Z_Index - index) < 0) ? 0 : (TimeTable.Setting_Max_Z_Index - index));
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
this.Opacity = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Opacity = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetListPosition(List<AppointmentModel> list)
|
||||
{
|
||||
int index = list.IndexOf(this.appPtr);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
this.SetListPosition(index, list.Count);
|
||||
}
|
||||
}
|
||||
|
||||
private void TheMainCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
// because Binding did not work, why ever
|
||||
this.TheRect.Width = ((e.NewSize.Width - this.Margin.Right) < 0) ? 0 : (e.NewSize.Width - this.Margin.Right);
|
||||
this.TheRect.Height = e.NewSize.Height;
|
||||
this.TheText.Width = ((e.NewSize.Width - this.Margin.Right) < 0) ? 0 : (e.NewSize.Width - this.Margin.Right);
|
||||
this.TheText.Height = e.NewSize.Height;
|
||||
}
|
||||
|
||||
private void SetText(string text)
|
||||
{
|
||||
if (this.Height < (TimeTable.Setting_Hour_Spacing * 0.5))
|
||||
{
|
||||
this.TheText.Text = "...";
|
||||
this.TheText.Margin = new Thickness(
|
||||
0,
|
||||
this.Height - (TimeTable.Setting_Hour_Spacing * 0.5),
|
||||
0,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.TheText.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetBGColorByPriority(int prio)
|
||||
{
|
||||
if (prio < TimeTable.Setting_Priority_Colors.Count() && prio >= 0)
|
||||
{
|
||||
this.TheRect.Fill = TimeTable.Setting_Priority_Colors[prio];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,70 +5,207 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:weekView="clr-namespace:CampusAppWP8.Utility.Lui.Templates"
|
||||
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui"
|
||||
xmlns:conv="clr-namespace:CampusAppWP8.Utility"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
>
|
||||
x:Name="root">
|
||||
|
||||
<UserControl.Resources>
|
||||
<conv:BoolToVisibilityConverter x:Key="VisConverter"/>
|
||||
<conv:DoubleNaNConverter x:Key="NaNConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="TheGrid" Background="Transparent" Height="960">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="BorderBrush" Value="White"/>
|
||||
<Setter Property="BorderThickness" Value="2"/>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid x:Name="ContentRoot" Loaded="AutoScroll">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!--left time line-->
|
||||
<ColumnDefinition Width="40" x:Name="Col_0"/>
|
||||
<!--monday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_1"/>
|
||||
<!--tuesday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_2"/>
|
||||
<!--wednesday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_3"/>
|
||||
<!--thursday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_4"/>
|
||||
<!--friday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_5"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--time line-->
|
||||
<Border x:Name="TimeBorder" Grid.Row="0" Grid.Column="0">
|
||||
<lui:ListBoxFixed x:Name="TimeList" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionMode="Single">
|
||||
<lui:ListBoxFixed.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Canvas Height="40" Width="40">
|
||||
<TextBlock Text="{Binding}" Canvas.Left="0" Canvas.Top="0" FontSize="12"/>
|
||||
<Line X1="29" Y1="19" X2="39" Y2="19" StrokeThickness="2" Stroke="White"/>
|
||||
<Line X1="0" Y1="0" X2="39" Y2="0" StrokeThickness="1" Stroke="Gray"/>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
</lui:ListBoxFixed.ItemTemplate>
|
||||
</lui:ListBoxFixed>
|
||||
</Border>
|
||||
<!--monday-->
|
||||
<Border x:Name="MonBorder" Grid.Row="0" Grid.Column="1">
|
||||
<weekView:WeekViewDay x:Name="MonList" BgListElements="24" BgListElementHeight="40"/>
|
||||
</Border>
|
||||
<!--tuesday-->
|
||||
<Border x:Name="TueBorder" Grid.Row="0" Grid.Column="2">
|
||||
<weekView:WeekViewDay x:Name="TueList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--wednesday-->
|
||||
<Border x:Name="WedBorder" Grid.Row="0" Grid.Column="3">
|
||||
<weekView:WeekViewDay x:Name="WedList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--thursday-->
|
||||
<Border x:Name="ThuBorder" Grid.Row="0" Grid.Column="4">
|
||||
<weekView:WeekViewDay x:Name="ThuList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--friday-->
|
||||
<Border x:Name="FriBorder" Grid.Row="0" Grid.Column="5">
|
||||
<weekView:WeekViewDay x:Name="FriList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
|
||||
<Grid x:Name="Head_Date" Grid.Row="0" Visibility="{Binding HeadVisible, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="40"/>
|
||||
<ColumnDefinition Width="40"/>
|
||||
<ColumnDefinition Width="40"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock x:Name="TB_KW" Grid.Column="0" Text="{Binding Path=LocalizedResources.Calendar_Week_Short, Source={StaticResource LocalizedStrings}}" FontStretch="SemiExpanded" FontSize="20"/>
|
||||
<TextBlock x:Name="TB_KW_NUM" Grid.Column="1" Text="{Binding WeekNumber, ElementName=root, Mode=OneWay}" FontStretch="Expanded" FontSize="20"/>
|
||||
<TextBlock x:Name="TB_From" Grid.Column="2" Text="{Binding DateFrom, ElementName=root, Mode=OneWay, StringFormat='dd.MM.yyyy'}" HorizontalAlignment="Center" FontSize="20"/>
|
||||
<TextBlock Grid.Column="3" Text="<" HorizontalAlignment="Center" FontSize="20"/>
|
||||
<TextBlock Grid.Column="4" Text="{Binding WeekName, ElementName=root, Mode=OneWay}" HorizontalAlignment="Center" FontSize="20"/>
|
||||
<TextBlock Grid.Column="5" Text=">" HorizontalAlignment="Center" FontSize="20"/>
|
||||
<TextBlock x:Name="TB_To" Grid.Column="6" Text="{Binding DateTo, ElementName=root, Mode=OneWay, StringFormat='dd.MM.yyyy'}" HorizontalAlignment="Center" FontSize="20"/>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="Head_Days" Grid.Row="1" Visibility="{Binding HeadVisible, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="40" x:Name="Col_H_0"/>
|
||||
<!--Mon-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_1"/>
|
||||
<!--Tue-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_2"/>
|
||||
<!--Wed-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_3"/>
|
||||
<!--Thu-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_4"/>
|
||||
<!--Fri-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_5"/>
|
||||
<!--Sat-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_6"/>
|
||||
<!--Sun-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_7"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--__-->
|
||||
<Line Grid.Column="0" X1="0" Y1="0" X2="1" Y2="0" VerticalAlignment="Bottom" Stroke="{StaticResource PhoneForegroundBrush}" Stretch="Fill" StrokeThickness="2" HorizontalAlignment="Left" Margin="-1,0,-1,0"/>
|
||||
<!--Mon-->
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_1_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Monday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Tue-->
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_2_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Tuesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Wed-->
|
||||
<Border
|
||||
Grid.Column="3"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_3_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Wednesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Thu-->
|
||||
<Border
|
||||
Grid.Column="4"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_4_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Thursday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Fri-->
|
||||
<Border
|
||||
Grid.Column="5"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_5_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Friday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Sat-->
|
||||
<Border
|
||||
Grid.Column="6"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_6_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Saturday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Sun-->
|
||||
<Border
|
||||
Grid.Column="7"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_7_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Sunday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer x:Name="TheScrollView" Grid.Row="2">
|
||||
<!--<Canvas x:Name="MainCanvas">-->
|
||||
<!--<Canvas x:Name="UserCanvas" Canvas.ZIndex="12" Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}"/>-->
|
||||
<Grid x:Name="TheGrid"> <!-- Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}"> -->
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="2"/>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!--left time line-->
|
||||
<ColumnDefinition Width="40" x:Name="Col_0"/>
|
||||
<!--monday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_1"/>
|
||||
<!--tuesday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_2"/>
|
||||
<!--wednesday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_3"/>
|
||||
<!--thursday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_4"/>
|
||||
<!--friday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_5"/>
|
||||
<!--saturday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_6"/>
|
||||
<!--sunday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_7"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--time line-->
|
||||
<Border x:Name="TimeBorder" Grid.Row="0" Grid.Column="0">
|
||||
<lui:ListBoxFixed x:Name="TimeList" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
|
||||
<lui:ListBoxFixed.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Canvas Height="40" Width="40">
|
||||
<TextBlock Text="{Binding}" Canvas.Left="0" Canvas.Top="0" FontSize="12"/>
|
||||
<Line X1="29" Y1="19" X2="39" Y2="19" StrokeThickness="2" Stroke="{StaticResource PhoneForegroundBrush}"/>
|
||||
<Line X1="0" Y1="0" X2="39" Y2="0" StrokeThickness="2" Stroke="{StaticResource PhoneForegroundBrush}"/>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
</lui:ListBoxFixed.ItemTemplate>
|
||||
</lui:ListBoxFixed>
|
||||
</Border>
|
||||
<!--monday-->
|
||||
<Border x:Name="MonBorder" Grid.Row="0" Grid.Column="1" Visibility="{Binding Day_1_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="MonList" BgListElements="24" BgListElementHeight="40"/>
|
||||
</Border>
|
||||
<!--tuesday-->
|
||||
<Border x:Name="TueBorder" Grid.Row="0" Grid.Column="2" Visibility="{Binding Day_2_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="TueList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--wednesday-->
|
||||
<Border x:Name="WedBorder" Grid.Row="0" Grid.Column="3" Visibility="{Binding Day_3_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="WedList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--thursday-->
|
||||
<Border x:Name="ThuBorder" Grid.Row="0" Grid.Column="4" Visibility="{Binding Day_4_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="ThuList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--friday-->
|
||||
<Border x:Name="FriBorder" Grid.Row="0" Grid.Column="5" Visibility="{Binding Day_5_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="FriList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--saturday-->
|
||||
<Border x:Name="SatBorder" Grid.Row="0" Grid.Column="6" Visibility="{Binding Day_6_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="SatList" BgListElements="24" BgListElementHeight="40"/>
|
||||
</Border>
|
||||
<!--sunday-->
|
||||
<Border x:Name="SunBorder" Grid.Row="0" Grid.Column="7" Visibility="{Binding Day_7_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="SunList" BgListElements="24" BgListElementHeight="40"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<!-- </Canvas> -->
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -9,24 +9,50 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Media;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System.Windows.Shapes;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Pages.TimeTable;
|
||||
|
||||
/// <summary> A week view. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.Windows.Controls.UserControl"/>
|
||||
public partial class WeekView : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty StartDateProperty = DependencyProperty.Register("StartDate", typeof(DateTime), typeof(WeekView), new PropertyMetadata(null));
|
||||
/// <summary> The date from property. </summary>
|
||||
public static readonly DependencyProperty DateFromProperty = DependencyProperty.Register("DateFrom", typeof(DateTime), typeof(WeekView), new PropertyMetadata(new DateTime(0), OnDateFromChanged));
|
||||
/// <summary> The date to property. </summary>
|
||||
public static readonly DependencyProperty DateToProperty = DependencyProperty.Register("DateTo", typeof(DateTime), typeof(WeekView), new PropertyMetadata(new DateTime(0)));
|
||||
/// <summary> The days property. </summary>
|
||||
public static readonly DependencyProperty DaysProperty = DependencyProperty.Register("Days", typeof(int), typeof(WeekView), new PropertyMetadata(5));
|
||||
/// <summary> The appointments property. </summary>
|
||||
public static readonly DependencyProperty AppointmentsProperty = DependencyProperty.Register("Appointments", typeof(ObservableCollection<AppointmentModel>), typeof(WeekView), new PropertyMetadata(null, OnAppointmentsChanged));
|
||||
/// <summary> The week name property. </summary>
|
||||
public static readonly DependencyProperty WeekNameProperty = DependencyProperty.Register("WeekName", typeof(string), typeof(WeekView), new PropertyMetadata("T-Woche"));
|
||||
/// <summary> The week number property. </summary>
|
||||
public static readonly DependencyProperty WeekNumberProperty = DependencyProperty.Register("WeekNumber", typeof(int), typeof(WeekView), new PropertyMetadata(-1));
|
||||
|
||||
private List<Border> borderList = new List<Border>();
|
||||
public static readonly DependencyProperty HeadVisibleProperty = DependencyProperty.Register("HeadVisible", typeof(bool), typeof(WeekView), new PropertyMetadata(true));
|
||||
|
||||
public static readonly DependencyProperty ToDayColoringProperty = DependencyProperty.Register("ToDayColoring", typeof(bool), typeof(WeekView), new PropertyMetadata(false));
|
||||
|
||||
/// <summary> List of borders. </summary>
|
||||
private List<Border> borderList = new List<Border>();
|
||||
/// <summary> List of days. </summary>
|
||||
private List<WeekViewDay> dayList = new List<WeekViewDay>();
|
||||
|
||||
/// <summary> The time strings. </summary>
|
||||
private string[] timeStrings = new string[24];
|
||||
/// <summary> The monitor strings. </summary>
|
||||
private string[] monStrings = new string[24];
|
||||
|
||||
/// <summary> Initializes a new instance of the WeekView class. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
public WeekView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
@@ -34,19 +60,340 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
this.InitLayout();
|
||||
}
|
||||
|
||||
public DateTime StartDate
|
||||
/// <summary> Raises the dependency property changed event. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="o"> The DependencyObject to process. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private static void OnDateFromChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
(o as WeekView).SetValue(DateToProperty, ((DateTime)e.NewValue).AddDays(6));
|
||||
|
||||
for (int i = 0; i < (o as WeekView).dayList.Count; i++)
|
||||
{
|
||||
(o as WeekView).dayList[i].Date = ((DateTime)e.NewValue).AddDays(i);
|
||||
}
|
||||
|
||||
if ((o as WeekView).ToDayColoring == true)
|
||||
{
|
||||
TimeSpan diff = DateTime.Today.Subtract((o as WeekView).DateFrom);
|
||||
|
||||
if (diff.TotalDays >= 0 && diff.TotalDays < 5)
|
||||
{
|
||||
(o as WeekView).SetColumnBackground(diff.Days, new SolidColorBrush(Colors.Orange));
|
||||
}
|
||||
else
|
||||
{
|
||||
(o as WeekView).ClearBackground();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the dependency property changed event. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="o"> The DependencyObject to process. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private static void OnAppointmentsChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.NewValue != null)
|
||||
{
|
||||
(e.NewValue as ObservableCollection<AppointmentModel>).CollectionChanged += (o as WeekView).OnAppointmentListChanged;
|
||||
(o as WeekView).SeperateAppointments(e.NewValue as ObservableCollection<AppointmentModel>);
|
||||
}
|
||||
|
||||
if (e.OldValue != null)
|
||||
{
|
||||
(e.OldValue as ObservableCollection<AppointmentModel>).CollectionChanged -= (o as WeekView).OnAppointmentListChanged;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the notify collection changed event. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="s"> The object to process. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnAppointmentListChanged(object s, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
for (int i = 0; i < e.NewItems.Count; i++)
|
||||
{
|
||||
this.SeperateAppointments(e.NewItems[i] as AppointmentModel, e.Action);
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
for (int i = 0; i < e.OldItems.Count; i++)
|
||||
{
|
||||
this.SeperateAppointments(e.OldItems[i] as AppointmentModel, e.Action);
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
this.ClearDays();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Clears the days. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
private void ClearDays()
|
||||
{
|
||||
for (int i = 0; i < this.dayList.Count; i++)
|
||||
{
|
||||
this.dayList[i].Appointments.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Seperate appointments. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="list"> The list. </param>
|
||||
private void SeperateAppointments(ObservableCollection<AppointmentModel> list)
|
||||
{
|
||||
foreach (AppointmentModel m in list)
|
||||
{
|
||||
this.SeperateAppointments(m, NotifyCollectionChangedAction.Add);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Seperate appointments. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="action"> The action. </param>
|
||||
private void SeperateAppointments(AppointmentModel model, NotifyCollectionChangedAction action)
|
||||
{
|
||||
for(int i = 0; i < this.dayList.Count; i++)
|
||||
{
|
||||
if (model.IsDate(this.DateFrom.AddDays(i)) == 0)
|
||||
{
|
||||
if (action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
this.dayList[i].Appointments.Add(model);
|
||||
}
|
||||
else if (action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
this.dayList[i].Appointments.Remove(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the Date/Time of the date from. </summary>
|
||||
/// <value> The date from. </value>
|
||||
public DateTime DateFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DateTime)this.GetValue(StartDateProperty);
|
||||
return (DateTime)this.GetValue(DateFromProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(StartDateProperty, value);
|
||||
this.SetValue(DateFromProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the Date/Time of the date to. </summary>
|
||||
/// <value> The date to. </value>
|
||||
public DateTime DateTo
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DateTime)this.GetValue(DateToProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(DateToProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the days. </summary>
|
||||
/// <value> The days. </value>
|
||||
public int Days
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)this.GetValue(DaysProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(DaysProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the appointments. </summary>
|
||||
/// <value> The appointments. </value>
|
||||
public ObservableCollection<AppointmentModel> Appointments
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ObservableCollection<AppointmentModel>)this.GetValue(AppointmentsProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(AppointmentsProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the name of the week. </summary>
|
||||
/// <value> The name of the week. </value>
|
||||
public string WeekName
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)this.GetValue(WeekNameProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(WeekNameProperty, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the week number. </summary>
|
||||
/// <value> The week number. </value>
|
||||
public int WeekNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)this.GetValue(WeekNumberProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(WeekNumberProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool HeadVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return (bool)this.GetValue(HeadVisibleProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(HeadVisibleProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ToDayColoring
|
||||
{
|
||||
get
|
||||
{
|
||||
return (bool)this.GetValue(ToDayColoringProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(ToDayColoringProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_1_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 0) && (this.Col_1.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_1.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_1.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 0);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_2_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 1) && (this.Col_2.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_2.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_2.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 1);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_3_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 2) && (this.Col_3.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_3.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_3.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 2);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_4_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 3) && (this.Col_4.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_4.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_4.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 3);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_5_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 4) && (this.Col_5.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_5.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_5.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 4);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_6_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 5) && (this.Col_6.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_6.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_6.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 5);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_7_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 6) && (this.Col_7.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_7.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_7.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 6);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Sets column background. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="column"> The column. </param>
|
||||
/// <param name="brush"> (Optional) the brush. </param>
|
||||
public void SetColumnBackground(int column, Brush brush = null)
|
||||
{
|
||||
if (column < this.borderList.Count())
|
||||
@@ -55,6 +402,20 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Clears the background. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
public void ClearBackground()
|
||||
{
|
||||
SolidColorBrush newBrush = new SolidColorBrush(Colors.Transparent);
|
||||
|
||||
for (int i = 0; i < this.borderList.Count; i++)
|
||||
{
|
||||
this.borderList[i].Background = newBrush;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Initialises the layout. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
private void InitLayout()
|
||||
{
|
||||
for (int i = 0; i < 24; i++)
|
||||
@@ -69,13 +430,34 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
this.borderList.Add(this.ThuBorder);
|
||||
this.borderList.Add(this.FriBorder);
|
||||
|
||||
this.TimeList.ItemsSource = this.timeStrings;
|
||||
this.dayList.Add(this.MonList);
|
||||
this.dayList.Add(this.TueList);
|
||||
this.dayList.Add(this.WedList);
|
||||
this.dayList.Add(this.ThuList);
|
||||
this.dayList.Add(this.FriList);
|
||||
|
||||
this.TimeList.ItemsSource = this.timeStrings;
|
||||
}
|
||||
|
||||
/// <summary> Automatic scroll. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void AutoScroll(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.TheScrollView.ScrollToVerticalOffset((TimeTable.Setting_Hour_Spacing * 7) + 2);
|
||||
}
|
||||
|
||||
private void DrawMultiBubble()
|
||||
{
|
||||
Rectangle circle = new Rectangle();
|
||||
|
||||
circle.RadiusX = 10;
|
||||
circle.RadiusY = 10;
|
||||
circle.Width = 20;
|
||||
circle.Height = 20;
|
||||
|
||||
|
||||
//this.MonList.ItemsSource = this.monStrings;
|
||||
//this.TueList.ItemsSource = this.monStrings;
|
||||
//this.WedList.ItemsSource = this.monStrings;
|
||||
//this.ThuList.ItemsSource = this.monStrings;
|
||||
//this.FriList.ItemsSource = this.monStrings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,32 +3,42 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:utility="clr-namespace:CampusAppWP8.Utility"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
x:Name="root"
|
||||
>
|
||||
|
||||
<Grid x:Name="TheGrid">
|
||||
<UserControl.Resources>
|
||||
<utility:DoubleNaNConverter x:Key="NaNConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="TheGrid" Width="{Binding Path=Width, ElementName=root, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Canvas x:Name="MainCanvas" Grid.Row="0" Grid.Column="0">
|
||||
|
||||
<Canvas
|
||||
x:Name="MainCanvas"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
>
|
||||
<Canvas
|
||||
x:Name="BGCanvas"
|
||||
Canvas.ZIndex="1"
|
||||
Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=ActualWidth, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=Width, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}"
|
||||
/>
|
||||
<Canvas
|
||||
x:Name="UserCanvas"
|
||||
Canvas.ZIndex="2"
|
||||
Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=ActualWidth, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=Width, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}"
|
||||
/>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
@@ -20,19 +22,119 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Data;
|
||||
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary> A week view day. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.Windows.Controls.UserControl"/>
|
||||
public partial class WeekViewDay : UserControl
|
||||
{
|
||||
/// <summary> The background list elements property. </summary>
|
||||
public static readonly DependencyProperty BgListElementsProperty = DependencyProperty.Register("BgListElements", typeof(int), typeof(WeekViewDay), new PropertyMetadata(null));
|
||||
|
||||
/// <summary> The background list element height property. </summary>
|
||||
public static readonly DependencyProperty BgListElementHeightProperty = DependencyProperty.Register("BgListElementHeight", typeof(double), typeof(WeekViewDay), new PropertyMetadata(null));
|
||||
|
||||
/// <summary> The date property. </summary>
|
||||
public static readonly DependencyProperty DateProperty = DependencyProperty.Register("Date", typeof(DateTime), typeof(WeekViewDay), new PropertyMetadata(DateTime.Today));
|
||||
|
||||
/// <summary> The appointments property. </summary>
|
||||
public static readonly DependencyProperty AppointmentsProperty = DependencyProperty.Register("Appointments", typeof(ObservableCollection<AppointmentModel>), typeof(WeekViewDay), new PropertyMetadata(null, OnAppointmentsChanged));
|
||||
|
||||
/// <summary> The stacks. </summary>
|
||||
private List<List<AppointmentModel>> stacks = new List<List<AppointmentModel>>();
|
||||
|
||||
/// <summary> Initializes a new instance of the WeekViewDay class. </summary>
|
||||
/// <remarks> Fiedler, 22.10.2013. </remarks>
|
||||
public WeekViewDay()
|
||||
{
|
||||
this.Appointments = new ObservableCollection<AppointmentModel>();
|
||||
|
||||
this.InitializeComponent();
|
||||
|
||||
this.TheGrid.SizeChanged += new SizeChangedEventHandler(this.TheGridSizeChanged);
|
||||
}
|
||||
|
||||
private void TheGridSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
this.MainCanvas.Width = e.NewSize.Width;
|
||||
}
|
||||
|
||||
/// <summary> Raises the dependency property changed event. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="o"> The DependencyObject to process. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private static void OnAppointmentsChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if(e.NewValue != null)
|
||||
{
|
||||
(e.NewValue as ObservableCollection<AppointmentModel>).CollectionChanged += (o as WeekViewDay).OnAppointmentListChanged;
|
||||
}
|
||||
|
||||
if (e.OldValue != null)
|
||||
{
|
||||
(e.OldValue as ObservableCollection<AppointmentModel>).CollectionChanged -= (o as WeekViewDay).OnAppointmentListChanged;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the notify collection changed event. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="s"> The object to process. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
private void OnAppointmentListChanged(object s, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
for (int i = 0; i < e.NewItems.Count; i++)
|
||||
{
|
||||
this.CheckStackAdd(e.NewItems[i] as AppointmentModel);
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
for (int i = 0; i < e.OldItems.Count; i++)
|
||||
{
|
||||
this.CheckStackRemove(e.OldItems[i] as AppointmentModel);
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
this.UserCanvas.Children.Clear();
|
||||
this.stacks.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the appointments. </summary>
|
||||
/// <value> The appointments. </value>
|
||||
public ObservableCollection<AppointmentModel> Appointments
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ObservableCollection<AppointmentModel>)this.GetValue(AppointmentsProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(AppointmentsProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary> Gets or sets the Date/Time of the date. </summary>
|
||||
/// <value> The date. </value>
|
||||
public DateTime Date
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DateTime)this.GetValue(DateProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(DateProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the background list elements. </summary>
|
||||
@@ -75,6 +177,257 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Check stack add. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
private void CheckStackAdd(AppointmentModel model)
|
||||
{
|
||||
int[] intersect = model.IntersectArray(this.Appointments.ToArray<AppointmentModel>());
|
||||
|
||||
if (intersect.Count() == 0)
|
||||
{
|
||||
this.DrawApp(model, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<int> intersecStack = new List<int>();
|
||||
|
||||
for (int i = 0; i < intersect.Count(); i++)
|
||||
{
|
||||
for (int s = 0; s < this.stacks.Count; s++)
|
||||
{
|
||||
if (this.stacks[s].IndexOf(this.Appointments[i]) >= 0)
|
||||
{
|
||||
intersecStack.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (intersecStack.Count == 0)
|
||||
{
|
||||
List<AppointmentModel> newStack = new List<AppointmentModel>();
|
||||
|
||||
for (int k = 0; k < intersect.Count(); k++)
|
||||
{
|
||||
newStack.Add(this.Appointments[intersect[k]]);
|
||||
}
|
||||
|
||||
newStack.Add(model);
|
||||
this.stacks.Add(newStack);
|
||||
|
||||
this.DrawStack(model, newStack);
|
||||
}
|
||||
else if (intersecStack.Count == 1)
|
||||
{
|
||||
this.stacks[intersecStack[0]].Add(model);
|
||||
this.DrawStack(model, this.stacks[intersecStack[0]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<AppointmentModel> newStack = new List<AppointmentModel>();
|
||||
List<List<AppointmentModel>> tempStackList = new List<List<AppointmentModel>>();
|
||||
|
||||
for (int k = 0; k < intersecStack.Count; k++)
|
||||
{
|
||||
tempStackList.Add(this.stacks[intersecStack[k]]);
|
||||
newStack.AddRange(this.stacks[intersecStack[k]]);
|
||||
}
|
||||
|
||||
newStack.Add(model);
|
||||
|
||||
for (int k = 0; k < tempStackList.Count; k++)
|
||||
{
|
||||
this.stacks.Remove(tempStackList[k]);
|
||||
}
|
||||
|
||||
this.stacks.Add(newStack);
|
||||
|
||||
this.DrawStack(model, newStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Check stack remove. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
private void CheckStackRemove(AppointmentModel model)
|
||||
{
|
||||
int stackIndex = -1;
|
||||
|
||||
for (int i = 0; i < this.stacks.Count; i++)
|
||||
{
|
||||
if (this.stacks[i].IndexOf(model) >= 0)
|
||||
{
|
||||
stackIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackIndex >= 0)
|
||||
{
|
||||
this.stacks[stackIndex].Remove(model);
|
||||
|
||||
this.DrawStack(null, this.stacks[stackIndex]);
|
||||
|
||||
if (this.stacks[stackIndex].Count <= 1)
|
||||
{
|
||||
this.stacks.RemoveAt(stackIndex);
|
||||
}
|
||||
}
|
||||
|
||||
int removeIndex = -1;
|
||||
|
||||
for (int i = 0; i < this.UserCanvas.Children.Count; i++)
|
||||
{
|
||||
if ((this.UserCanvas.Children[i] as AppointmentCanvas).Is(model))
|
||||
{
|
||||
removeIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (removeIndex >= 0)
|
||||
{
|
||||
this.UserCanvas.Children.RemoveAt(removeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Draw stack. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="newModel"> The new model. </param>
|
||||
/// <param name="stack"> The stack. </param>
|
||||
private void DrawStack(AppointmentModel newModel, List<AppointmentModel> stack)
|
||||
{
|
||||
for (int i = 0; i < stack.Count; i++)
|
||||
{
|
||||
if (stack[i].Equals(newModel))
|
||||
{
|
||||
this.DrawApp(newModel, stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ManipulateAppCanvas(stack[i], i, stack.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Manipulate application canvas. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="stackIndex"> Zero-based index of the stack. </param>
|
||||
private void ManipulateAppCanvas(AppointmentModel model, int stackIndex)
|
||||
{
|
||||
if (stackIndex < this.stacks.Count)
|
||||
{
|
||||
this.ManipulateAppCanvas(model, this.stacks[stackIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Manipulate application canvas. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="list"> The list. </param>
|
||||
private void ManipulateAppCanvas(AppointmentModel model, List<AppointmentModel> list)
|
||||
{
|
||||
int index = list.IndexOf(model);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
this.ManipulateAppCanvas(model, index, list.Count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Manipulate application canvas. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="index"> Zero-based index of the. </param>
|
||||
/// <param name="count"> Number of. </param>
|
||||
private void ManipulateAppCanvas(AppointmentModel model, int index, int count)
|
||||
{
|
||||
AppointmentCanvas can = null;
|
||||
|
||||
for (int i = 0; i < this.UserCanvas.Children.Count; i++)
|
||||
{
|
||||
if ((this.UserCanvas.Children[i] as AppointmentCanvas).Is(model))
|
||||
{
|
||||
can = this.UserCanvas.Children[i] as AppointmentCanvas;
|
||||
}
|
||||
}
|
||||
|
||||
if (can != null)
|
||||
{
|
||||
can.SetListPosition(index, count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Draw application. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="stackIndex"> (Optional) Zero-based index of the stack. </param>
|
||||
private void DrawApp(AppointmentModel model, int stackIndex = -1)
|
||||
{
|
||||
if (stackIndex >= 0)
|
||||
{
|
||||
this.DrawApp(model, this.stacks[stackIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DrawApp(model, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Draw application. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
/// <param name="stack"> (Optional) The stack. </param>
|
||||
private void DrawApp(AppointmentModel model, List<AppointmentModel> stack = null)
|
||||
{
|
||||
AppointmentCanvas newCan = new AppointmentCanvas(model, this.Date);
|
||||
|
||||
newCan.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(model.OnCanvasClick);
|
||||
|
||||
Binding widthBind = new Binding("Width");
|
||||
widthBind.ElementName = "UserCanvas";
|
||||
widthBind.Converter = new DoubleNaNConverter();
|
||||
widthBind.Mode = BindingMode.OneWay;
|
||||
newCan.SetBinding(WidthProperty, widthBind);
|
||||
|
||||
if (stack != null)
|
||||
{
|
||||
newCan.SetListPosition(stack);
|
||||
}
|
||||
|
||||
this.UserCanvas.Children.Add(newCan);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary> Un draw application. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
private void UnDrawApp(AppointmentModel model)
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < this.UserCanvas.Children.Count; i++)
|
||||
{
|
||||
if ((this.UserCanvas.Children[i] as AppointmentCanvas).Is(model))
|
||||
{
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
this.UserCanvas.Children.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
protected override void OnDoubleTap(System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
base.OnDoubleTap(e);
|
||||
}
|
||||
*/
|
||||
|
||||
/// <summary> Draw lines. </summary>
|
||||
/// <remarks> Fiedler, 22.10.2013. </remarks>
|
||||
private void DrawLines()
|
||||
@@ -85,8 +438,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
this.BGCanvas.Children.Clear();
|
||||
|
||||
Binding colLineBind = new Binding();
|
||||
colLineBind.Path = new PropertyPath("ActualWidth");
|
||||
colLineBind.ElementName = "MainCanvas";
|
||||
colLineBind.Path = new PropertyPath("Width");
|
||||
colLineBind.ElementName = "BGCanvas";
|
||||
colLineBind.Converter = new DoubleNaNConverter();
|
||||
colLineBind.Mode = BindingMode.OneWay;
|
||||
|
||||
for (int i = 1; i < this.BgListElements; i++)
|
||||
|
||||
100
CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
Normal file
100
CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MealIdToPriceConverter.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>14.11.2013</date>
|
||||
// <summary>Implements the meal identifier to price converter class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
using CampusAppWP8.Feed.Mensa;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWPortalLib8.Model.Mensa;
|
||||
|
||||
/// <summary> A meal identifier to price converter. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.Windows.Data.IValueConverter"/>
|
||||
public sealed class MealIdToPriceConverter : IValueConverter
|
||||
{
|
||||
/// <summary> The price feed. </summary>
|
||||
private PriceFeed priceFeed = null;
|
||||
|
||||
/// <summary> Initializes a new instance of the MealIdToPriceConverter class. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
public MealIdToPriceConverter()
|
||||
{
|
||||
this.priceFeed = new PriceFeed();
|
||||
this.priceFeed.OnLoaded += this.PriceFeedIsReady;
|
||||
this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
|
||||
this.priceFeed.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Data.IValueConverter.Convert(object,Type,object,System.Globalization.CultureInfo)"/>
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
int intVal = -1;
|
||||
int intParam = -1;
|
||||
|
||||
if (value is int)
|
||||
{
|
||||
intVal = (int)value;
|
||||
}
|
||||
else if(value is string)
|
||||
{
|
||||
intVal = int.Parse((string)value);
|
||||
}
|
||||
|
||||
if (parameter is int)
|
||||
{
|
||||
intParam = (int)parameter;
|
||||
}
|
||||
else if (parameter is string)
|
||||
{
|
||||
intParam = int.Parse((string)parameter);
|
||||
}
|
||||
|
||||
if ((intVal >= 0) && (intParam >= 0))
|
||||
{
|
||||
if (this.priceFeed != null && this.priceFeed.Model != null)
|
||||
{
|
||||
PriceMealModel model = this.priceFeed.Model.GetCanteen(intParam).GetPriceMealModel(intVal);
|
||||
retValue = AppResources.Students + ": " + model.PriceStudentStr + " € " + AppResources.Employees + ": " + model.PriceEmployeeStr + " € " + AppResources.Guests + ": " + model.PriceGuestStr + " €";
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in
|
||||
/// <see cref="F:System.Windows.Data.BindingMode.TwoWay" />-Bindungen aufgerufen.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Data.IValueConverter.ConvertBack(object,Type,object,System.Globalization.CultureInfo)"/>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary> Price feed is ready. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
private void PriceFeedIsReady()
|
||||
{
|
||||
this.priceFeed.SaveData();
|
||||
}
|
||||
|
||||
/// <summary> Price feed is failed. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
private void PriceFeedIsFailed()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user