timetable ui
This commit is contained in:
@@ -130,8 +130,9 @@
|
||||
<Compile Include="Pages\TimeTable\TimeTableDay.xaml.cs">
|
||||
<DependentUpon>TimeTableDay.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\ICalObject.cs" />
|
||||
<Compile Include="Utility\ICSClasses.cs" />
|
||||
<Compile Include="Utility\ICSObject.cs" />
|
||||
<Compile Include="Utility\ICSManager.cs" />
|
||||
<Compile Include="Utility\ICSObjectConst.cs" />
|
||||
<Compile Include="Utility\ICSProperties\AccessClass.cs" />
|
||||
<Compile Include="Utility\ICSProperties\Action.cs" />
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Serialization;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
@@ -24,17 +26,18 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
/// <summary>The Visual object.</summary>
|
||||
private Rectangle rect = null;
|
||||
|
||||
private ICSObject icsObj;
|
||||
private ICalObject icalObj = null;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="AppointmentModel" /> class. </summary>
|
||||
public AppointmentModel()
|
||||
{
|
||||
this.icsObj = new ICSObject();
|
||||
this.rect = new Rectangle();
|
||||
}
|
||||
|
||||
public AppointmentModel(string icsData) : this()
|
||||
{
|
||||
this.icsObj.ImportFromICS(icsData);
|
||||
this.icalObj = ICSManager.ImportFromICS(icsData);
|
||||
this.CalcRect();
|
||||
}
|
||||
|
||||
public Rectangle GetRectangle()
|
||||
@@ -42,9 +45,33 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
return this.rect;
|
||||
}
|
||||
|
||||
|
||||
private void CreateRect()
|
||||
private void CalcRect()
|
||||
{
|
||||
this.rect.Width = 200;
|
||||
this.rect.MinHeight = 16;
|
||||
this.rect.MaxHeight = 600;
|
||||
this.rect.Height = 200;
|
||||
|
||||
this.rect.StrokeThickness = 4;
|
||||
|
||||
SolidColorBrush borderBrush = new SolidColorBrush();
|
||||
borderBrush.Color = Colors.Red;
|
||||
|
||||
this.rect.Stroke = borderBrush;
|
||||
|
||||
Vis
|
||||
|
||||
VisualBrush myBrush = new VisualBrush();
|
||||
StackPanel aPanel = new StackPanel();
|
||||
|
||||
|
||||
if (this.icalObj != null)
|
||||
{
|
||||
TextBlock tb = new TextBlock();
|
||||
tb.Text = this.icalObj.Header.Value;
|
||||
|
||||
this.rect.Resources = tb;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,24 +14,22 @@
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot Title="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<!--Pivotelement eins-->
|
||||
<Grid x:Name="LayoutRoot" Background="Beige"> <!--Background="Transparent"-->
|
||||
<!--Pivotsteuerelement
|
||||
<phone:Pivot x:Name="thePivot" Title="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:PivotItem Header="So 21.08.2013">
|
||||
<Grid/>
|
||||
<Grid x:Name="TestGrid"/>
|
||||
</phone:PivotItem>
|
||||
|
||||
<!--Pivotelement zwei-->
|
||||
<phone:PivotItem Header="Mo 22.08.2013">
|
||||
<Grid/>
|
||||
</phone:PivotItem>
|
||||
|
||||
<!--3. Element-->
|
||||
<phone:PivotItem Header="Di 23.08.2013">
|
||||
<Grid/>
|
||||
</phone:PivotItem>
|
||||
</phone:Pivot>
|
||||
-->
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -8,7 +8,7 @@ using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
@@ -20,6 +20,23 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
InitializeComponent();
|
||||
this.testMod = 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:20130828\r\nDTEND;VALUE=DATE:20130829\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");
|
||||
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
//List<DependencyObject> elemList = Utilities.GetChild(this.thePivot.Items[0] as UIElement, "TestGrid");
|
||||
|
||||
//if (elemList.Count() > 0)
|
||||
{
|
||||
TextBlock tb = new TextBlock();
|
||||
tb.Text = "kk";
|
||||
|
||||
this.LayoutRoot.Children.Add(tb);
|
||||
this.LayoutRoot.Children.Add(this.testMod.GetRectangle());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,243 +0,0 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="ICSObject.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>27.08.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>Ics object. </summary>
|
||||
public class ICSObject
|
||||
{
|
||||
private List<ICSDict.ICSValueDesc> readParentList = null;
|
||||
|
||||
private struct VCalendar
|
||||
{
|
||||
public List<object> props;
|
||||
}
|
||||
|
||||
private struct VEvent
|
||||
{
|
||||
public List<object> props;
|
||||
}
|
||||
|
||||
private struct ContentLine
|
||||
{
|
||||
public string name;
|
||||
public List<string> paramList;
|
||||
//public List<string> valueList;
|
||||
public string valueString;
|
||||
}
|
||||
|
||||
private Dictionary<string, object> data = null;
|
||||
|
||||
|
||||
/// <summary>Default constructor. </summary>
|
||||
/// <remarks>Fiedler, 27.08.2013. </remarks>
|
||||
public ICSObject()
|
||||
{
|
||||
this.readParentList = new List<ICSDict.ICSValueDesc>();
|
||||
this.data = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
public ICSObject(string icsData) : this()
|
||||
{
|
||||
this.ImportFromICS(icsData);
|
||||
}
|
||||
|
||||
public void ImportFromICS(string icsData)
|
||||
{
|
||||
string[] elems = Regex.Split(this.Unfold(icsData), "\r\n");
|
||||
|
||||
List<ICSDict.ICSValueDesc> parentList = new List<ICSDict.ICSValueDesc>();
|
||||
parentList.Add(ICSDict.Root);
|
||||
|
||||
foreach (string e in elems)
|
||||
{
|
||||
ContentLine prop = this.ToContentLine(e);
|
||||
ICSDict.ICSElemDesc tempElem = null;
|
||||
|
||||
if ((tempElem = parentList.Last().GetValue(prop.name)) != null)
|
||||
{
|
||||
object propObj = tempElem.CreateObj(prop.valueString, prop.paramList.ToArray());
|
||||
|
||||
ICSDict.ICSValueDesc va = null;
|
||||
|
||||
if (this.Is((propObj as ICSClasses.Interface).GetName(), ICSTag.BEGIN))
|
||||
{
|
||||
parentList.Add(this.GetSubValue((propObj as ICSProperties.Begin).Value, tempElem));
|
||||
}
|
||||
else if (this.Is((propObj as ICSClasses.Interface).GetName(), ICSTag.END))
|
||||
{
|
||||
if (this.GetSubValue((propObj as ICSProperties.End).Value, tempElem) != null)
|
||||
{
|
||||
parentList.RemoveAt(parentList.Count - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prop.name.IndexOf("X-") == 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("Tag (" + prop.name + ") was not found in (" + parentList.Last().Name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public string ExportToICS()
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
// TOOLS
|
||||
|
||||
private DateTime ParseUTCDateTime(string datetime)
|
||||
{
|
||||
// see http://tools.ietf.org/html/rfc5545 3.3.5.
|
||||
|
||||
datetime = datetime.Insert(4, "-");
|
||||
datetime = datetime.Insert(7, "-");
|
||||
datetime = datetime.Insert(13, ":");
|
||||
datetime = datetime.Insert(16, ":");
|
||||
|
||||
return DateTime.Parse(datetime);
|
||||
}
|
||||
|
||||
private DateTime ParseUTCDate(string date)
|
||||
{
|
||||
date = date.Insert(4, "-");
|
||||
date = date.Insert(7, "-");
|
||||
|
||||
return DateTime.Parse(date);
|
||||
}
|
||||
|
||||
private string Unfold(string icsData)
|
||||
{
|
||||
return icsData.Replace("\r\n ", "").Replace("\r\n\x09", "");
|
||||
}
|
||||
|
||||
private string Fold(string data)
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
string[] lines = Regex.Split(data, "\r\n");
|
||||
|
||||
for (int i = 0; i < lines.Count(); i++)
|
||||
{
|
||||
for (int k = 0; k < lines[i].Length; )
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
retValue += lines[i].Substring(k, (((lines[i].Length - k - 75) >= 0) ? 75 : (lines[i].Length - k)));
|
||||
k += 75;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue += " " + lines[i].Substring(k, (((lines[i].Length - k - 74) >= 0) ? 74 : (lines[i].Length - k)));
|
||||
k += 74;
|
||||
}
|
||||
|
||||
retValue += "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private string[] SplitParam(string paramStr)
|
||||
{
|
||||
return paramStr.Split('=');
|
||||
}
|
||||
|
||||
private ICSDict.ICSValueDesc GetSubValue(string tag, ICSDict.ICSElemDesc elemDesc)
|
||||
{
|
||||
ICSDict.ICSValueDesc retValue = null;
|
||||
|
||||
if ((retValue = elemDesc.GetValue(tag)) == null)
|
||||
{
|
||||
throw new NotSupportedException("Tag (" + tag + ") was not found in VALUE list of (" + elemDesc.Name + ")");
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private bool Is(ContentLine obj, string tag)
|
||||
{
|
||||
return obj.name.Equals(tag);
|
||||
}
|
||||
|
||||
private bool Is(string str1, string str2)
|
||||
{
|
||||
return str1.Equals(str2);
|
||||
}
|
||||
|
||||
/// <summary>Converts an icsLine to a content line.</summary>
|
||||
/// <remarks>Fiedler, 27.08.2013. </remarks>
|
||||
/// <exception cref="NotImplementedException">Thrown when the requested operation is unimplemented.</exception>
|
||||
/// <param name="icsLine">The ics line.</param>
|
||||
/// <returns>icsLine as a ContentLine. </returns>
|
||||
private ContentLine ToContentLine(string icsLine)
|
||||
{
|
||||
ContentLine retValue;
|
||||
|
||||
string[] valueSplit = icsLine.Split(new char[] {':'}, 2);
|
||||
|
||||
if (valueSplit.Length != 2)
|
||||
{
|
||||
throw new NotSupportedException("ics string has no value");
|
||||
}
|
||||
|
||||
// values
|
||||
//retValue.valueList = new List<string>();
|
||||
//retValue.valueList.AddRange(valueSplit[1].Split(','));
|
||||
retValue.valueString = valueSplit[1];
|
||||
|
||||
// params
|
||||
int paramNum = StringManager.CountChar(valueSplit[0], ';');
|
||||
|
||||
if (paramNum > 0)
|
||||
{
|
||||
retValue.paramList = new List<string>();
|
||||
|
||||
string[] paramSplit = valueSplit[0].Split(';');
|
||||
|
||||
retValue.name = paramSplit[0].ToUpper();
|
||||
|
||||
for (int i = 1; i < paramSplit.Length; i++)
|
||||
{
|
||||
retValue.paramList.Add(paramSplit[i].ToUpper());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue.paramList = null;
|
||||
retValue.name = valueSplit[0].ToUpper();
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,9 +72,12 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <param name="paramStrList">List of parameter strings.</param>
|
||||
public override void Set(string valueStr, string[] paramStrList)
|
||||
{
|
||||
if (paramStrList.Count() > 0)
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("in (" + Name + ") is no param supported");
|
||||
if (paramStrList.Count() > 0)
|
||||
{
|
||||
throw new NotSupportedException("in (" + Name + ") is no param supported");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ValueList.IndexOf(valueStr) >= 0)
|
||||
|
||||
@@ -77,27 +77,30 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <param name="paramStrList">List of parameter strings.</param>
|
||||
public override void Set(string valueStr, string[] paramStrList)
|
||||
{
|
||||
if (paramStrList.Count() > 1)
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("in (" + Name + ") is only the (" + ICSParam.LANGUAGE + ") param supported");
|
||||
}
|
||||
else if (paramStrList.Count() == 1)
|
||||
{
|
||||
string[] p = paramStrList[0].Split('=');
|
||||
|
||||
if (p.Length != 2)
|
||||
if (paramStrList.Count() > 1)
|
||||
{
|
||||
throw new NotSupportedException("the number of '=' in the parameter (" + paramStrList[0] + ") is less or greater then 1");
|
||||
throw new NotSupportedException("in (" + Name + ") is only the (" + ICSParam.LANGUAGE + ") param supported");
|
||||
}
|
||||
|
||||
switch (p[0])
|
||||
else if (paramStrList.Count() == 1)
|
||||
{
|
||||
case ICSParam.LANGUAGE:
|
||||
this.languageType = p[1];
|
||||
break;
|
||||
string[] p = paramStrList[0].Split('=');
|
||||
|
||||
default:
|
||||
throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported");
|
||||
if (p.Length != 2)
|
||||
{
|
||||
throw new NotSupportedException("the number of '=' in the parameter (" + paramStrList[0] + ") is less or greater then 1");
|
||||
}
|
||||
|
||||
switch (p[0])
|
||||
{
|
||||
case ICSParam.LANGUAGE:
|
||||
this.languageType = p[1];
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,27 +95,30 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <param name="paramStrList">List of parameter strings.</param>
|
||||
public override void Set(string valueStr, string[] paramStrList)
|
||||
{
|
||||
foreach (string param in paramStrList)
|
||||
if (paramStrList != null)
|
||||
{
|
||||
string[] p = param.Split('=');
|
||||
|
||||
if (p.Count() != 2)
|
||||
foreach (string param in paramStrList)
|
||||
{
|
||||
throw new NotSupportedException("the number of '=' in the parameter (" + param + ") is less or greater then 1");
|
||||
}
|
||||
string[] p = param.Split('=');
|
||||
|
||||
switch (p[0])
|
||||
{
|
||||
case ICSParam.LANGUAGE:
|
||||
this.languageType = p[1];
|
||||
break;
|
||||
case ICSParam.ALT_REPRESENTATION:
|
||||
// TODO: test, remove DQUOTES "
|
||||
this.altrep = p[1];
|
||||
break;
|
||||
if (p.Count() != 2)
|
||||
{
|
||||
throw new NotSupportedException("the number of '=' in the parameter (" + param + ") is less or greater then 1");
|
||||
}
|
||||
|
||||
default:
|
||||
throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported");
|
||||
switch (p[0])
|
||||
{
|
||||
case ICSParam.LANGUAGE:
|
||||
this.languageType = p[1];
|
||||
break;
|
||||
case ICSParam.ALT_REPRESENTATION:
|
||||
// TODO: test, remove DQUOTES "
|
||||
this.altrep = p[1];
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,15 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
|
||||
/// <summary>Options for controlling the operation. </summary>
|
||||
public static readonly List<Tuple<string, string[]>> PParams
|
||||
= new List<Tuple<string, string[]>>();
|
||||
= new List<Tuple<string, string[]>>(
|
||||
new Tuple<string, string[]>[]
|
||||
{
|
||||
new Tuple<string, string[]>(
|
||||
ICSParam.VALUE_TYPE, new string[] { ICSParamValue.DATE_TIME })
|
||||
});
|
||||
|
||||
/// <summary>List of parameters. </summary>
|
||||
private List<Tuple<string, string>> paramList = null;
|
||||
|
||||
/// <summary>Date/Time of the value. </summary>
|
||||
private DateTime value = DateTime.MinValue;
|
||||
@@ -31,6 +39,7 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
public DTCreated()
|
||||
{
|
||||
this.paramList = new List<Tuple<string, string>>();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the Date/Time of the value. </summary>
|
||||
@@ -48,6 +57,29 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the parameter. </summary>
|
||||
/// <value>The parameter. </value>
|
||||
public List<Tuple<string, string>> Param
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.paramList;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < value.Count(); i++)
|
||||
{
|
||||
if (!ICSClasses.CheckParamAndParamValue(value[i].Item1, value[i].Item2, PParams.ToArray()))
|
||||
{
|
||||
throw new NotSupportedException("param (" + value[i] + ") is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
this.paramList = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the property/class values. Used for import from a ICS file.</summary>
|
||||
/// <remarks>Fiedler, 05.09.2013. </remarks>
|
||||
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
|
||||
@@ -55,9 +87,26 @@ namespace CampusAppWP8.Utility.ICSProperties
|
||||
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
|
||||
public override void Set(string valueStr, string[] paramStrList = null)
|
||||
{
|
||||
if (paramStrList != null && paramStrList.Count() > 0)
|
||||
if (paramStrList != null)
|
||||
{
|
||||
throw new NotSupportedException("there are no params supported");
|
||||
for (int i = 0; i < paramStrList.Count(); i++)
|
||||
{
|
||||
string[] p = paramStrList[i].Split('=');
|
||||
|
||||
if (p.Count() != 2)
|
||||
{
|
||||
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")");
|
||||
}
|
||||
|
||||
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
|
||||
{
|
||||
this.paramList.Add(new Tuple<string, string>(p[0], p[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("unsupported param (" + paramStrList[i] + ") in (" + Name + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.value = ICSClasses.UTCStringToDateTime(valueStr);
|
||||
|
||||
97
CampusAppWP8/CampusAppWP8/Utility/ICalObject.cs
Normal file
97
CampusAppWP8/CampusAppWP8/Utility/ICalObject.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="ICalObject.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>09.09.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
/// <summary>Cal object.</summary>
|
||||
/// <remarks>Fiedler, 09.09.2013.</remarks>
|
||||
public class ICalObject
|
||||
{
|
||||
/// <summary>The header.</summary>
|
||||
private ICSProperties.Begin header = null;
|
||||
|
||||
/// <summary>The properties.</summary>
|
||||
private List<object> props = null;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="ICalObject" /> class.</summary>
|
||||
/// <remarks>Fiedler, 09.09.2013.</remarks>
|
||||
public ICalObject()
|
||||
{
|
||||
this.props = new List<object>();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the header.</summary>
|
||||
/// <value>The header.</value>
|
||||
public ICSProperties.Begin Header
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.header = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a list of properties.</summary>
|
||||
/// <value>A List of properties.</value>
|
||||
public List<object> PropertieList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.props;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.props = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets header type.</summary>
|
||||
/// <remarks>Fiedler, 09.09.2013.</remarks>
|
||||
/// <returns>The header type.</returns>
|
||||
public string GetHeaderType()
|
||||
{
|
||||
if (this.header != null)
|
||||
{
|
||||
return this.header.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a property.</summary>
|
||||
/// <remarks>Fiedler, 09.09.2013.</remarks>
|
||||
/// <param name="propName">Name of the property.</param>
|
||||
/// <returns>The property.</returns>
|
||||
public object GetProperty(string propName)
|
||||
{
|
||||
object retValue = null;
|
||||
|
||||
for (int i = 0; i < this.props.Count(); i++)
|
||||
{
|
||||
if (!this.props[i].GetType().Equals(this.GetType()))
|
||||
{
|
||||
if ((this.props[i] as ICSClasses.Interface).GetName().Equals(propName))
|
||||
{
|
||||
retValue = this.props[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user