Merge branch 'feature/#173' into develop
This commit is contained in:
@@ -102,6 +102,7 @@
|
||||
<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" />
|
||||
@@ -142,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>
|
||||
@@ -152,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" />
|
||||
@@ -249,6 +253,9 @@
|
||||
<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>
|
||||
@@ -535,6 +542,7 @@
|
||||
<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>
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
@@ -423,6 +437,8 @@ namespace CampusAppWP8.Pages
|
||||
}
|
||||
else
|
||||
{
|
||||
this.GoToAppointment(nfcContent);
|
||||
/* removed for testing
|
||||
if (AppSettings.BTUTagDefaultHandler.CampusMap == Settings.AppSetting.TagDefaultHandler)
|
||||
{
|
||||
// search for placeId
|
||||
@@ -439,6 +455,7 @@ namespace CampusAppWP8.Pages
|
||||
this.ShowBtuTagMessageBox();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);
|
||||
@@ -450,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)
|
||||
{
|
||||
@@ -480,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>
|
||||
|
||||
@@ -596,6 +596,9 @@
|
||||
<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>
|
||||
|
||||
@@ -594,6 +594,15 @@
|
||||
<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>
|
||||
|
||||
@@ -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>
|
||||
@@ -717,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>
|
||||
@@ -1185,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>
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -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,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++)
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace CampusAppWPortalLib8.Model.Departments
|
||||
|
||||
foreach (FacultyModel temp in this.Faculties)
|
||||
{
|
||||
if ((temp.HasChanged() == true) && (retValue == false))
|
||||
if (temp.HasChanged() == true)
|
||||
{
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user