Merge branch 'release/#aadsubmodul' into develmaster

This commit is contained in:
stubbfel
2013-10-24 11:34:10 +02:00
97 changed files with 11161 additions and 509 deletions

1
.gitattributes vendored
View File

@@ -25,7 +25,6 @@
*.csproj -text merge=union
*.sln -text merge=union
*.resx -text merge=union
*.StyleCop -text merge=union
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "CampusAppWP8/NfcLib"]
path = CampusAppWP8/NfcLib
url = git@141.43.76.143:repos/bare/nfclib.git
branch = develop

View File

@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppDLL", "CampusAppDL
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppWP8ScheduledTaskAgent", "CampusAppWP8ScheduledTaskAgent\CampusAppWP8ScheduledTaskAgent.csproj", "{2A51FA6C-791B-4935-B869-FDBA9ED774D7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ndefpclib", "NfcLib\src\ndefpclib\ndefpclib.csproj", "{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -163,6 +165,22 @@ Global
{2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|x64.ActiveCfg = Release|Any CPU
{2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|x86.ActiveCfg = Release|x86
{2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|x86.Build.0 = Release|x86
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|ARM.ActiveCfg = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|Win32.ActiveCfg = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|x64.ActiveCfg = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Debug|x86.ActiveCfg = Debug|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|Any CPU.Build.0 = Release|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|ARM.ActiveCfg = Release|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|Win32.ActiveCfg = Release|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|x64.ActiveCfg = Release|Any CPU
{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -133,6 +133,78 @@
<Compile Include="Model\Setting\BTUTagHandlerTypes.cs" />
<Compile Include="Model\Setting\TagHandlerListPickerItemListModel.cs" />
<Compile Include="Model\Setting\UserProfilModel.cs" />
<Compile Include="Model\TimeTable\AppointmentListModel.cs" />
<Compile Include="Model\TimeTable\AppointmentModel.cs" />
<Compile Include="Pages\TimeTable\Appointment.xaml.cs">
<DependentUpon>Appointment.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\TimeTable\AppointmentEdit.xaml.cs">
<DependentUpon>AppointmentEdit.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\TimeTable\TimeTable.cs" />
<Compile Include="Pages\TimeTable\TimeTableDay.xaml.cs">
<DependentUpon>TimeTableDay.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\TimeTable\TimeTableProperties.xaml.cs">
<DependentUpon>TimeTableProperties.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\TimeTable\TimeTableWeek.xaml.cs">
<DependentUpon>TimeTableWeek.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\ICalObject.cs" />
<Compile Include="Utility\ICSClasses.cs" />
<Compile Include="Utility\ICSManager.cs" />
<Compile Include="Utility\ICSObjectConst.cs" />
<Compile Include="Utility\ICSProperties\AccessClass.cs" />
<Compile Include="Utility\ICSProperties\Action.cs" />
<Compile Include="Utility\ICSProperties\Attachment.cs" />
<Compile Include="Utility\ICSProperties\Attendee.cs" />
<Compile Include="Utility\ICSProperties\Begin.cs" />
<Compile Include="Utility\ICSProperties\CalendarScale.cs" />
<Compile Include="Utility\ICSProperties\Categories.cs" />
<Compile Include="Utility\ICSProperties\Comment.cs" />
<Compile Include="Utility\ICSProperties\Contact.cs" />
<Compile Include="Utility\ICSProperties\Description.cs" />
<Compile Include="Utility\ICSProperties\DTCompleted.cs" />
<Compile Include="Utility\ICSProperties\DTCreated.cs" />
<Compile Include="Utility\ICSProperties\DTDue.cs" />
<Compile Include="Utility\ICSProperties\DTEnd.cs" />
<Compile Include="Utility\ICSProperties\DTException.cs" />
<Compile Include="Utility\ICSProperties\DTRecurrence.cs" />
<Compile Include="Utility\ICSProperties\DTStamp.cs" />
<Compile Include="Utility\ICSProperties\DTStart.cs" />
<Compile Include="Utility\ICSProperties\Duration.cs" />
<Compile Include="Utility\ICSProperties\End.cs" />
<Compile Include="Utility\ICSProperties\FreeBusyTime.cs" />
<Compile Include="Utility\ICSProperties\Geo.cs" />
<Compile Include="Utility\ICSProperties\IANAProperty.cs" />
<Compile Include="Utility\ICSProperties\LastModified.cs" />
<Compile Include="Utility\ICSProperties\Location.cs" />
<Compile Include="Utility\ICSProperties\Method.cs" />
<Compile Include="Utility\ICSProperties\NonStandardProperty.cs" />
<Compile Include="Utility\ICSProperties\Organizer.cs" />
<Compile Include="Utility\ICSProperties\PercentComplete.cs" />
<Compile Include="Utility\ICSProperties\Priority.cs" />
<Compile Include="Utility\ICSProperties\ProductID.cs" />
<Compile Include="Utility\ICSProperties\RecurrenceID.cs" />
<Compile Include="Utility\ICSProperties\RecurrenceRule.cs" />
<Compile Include="Utility\ICSProperties\RelatedTo.cs" />
<Compile Include="Utility\ICSProperties\RepeatCount.cs" />
<Compile Include="Utility\ICSProperties\RequestStatus.cs" />
<Compile Include="Utility\ICSProperties\Resources.cs" />
<Compile Include="Utility\ICSProperties\SequenceNumber.cs" />
<Compile Include="Utility\ICSProperties\Status.cs" />
<Compile Include="Utility\ICSProperties\Summary.cs" />
<Compile Include="Utility\ICSProperties\TimeTransparency.cs" />
<Compile Include="Utility\ICSProperties\TimeZoneIdentifier.cs" />
<Compile Include="Utility\ICSProperties\TimeZoneName.cs" />
<Compile Include="Utility\ICSProperties\TimeZoneOffsetFrom.cs" />
<Compile Include="Utility\ICSProperties\TimeZoneOffsetTo.cs" />
<Compile Include="Utility\ICSProperties\TimeZoneUrl.cs" />
<Compile Include="Utility\ICSProperties\Trigger.cs" />
<Compile Include="Utility\ICSProperties\UniqueID.cs" />
<Compile Include="Utility\ICSProperties\Url.cs" />
<Compile Include="Utility\ICSProperties\Version.cs" />
<Compile Include="Model\Utility\CourseListPickerItemListWp8Model.cs" />
<Compile Include="Pages\BTUTag\BTUTagInfo.xaml.cs">
<DependentUpon>BTUTagInfo.xaml</DependentUpon>
@@ -171,10 +243,18 @@
<Compile Include="Utility\Lui\Header\DefaultHeader.xaml.cs">
<DependentUpon>DefaultHeader.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Header\WeekViewPivotHeader.xaml.cs">
<DependentUpon>WeekViewPivotHeader.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\ListBoxFixed.cs" />
<Compile Include="Utility\Lui\Templates\WeekView.xaml.cs">
<DependentUpon>WeekView.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Templates\WeekViewDay.xaml.cs">
<DependentUpon>WeekViewDay.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Tiles\TileCreator.cs" />
<Compile Include="Utility\NDEF\NDEFMessage.cs" />
<Compile Include="Utility\NDEF\NDEFRecord.cs" />
<Compile Include="Utility\NDEF\NDEFShortRecord.cs" />
<Compile Include="Utility\NDEF\BTUTagMessage.cs" />
<Compile Include="Pages\Dev\NFC.xaml.cs">
<DependentUpon>NFC.xaml</DependentUpon>
</Compile>
@@ -407,6 +487,26 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\TimeTable\Appointment.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\TimeTable\AppointmentEdit.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\TimeTable\TimeTableDay.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\TimeTable\TimeTableProperties.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\TimeTable\TimeTableWeek.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Webmail\WebmailPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -427,6 +527,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Lui\Header\WeekViewPivotHeader.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Lui\Templates\WeekView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Lui\Templates\WeekViewDay.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
@@ -586,6 +698,10 @@
<Project>{67D80BE2-0FB7-44C8-A495-7D44FC2AC262}</Project>
<Name>CampusAppWPortalLib8</Name>
</ProjectReference>
<ProjectReference Include="..\NfcLib\src\ndefpclib\ndefpclib.csproj">
<Project>{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}</Project>
<Name>ndefpclib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />

View File

@@ -0,0 +1,85 @@
//-----------------------------------------------------------------------------
// <copyright file="AppointmentListModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>26.08.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.TimeTable
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
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")]
public class AppointmentListModel
{
private ObservableCollection<AppointmentModel> appointmentList;
private int hasChangedIndex = -1;
/// <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);
}
// for testing
public AppointmentListModel(AppointmentModel[] appList) : this()
{
if (appList != null)
{
foreach (AppointmentModel a in appList)
{
this.appointmentList.Add(a);
}
this.hasChangedIndex = -1;
}
}
public ObservableCollection<AppointmentModel> Appointments
{
get
{
return this.appointmentList;
}
set
{
this.appointmentList = value;
}
}
public int HasChangedIndex
{
get
{
int retValue = this.hasChangedIndex;
this.hasChangedIndex = -1;
return retValue;
}
}
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
this.hasChangedIndex = e.NewStartingIndex;
}
}
}
}

View File

@@ -0,0 +1,392 @@
//-----------------------------------------------------------------------------
// <copyright file="AppointmentModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>26.08.2013</sience>
//-----------------------------------------------------------------------------
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")]
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;
private ICalObject icalObj = null;
//private ICalObject eventICalObj = null;
public delegate void OnAppointmentClick(AppointmentModel sender);
public event OnAppointmentClick OnClick = null;
/// <summary>Initializes a new instance of the <see cref="AppointmentModel" /> class. </summary>
public AppointmentModel()
{
this.icalObj = new ICalObject();
CampusAppWP8.Utility.ICSProperties.Begin newBegin = new CampusAppWP8.Utility.ICSProperties.Begin();
newBegin.Value = ICSTag.VCALENDAR;
CampusAppWP8.Utility.ICSProperties.Version newVersion = new CampusAppWP8.Utility.ICSProperties.Version();
newVersion.Value = 2.0f;
CampusAppWP8.Utility.ICSProperties.ProductID newProdID = new CampusAppWP8.Utility.ICSProperties.ProductID();
newProdID.Value = CampusAppWP8.Resources.AppResources.ApplicationTitle;
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);
}
public AppointmentModel(string icsData) : this()
{
this.icalObj = ICSManager.ImportFromICS(icsData);
}
public int IsDate(DateTime date, int daySpan = 0)
{
int retValue = -1;
DateTime startTime = this.Start;
DateTime endTime = this.End;
if (startTime != null)
{
int toDaySpan = 0;
while ((toDaySpan <= daySpan) && (retValue == -1))
{
DateTime tempDT = date.AddDays(toDaySpan);
if(startTime.Date <= tempDT.Date && tempDT.Date <= endTime.Date)
//if (tempDT.Date.Equals(startTime.Date) == true)
{
retValue = toDaySpan;
}
toDaySpan++;
}
}
return retValue;
}
public bool Intersect(AppointmentModel model)
{
bool retValue = false;
DateTime modelStart = model.Start;
DateTime modelEnd = model.End;
DateTime thisStart = this.Start;
DateTime thisEnd = this.End;
if ((modelStart <= thisStart && thisStart <= modelEnd)
|| (modelStart <= thisEnd && thisEnd <= modelEnd)
|| (thisStart <= modelStart && modelStart <= thisEnd)
|| (thisStart <= modelEnd && modelEnd <= thisEnd))
{
retValue = true;
}
return retValue;
}
public int Intersect(AppointmentModel[] modelList)
{
int retValue = -1;
for (int i = 0; i < modelList.Length; i++)
{
if (this.Equals(modelList[i]) == false && this.Intersect(modelList[i]) == true)
{
retValue = i;
}
}
return retValue;
}
public int[] IntersectArray(AppointmentModel[] modelList)
{
List<int> retValue = new List<int>();
for (int i = 0; i < modelList.Length; i++)
{
if (this.Equals(modelList[i]) == false && this.Intersect(modelList[i]) == true)
{
retValue.Add(i);
}
}
return retValue.ToArray();
}
public void SetValue(object value)
{
ICalObject vevent = this.GetVEventObj(true);
vevent.AddProperty(value);
}
public Canvas GetCanvas(double width, double hourSpacing, DateTime date)
{
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);
return retValue;
}
private void CreateRect(Canvas can)
{
// 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);
}
private void CreateContent(Canvas can, double hourSpacing)
{
if (this.icalObj != null)
{
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)))
{
txtTitle.Margin = new Thickness(0, -2, 0, 0);
txtTitle.Text = title.Value;
}
else
{
txtTitle.Height = can.Height;
txtTitle.VerticalAlignment = VerticalAlignment.Center;
txtTitle.Margin = new Thickness(0, -10, 0, 0);
txtTitle.Text = "...";
}
can.Children.Add(txtTitle);
}
}
private ICalObject GetVEventObj(bool create = false)
{
ICalObject retValue = this.icalObj.GetProperty(ICSTag.VEVENT) as ICalObject;
if (retValue == null)
{
if (create == false)
{
throw new NullReferenceException();
}
else
{
retValue = new ICalObject();
Begin newHeader = new Begin();
newHeader.Value = ICSTag.VEVENT;
retValue.Header = newHeader;
this.icalObj.PropertieList.Add(retValue);
}
}
return retValue;
}
/*
private void OnCanvasClick(object sender, EventArgs e)
{
if (this.OnClick != null)
{
this.OnClick(this);
}
}
private void OnCanvasSizeChanged(object sender, SizeChangedEventArgs e)
{
}
*/
// ------------------------------------------------------
public string Title
{
get
{
ICalObject eventICal = this.GetVEventObj();
Summary tempSum = eventICal.GetProperty(ICSTag.SUMMARY) as Summary;
return tempSum.Value;
}
}
public string Date
{
get
{
string retValue = string.Empty;
ICalObject eventICal = this.GetVEventObj();
DTStart startDT = eventICal.GetProperty(ICSTag.DT_START) as DTStart;
DTEnd endDT = eventICal.GetProperty(ICSTag.DT_END) as DTEnd;
if (startDT != null && endDT != null)
{
if (startDT.Value.Year.Equals(endDT.Value.Year) && startDT.Value.Month.Equals(endDT.Value.Month) && startDT.Value.Day.Equals(endDT.Value.Day))
{
retValue = string.Format("{0:d}, {0:HH:ss} - {1:HH:ss}", startDT.Value, endDT.Value);
}
else
{
retValue = string.Format("{0:d} {0:HH:ss} - {1:d} {1:HH:ss}", startDT.Value, endDT.Value);
}
}
return retValue;
}
}
public string Location
{
get
{
string retValue = string.Empty;
ICalObject eventICal = this.GetVEventObj();
Location loc = eventICal.GetProperty(ICSTag.LOCATION) as Location;
if (loc != null)
{
retValue = loc.Value;
}
return retValue;
}
}
public string Description
{
get
{
string retValue = string.Empty;
ICalObject eventICal = this.GetVEventObj();
Description desc = eventICal.GetProperty(ICSTag.DESCRIPTION) as Description;
if (desc != null)
{
retValue = desc.Value;
}
return retValue;
}
}
public DateTime Start
{
get
{
ICalObject eventICal = this.GetVEventObj();
DTStart retVal = eventICal.GetProperty(ICSTag.DT_START) as DTStart;
if (retVal != null)
{
return retVal.Value;
}
return DateTime.MinValue;
}
}
public DateTime End
{
get
{
ICalObject eventICal = this.GetVEventObj();
DTEnd end = eventICal.GetProperty(ICSTag.DT_END) as DTEnd;
CampusAppWP8.Utility.ICSProperties.Duration dur = eventICal.GetProperty(ICSTag.DURATION) as CampusAppWP8.Utility.ICSProperties.Duration;
if (end == null && dur == null)
{
throw new KeyNotFoundException();
}
else if (end != null)
{
return end.Value;
}
else
{
return this.Start.Add(dur.Value);
}
}
}
}
}

View File

@@ -493,7 +493,7 @@ namespace CampusAppWP8.Pages.Campusmap
this.device.StopSubscribingForMessage(message.SubscriptionId);
var ndefMessage = message.Data;
byte[] data = ndefMessage.ToArray();
NDEFMessage ndef = new NDEFMessage(data);
BTUTagMessage ndef = new BTUTagMessage(data);
// search for placeId
string nfcContent = ndef.GetContent();

View File

@@ -34,7 +34,7 @@ namespace CampusAppWP8.Pages.Dev
private int actNDEFIndex;
/// <summary> List of ndefs. </summary>
private List<NDEFMessage> ndefList;
private List<BTUTagMessage> ndefList;
/// <summary> The file. </summary>
private PlacesFile file;
@@ -82,12 +82,12 @@ namespace CampusAppWP8.Pages.Dev
/// <remarks> Stubbfel, 15.10.2013. </remarks>
private void FileIsReady()
{
this.ndefList = new List<NDEFMessage>();
this.ndefList = new List<BTUTagMessage>();
// MapModel map = new CBMainMapModel(this.file.Model.Places.ToList());
foreach (PlaceModel place in this.file.Model.Places.ToList())
{
this.ndefList.Add(new NDEFMessage(place.ToNfcString(), NDEFMessage.TYPEVAL.TEXT));
this.ndefList.Add(new BTUTagMessage(place.ToNfcString()));
}
this.Writecontent.Text = this.ndefList[this.actNDEFIndex].GetContent();
@@ -113,7 +113,7 @@ namespace CampusAppWP8.Pages.Dev
var ndefMessage = message.Data;
byte[] testa = ndefMessage.ToArray();
NDEFMessage ndef = new NDEFMessage(testa);
BTUTagMessage ndef = new BTUTagMessage(testa);
this.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(ndef.GetContent())));
}

View File

@@ -426,7 +426,7 @@ namespace CampusAppWP8.Pages.PlaceNews
var ndefMessage = message.Data;
byte[] data = ndefMessage.ToArray();
NDEFMessage ndef = new NDEFMessage(data);
BTUTagMessage ndef = new BTUTagMessage(data);
string nfcContent = ndef.GetContent();
string pid = Wp8StringManager.FilterPlaceIdinNFCResultString(nfcContent.Trim());
if (pid != null)

View File

@@ -382,7 +382,7 @@ namespace CampusAppWP8.Pages
this.device.StopSubscribingForMessage(message.SubscriptionId);
var ndefMessage = message.Data;
byte[] data = ndefMessage.ToArray();
NDEFMessage ndef = new NDEFMessage(data);
BTUTagMessage ndef = new BTUTagMessage(data);
string nfcContent = ndef.GetContent();
if (nfcContent == null)
{

View File

@@ -0,0 +1,42 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.TimeTable.Appointment"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
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"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.Appointment, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Path=LocalizedResources.Info, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<TextBlock x:Name="InfoTitle" Text="{Binding Title}" />
<TextBlock x:Name="InfoDate" Text="{Binding Date}" />
<TextBlock x:Name="InfoLocation" Text="{Binding Location}" />
<TextBlock x:Name="InfoDescription" Text="{Binding Description}" TextWrapping="Wrap" />
</StackPanel>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Default" Opacity="1.0" >
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,112 @@
//-----------------------------------------------------------------------------
// <copyright file="Appointment.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>12.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.TimeTable
{
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
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.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Model.TimeTable;
public partial class Appointment : PhoneApplicationPage
{
private AppointmentModel appModel = null;
public Appointment()
{
this.InitializeComponent();
ApplicationBarIconButton editBtn = new ApplicationBarIconButton();
editBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
editBtn.Text = AppResources.Edit;
editBtn.Click += new EventHandler(this.OnClickEdit);
ApplicationBar.Buttons.Add(editBtn);
ApplicationBarIconButton deleteBtn = new ApplicationBarIconButton();
deleteBtn.IconUri = new Uri(Icons.TextToSpeech, UriKind.Relative);
deleteBtn.Text = AppResources.Delete;
deleteBtn.Click += new EventHandler(this.OnClickDelete);
ApplicationBar.Buttons.Add(deleteBtn);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Back)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
this.DataContext = this.appModel;
}
else
{
string appointmentIndexStr = string.Empty;
// Navigate to the selected pivotitem
if (NavigationContext.QueryString.TryGetValue(Constants.Param_Appointment_Index, out appointmentIndexStr))
{
int appointmentIndex = int.Parse(appointmentIndexStr);
// if the index is in the range of the array
if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
{
this.appModel = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
this.DataContext = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
}
else
{
string o = string.Empty;
foreach (KeyValuePair<string, string> kvp in NavigationContext.QueryString)
{
o += string.Format("Key = {0}, Value = {1}", kvp.Key, kvp.Value) + "\n";
}
MessageBox.Show("ERROR: appointment index out of range!!! (" + o + ")");
}
}
}
}
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
this.appModel = e.NewItems[0] as AppointmentModel;
}
}
private void OnClickEdit(object sender, EventArgs e)
{
if (this.appModel != null)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = "/Pages/TimeTable/AppointmentEdit.xaml?" + Constants.Param_Appointment_Index + "=" + TimeTable.AppointmentsModel.Appointments.IndexOf(this.appModel);
Uri url = new Uri(urlString, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
page.NavigationService.Navigate(url);
}
}
private void OnClickDelete(object sender, EventArgs e)
{
TimeTable.AppointmentsModel.Appointments.Remove(this.appModel);
this.NavigationService.GoBack();
}
}
}

View File

@@ -0,0 +1,173 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.TimeTable.AppointmentEdit"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
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:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.Appointment, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="HeadLine" Text="{Binding Path=LocalizedResources.Edit, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ScrollViewer x:Name="scrollView">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--Title-->
<StackPanel Grid.Row="0">
<TextBlock Text="{Binding Path=LocalizedResources.Title, Source={StaticResource LocalizedStrings}}"/>
<TextBox x:Name="InTitle" TextWrapping="NoWrap" AcceptsReturn="True" />
</StackPanel>
<!--Location-->
<StackPanel Grid.Row="1">
<TextBlock Text="{Binding Path=LocalizedResources.Location, Source={StaticResource LocalizedStrings}}"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="InLocation" TextWrapping="NoWrap" AcceptsReturn="True" Grid.Column="0"/>
<Button x:Name="InLocationBtn" Grid.Column="1" Click="InLocationBtn_Click">
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="30"/>
</Button>
</Grid>
</StackPanel>
<!--callendar account ???-->
<!--AllDay Ganztaegig-->
<StackPanel x:Name="StackPanelAllDay" Grid.Row="2" Visibility="Collapsed">
<CheckBox x:Name="InAllDay" Content="{Binding Path=LocalizedResources.AllDay, Source={StaticResource LocalizedStrings}}" Checked="InAllDay_Checked" Unchecked="InAllDay_Unchecked"/>
</StackPanel>
<!--Start date-->
<StackPanel Grid.Row="3">
<TextBlock Text="{Binding Path=LocalizedResources.When, Source={StaticResource LocalizedStrings}}"/>
<toolkit:DatePicker x:Name="InStartDate"/>
<toolkit:TimePicker x:Name="InStartTime"/>
</StackPanel>
<!--Duration-->
<StackPanel x:Name="StackPanelDuration" Grid.Row="4">
<TextBlock Text="{Binding Path=LocalizedResources.Duration, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker x:Name="InDuration" SelectionChanged="InDuration_SelectionChanged"/>
</StackPanel>
<!--End date-->
<StackPanel x:Name="StackPanelEnd" Grid.Row="5" Visibility="Collapsed">
<TextBlock Text="{Binding Path=LocalizedResources.To, Source={StaticResource LocalizedStrings}}"/>
<toolkit:DatePicker x:Name="InEndDate"/>
<toolkit:TimePicker x:Name="InEndTime"/>
</StackPanel>
<Border Grid.Row="6" BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0"/>
<!--Extend-->
<StackPanel x:Name="StackPanelExtend" Grid.Row="7">
<Button x:Name="ExtendBtn" Click="ExtendBtn_Click">
<TextBlock Text="{Binding Path=LocalizedResources.ExtendedProperties, Source={StaticResource LocalizedStrings}}"/>
</Button>
</StackPanel>
<Grid x:Name="GridExtend" Grid.Row="8" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--Reminder-->
<!--Repeat-->
<StackPanel Grid.Row="1">
<TextBlock Text="{Binding Path=LocalizedResources.Repeat, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker x:Name="InRepeat"/>
</StackPanel>
<!--status-->
<!--categories-->
<StackPanel Grid.Row="2">
<TextBlock Text="{Binding Path=LocalizedResources.Categories, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker x:Name="InCategories"/>
</StackPanel>
<!--priority-->
<StackPanel Grid.Row="3">
<TextBlock Text="{Binding Path=LocalizedResources.Priority, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker x:Name="InPriority"/>
</StackPanel>
<!--Attendees-->
<StackPanel Grid.Row="4">
<TextBlock Text="{Binding Path=LocalizedResources.Attendees, Source={StaticResource LocalizedStrings}}"/>
<TextBox Text="[PLACEHOLDER]"/>
</StackPanel>
<!--Private/Public-->
<StackPanel Grid.Row="5">
<TextBlock Text="{Binding Path=LocalizedResources.Visibility, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker x:Name="InAccessClass"/>
</StackPanel>
<!--Description-->
<StackPanel Grid.Row="6">
<TextBlock Text="{Binding Path=LocalizedResources.Description, Source={StaticResource LocalizedStrings}}"/>
<TextBox x:Name="InDescription" AcceptsReturn="True" Height="160" TextWrapping="Wrap"/>
</StackPanel>
</Grid>
<!--
calendar-Konto
Alarm/reminder
Status (Free/Busy???)
-->
<!--
calendar account
reminders (multi)
-->
</Grid>
</ScrollViewer>
</Grid>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,299 @@
//-----------------------------------------------------------------------------
// <copyright file="AppointmentEdit.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.09.2013</sience>
//-----------------------------------------------------------------------------
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 Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Resources;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.ICSProperties;
public partial class AppointmentEdit : PhoneApplicationPage
{
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" };
private readonly string[] CategoriesListText = new string[] { "keine", "Vorlesung", "Übung", "Labor", "Praktikum", "Seminar", "Prüfung", "Treffen" };
private readonly string[] PriorityListText = new string[] { "0 - keine", "1 - höchste", "2", "3", "4", "5 - mittlere", "6", "7", "8", "9 - niedrigste" };
private bool isDuration = true;
private int appointmentIndex = -1;
public AppointmentEdit()
{
this.InitializeComponent();
this.InDuration.ItemsSource = DurationListText;
this.InRepeat.ItemsSource = RepeatListText;
this.InAccessClass.ItemsSource = AccessClassListText;
this.InCategories.ItemsSource = CategoriesListText;
this.InPriority.ItemsSource = PriorityListText;
ApplicationBarIconButton saveBtn = new ApplicationBarIconButton();
saveBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
saveBtn.Text = AppResources.Save;
saveBtn.Click += new EventHandler(this.OnClickSaveBtn);
ApplicationBar.Buttons.Add(saveBtn);
ApplicationBarIconButton cancelBtn = new ApplicationBarIconButton();
cancelBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
cancelBtn.Text = AppResources.Cancel;
cancelBtn.Click += new EventHandler(this.OnClickSaveBtn);
ApplicationBar.Buttons.Add(cancelBtn);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string appointmentIndexStr = 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()))
{
this.HeadLine.Text = AppResources.Edit;
//this.DataContext = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
AppointmentModel tempModel = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
this.InTitle.Text = tempModel.Title;
this.InLocation.Text = tempModel.Location;
}
else
{
string o = string.Empty;
foreach (KeyValuePair<string, string> kvp in NavigationContext.QueryString)
{
o += string.Format("Key = {0}, Value = {1}", kvp.Key, kvp.Value) + "\n";
}
MessageBox.Show("ERROR: appointment index out of range!!! (" + o + ")");
}
}
else
{
this.HeadLine.Text = AppResources.Creating;
}
}
private void OnClickSaveBtn(object sender, EventArgs e)
{
AppointmentModel newItem = new AppointmentModel();
Summary newTitle = new Summary();
newTitle.Value = this.InTitle.Text;
newItem.SetValue(newTitle);
Location newLocation = new Location();
newLocation.Value = this.InLocation.Text;
newItem.SetValue(newLocation);
DateTime tempStartDT = this.InStartDate.Value.Value;
TimeSpan tempStartTS = this.InStartTime.Value.Value.TimeOfDay;
DTStart newDTStart = new DTStart();
newDTStart.IsDate = false;
newDTStart.Value = new DateTime(tempStartDT.Year, tempStartDT.Month, tempStartDT.Day, tempStartTS.Hours, tempStartTS.Minutes, 0);
newItem.SetValue(newDTStart);
if(this.isDuration == true)
{
int durationHours = 0;
int durationMinutes = 0;
switch (this.InDuration.SelectedIndex)
{
case 0: durationMinutes = 15; break;
case 1: durationMinutes = 30; break;
case 2: durationMinutes = 60; break;
case 3: durationMinutes = 90; break;
case 4: durationMinutes = 120; break;
case 5: durationHours = 24; break;
}
Utility.ICSProperties.Duration newDura = new Utility.ICSProperties.Duration();
newDura.Value = new TimeSpan(durationHours, durationMinutes, 0);
newItem.SetValue(newDura);
}
else
{
DateTime tempEndDT = this.InEndDate.Value.Value;
TimeSpan tempEndTS = this.InEndTime.Value.Value.TimeOfDay;
DTEnd newDTEnd = new DTEnd();
newDTEnd.IsDate = false;
newDTEnd.Value = new DateTime(tempEndDT.Year, tempEndDT.Month, tempEndDT.Day, tempEndTS.Hours, tempEndTS.Minutes, 0);
newItem.SetValue(newDTEnd);
}
DTStamp newDTStamp = new DTStamp();
newDTStamp.Value = DateTime.Now;
newItem.SetValue(newDTStamp);
DTCreated newDTCreated = new DTCreated();
newDTCreated.Value = DateTime.Now;
newItem.SetValue(newDTCreated);
LastModified newLM = new LastModified();
newLM.Value = DateTime.Now;
newItem.SetValue(newLM);
long uid = DateTime.Now.Ticks;
string unique_string = string.Format("{0:x}", uid) + "@" + AppResources.ApplicationTitle;
unique_string = unique_string.Replace(" ", "");
UniqueID newUID = new UniqueID();
newUID.Value = unique_string;
newItem.SetValue(newUID);
if (this.GridExtend.Visibility == Visibility.Visible)
{
// Repeat
if (this.InRepeat.SelectedIndex != 0)
{
RecurrenceRule newRepeat = new RecurrenceRule();
switch (this.InRepeat.SelectedIndex)
{
case 1:
newRepeat.Value.Add(new Tuple<string, List<string>>(ICSValue.FREQ, new List<string>() { ICSValueValue.DAILY }));
break;
case 2:
newRepeat.Value.Add(new Tuple<string, List<string>>(ICSValue.FREQ, new List<string>() { ICSValueValue.WEEKLY }));
newRepeat.Value.Add(new Tuple<string, List<string>>(ICSValue.BY_DAY, new List<string>() { ICSValueValue.DAY_MO, ICSValueValue.DAY_TU, ICSValueValue.DAY_WE, ICSValueValue.DAY_TH, ICSValueValue.DAY_FR }));
break;
case 3:
newRepeat.Value.Add(new Tuple<string, List<string>>(ICSValue.FREQ, new List<string>() { ICSValueValue.WEEKLY }));
break;
case 4:
newRepeat.Value.Add(new Tuple<string, List<string>>(ICSValue.FREQ, new List<string>() { ICSValueValue.MONTHLY }));
break;
case 5:
newRepeat.Value.Add(new Tuple<string, List<string>>(ICSValue.FREQ, new List<string>() { ICSValueValue.YEARLY }));
break;
}
newItem.SetValue(newRepeat);
}
// Status
// categories
Categories newCat = new Categories();
newCat.Value.Add(this.InCategories.SelectedItem as string);
newItem.SetValue(newCat);
// priority
Priority newPrio = new Priority();
newPrio.Value = this.InPriority.SelectedIndex;
newItem.SetValue(newPrio);
// Attendees
// Visibility
AccessClass newAC = new AccessClass();
switch (this.InAccessClass.SelectedIndex)
{
case 0: newAC.Value = ICSValue.PUBLIC; break;
case 1: newAC.Value = ICSValue.PRIVATE; break;
case 2: newAC.Value = ICSValue.CONFIDENTIAL; break;
}
newItem.SetValue(newAC);
// Description
if (this.InDescription.Text.Length > 0)
{
Description newDesc = new Description();
newDesc.Value = this.InDescription.Text;
newItem.SetValue(newDesc);
}
}
if (this.appointmentIndex >= 0)
{
TimeTable.AppointmentsModel.Appointments.RemoveAt(this.appointmentIndex);
}
TimeTable.AppointmentsModel.Appointments.Add(newItem);
Page page = App.RootFrame.Content as Page;
page.NavigationService.GoBack();
}
private void OnClickCancelBtn(object sender, EventArgs e)
{
Page page = App.RootFrame.Content as Page;
page.NavigationService.GoBack();
}
private void InLocationBtn_Click(object sender, RoutedEventArgs e)
{
}
private void InDuration_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
bool checkInStartTime = true;
if (DurationListText[(sender as ListPicker).SelectedIndex].Equals("Benutzerdefiniert") == true)
{
this.StackPanelEnd.Visibility = Visibility.Visible;
this.StackPanelAllDay.Visibility = Visibility.Visible;
this.StackPanelDuration.Visibility = Visibility.Collapsed;
this.isDuration = false;
}
else if (DurationListText[(sender as ListPicker).SelectedIndex].Equals("Ganztägig") == true)
{
this.SetTimePicker(this.InStartTime, false);
checkInStartTime = false;
}
if (this.InStartTime.IsEnabled == false && checkInStartTime == true)
{
this.SetTimePicker(this.InStartTime, true);
}
}
private void InAllDay_Checked(object sender, RoutedEventArgs e)
{
this.SetTimePicker(this.InStartTime, false);
this.SetTimePicker(this.InEndTime, false);
}
private void InAllDay_Unchecked(object sender, RoutedEventArgs e)
{
this.SetTimePicker(this.InStartTime, true);
this.SetTimePicker(this.InEndTime, true);
}
private void SetTimePicker(TimePicker obj, bool enabled)
{
obj.IsEnabled = enabled;
obj.Value = (enabled == true) ? DateTime.Now : DateTime.MinValue;
}
private void ExtendBtn_Click(object sender, RoutedEventArgs e)
{
this.StackPanelExtend.Visibility = Visibility.Collapsed;
this.GridExtend.Visibility = Visibility.Visible;
}
}
}

View File

@@ -0,0 +1,53 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeTable.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>12.09.2013</sience>
//-----------------------------------------------------------------------------
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 Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Model.TimeTable;
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")
});
public static int AutoScrollToHour = 7;
public static int VisualScale = 0; //0 - small, 1 - medium, 2 - large
public TimeTable()
{
//this.InitializeComponent();
TimeTable.appList = new AppointmentListModel();
}
public static AppointmentListModel AppointmentsModel
{
get
{
return TimeTable.appList;
}
}
}
}

View File

@@ -0,0 +1,26 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.TimeTable.TimeTableDay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
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"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
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" Title="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}">
</phone:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,590 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeTableDay.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>12.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.TimeTable
{
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Resources;
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 int lastSelectedIndex = 0;
public TimeTableDay()
{
this.InitializeComponent();
DateTime firstDay = DateTime.Now.Date.AddDays(PIVOT_ITEM_PAGES_HALF_DOWN * -1);
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
{
this.itemPages[i].Stacks = new List<List<AppointmentModel>>();
this.CreatePage(i, firstDay.AddDays(i));
}
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
this.ThePivot.SelectionChanged += new SelectionChangedEventHandler(this.EventPivotSelectionChanged);
ApplicationBarIconButton weekBtn = new ApplicationBarIconButton();
weekBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
weekBtn.Text = AppResources.WeekView;
weekBtn.Click += new EventHandler(this.OnClickWeek);
ApplicationBar.Buttons.Add(weekBtn);
ApplicationBarIconButton editBtn = new ApplicationBarIconButton();
editBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
editBtn.Text = AppResources.ToDay;
editBtn.Click += new EventHandler(this.OnClickToDay);
ApplicationBar.Buttons.Add(editBtn);
ApplicationBarIconButton propBtn = new ApplicationBarIconButton();
propBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
propBtn.Text = AppResources.Properties;
propBtn.Click += new EventHandler(this.OnClickProperties);
ApplicationBar.Buttons.Add(propBtn);
ApplicationBarIconButton addBtn = new ApplicationBarIconButton();
addBtn.IconUri = new Uri(Icons.Add, UriKind.Relative);
addBtn.Text = AppResources.Add;
addBtn.Click += new EventHandler(this.OnClickAdd);
ApplicationBar.Buttons.Add(addBtn);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Back)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
}
else
{
this.lastSelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
}
}
private void EventPivotSelectionChanged(object sender, SelectionChangedEventArgs e)
{
int indexToChange = 0;
/*
0<->1: 3
1<->2: 4
2<->3: 0
3<->4: 1
4<->0: 2
*/
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
if(delta < -1) delta = 1;
else if(delta > 1) delta = -1;
indexToChange = (this.ThePivot.SelectedIndex + PIVOT_ITEM_PAGES + (PIVOT_ITEM_PAGES_HALF_DOWN * delta)) % PIVOT_ITEM_PAGES;
if (delta == 0)
{
return;
}
else
{
this.itemPages[indexToChange].Date = this.itemPages[this.ThePivot.SelectedIndex].Date.AddDays(delta * PIVOT_ITEM_PAGES_HALF_DOWN);
}
this.SetupPage(indexToChange);
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
}
private void OnAppointmentClick(object sender, System.Windows.Input.GestureEventArgs e)
{
int index = TimeTable.AppointmentsModel.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
if (index >= 0)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = "/Pages/TimeTable/Appointment.xaml?" + Constants.Param_Appointment_Index + "=" + index;
Uri url = new Uri(urlString, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
page.NavigationService.Navigate(url);
}
}
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);
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;
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
{
this.itemPages[i].Date = firstDay.AddDays(i);
this.SetupPage(i);
}
}
private void OnClickProperties(object sender, EventArgs e)
{
Uri url = new Uri("/Pages/TimeTable/TimeTableProperties.xaml", 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);
Uri url = new Uri("/Pages/TimeTable/AppointmentEdit.xaml", 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;
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
tempModel = e.OldItems[0] as AppointmentModel;
}
if (tempModel != null)
{
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
{
if (tempModel.IsDate(this.itemPages[i].Date.Date) > -1)
{
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)
{
addIndex = k;
}
}
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++)
{
for (int k = 0; k < this.itemPages[index].Stacks[i].Count(); k++)
{
if (k > 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);
}
}
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);
}
}
}

View File

@@ -0,0 +1,53 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.TimeTable.TimeTableProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
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:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Path=LocalizedResources.Properties, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="0">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.AutoScrollToHour, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker Name="AutoScroll" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderAutoScroll, Source={StaticResource LocalizedStrings}}" />
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="1">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.VisualScale, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker Name="VisualScale" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderVisualScale, Source={StaticResource LocalizedStrings}}" />
</StackPanel>
</Border>
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,53 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeTableProperties.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.09.2013</sience>
//-----------------------------------------------------------------------------
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 Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Resources;
public partial class TimeTableProperties : PhoneApplicationPage
{
public string[] VisualScaleText = new string[] { AppResources.Small, AppResources.Medium, AppResources.Large };
public TimeTableProperties()
{
this.InitializeComponent();
// AutoScroll
string[] tempAutoScroll = new string[25];
for (int i = 0; i < 24; i++)
{
tempAutoScroll[i] = "" + i;
}
this.AutoScroll.ItemsSource = tempAutoScroll;
this.AutoScroll.SelectedIndex = TimeTable.AutoScrollToHour;
// VisualSize
this.VisualScale.ItemsSource = VisualScaleText;
this.VisualScale.SelectedIndex = TimeTable.VisualScale;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
TimeTable.AutoScrollToHour = this.AutoScroll.SelectedIndex;
TimeTable.VisualScale = this.VisualScale.SelectedIndex;
}
}
}

View File

@@ -0,0 +1,38 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.TimeTable.TimeTableWeek"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Landscape" Orientation="Landscape"
mc:Ignorable="d"
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.HeaderTemplate>
<DataTemplate>
</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>
</DataTemplate>
</phone:Pivot.ItemTemplate>
</phone:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Default" Opacity="1.0" />
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,833 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeTableWeek.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>30.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.TimeTable
{
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
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;
public TimeTableWeek()
{
this.InitializeComponent();
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);
firstDay = firstDay.AddDays(7);
}
ApplicationBarIconButton dayViewBtn = new ApplicationBarIconButton();
dayViewBtn.Text = AppResources.DayView;
dayViewBtn.IconUri = new Uri(Icons.Info, UriKind.Relative);
dayViewBtn.Click += new EventHandler(this.OnClickDayView);
ApplicationBar.Buttons.Add(dayViewBtn);
ApplicationBarIconButton todayBtn = new ApplicationBarIconButton();
todayBtn.Text = AppResources.ToDay;
todayBtn.IconUri = new Uri(Icons.Info, UriKind.Relative);
todayBtn.Click += new EventHandler(this.OnClickToday);
ApplicationBar.Buttons.Add(todayBtn);
ApplicationBarIconButton propBtn = new ApplicationBarIconButton();
propBtn.Text = AppResources.Properties;
propBtn.IconUri = new Uri(Icons.Info, UriKind.Relative);
propBtn.Click += new EventHandler(this.OnClickProperties);
ApplicationBar.Buttons.Add(propBtn);
ApplicationBarIconButton addBtn = new ApplicationBarIconButton();
addBtn.Text = AppResources.Add;
addBtn.IconUri = new Uri(Icons.Add, UriKind.Relative);
addBtn.Click += new EventHandler(this.OnClickCreate);
ApplicationBar.Buttons.Add(addBtn);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Back)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
}
else
{
this.ThePivot.ItemsSource = this.itemPages;
this.lastSelectedIndex = PIVOT_PAGES_HALF_DOWN;
this.ThePivot.SelectedIndex = PIVOT_PAGES_HALF_DOWN;
}
}
private DateTime GetFirstDayOfWeek(DateTime dayInWeek)
{
DateTime retValue = dayInWeek.Date;
while(retValue.DayOfWeek.Equals(DayOfWeek.Monday) == false)
{
retValue = retValue.AddDays(-1);
}
return retValue;
}
private int GetDayOfWeekIndex(DateTime dayInWeek)
{
int retValue = -1;
switch (dayInWeek.DayOfWeek)
{
case DayOfWeek.Monday: retValue = 0; break;
case DayOfWeek.Tuesday: retValue = 1; break;
case DayOfWeek.Wednesday: retValue = 2; break;
case DayOfWeek.Thursday: retValue = 3; break;
case DayOfWeek.Friday: retValue = 4; break;
case DayOfWeek.Saturday: retValue = 5; break;
case DayOfWeek.Sunday: retValue = 6; break;
}
return retValue;
}
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;
for (int i = 0; i < PIVOT_PAGES; 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);
}
*/
//this.itemPages[this.ThePivot.SelectedIndex].weekView.SetColumnBackground(0);
}
private void OnClickProperties(object sender, EventArgs e)
{
Uri url = new Uri(Constants.PathTimeTable_Properties, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
page.NavigationService.Navigate(url);
}
private void OnClickCreate(object sender, EventArgs e)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
Uri url = new Uri(Constants.PathTimeTable_AppointmentEdit, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
page.NavigationService.Navigate(url);
}
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;
int index = (this.ThePivot.SelectedIndex + (delta * PIVOT_PAGES_HALF_DOWN) + PIVOT_PAGES) % PIVOT_PAGES;
if (delta == 0)
{
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.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.lastSelectedIndex = this.ThePivot.SelectedIndex;
}
private void OnAutoScroll(object sender, RoutedEventArgs e)
{
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);
if (index >= 0)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = Constants.PathTimeTable_Appointment + "?" + Constants.Param_Appointment_Index + "=" + index;
Uri url = new Uri(urlString, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
page.NavigationService.Navigate(url);
}
}
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;
if (e.Action == NotifyCollectionChangedAction.Add)
{
tempModel = e.NewItems[0] as AppointmentModel;
}
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)
{
this.SetupPage(i);
}
}
}
}
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);
Grid headGrid = pvItem.Header as Grid;
int index = this.ThePivot.Items.IndexOf(pvItem);
headGrid.Width = e.NewSize.Width;
this.SetupPage(index);
}
*/
}
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++)
{
this.itemPages[index].Stacks[i].Clear();
}
/**/
// this.itemPages[index].Stacks.Clear();
// this.itemPages[index].Content.Children.Clear();
/*
for(int i = 0; i < 5; i++)
{
tempList[i] = new List<AppointmentModel>();
}
*/
for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
{
/*
for (int k = 0; k < 5; k++)
{
if (TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemPages[index].DateFrom.Date.AddDays(k)) > -1)
{
tempList[k].Add(TimeTable.AppointmentsModel.Appointments[i]);
}
}
*/
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++)
{
int[] intersectIndex = tempList[i].IntersectArray(tempList.ToArray());
if (intersectIndex.Count() == 0)
{
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;
for (int k = 0; k < this.itemPages[index].Stacks.Count(); k++)
{
//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]);
}
}
}
*/
/*
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)
{
}
}
}

View File

@@ -69,6 +69,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Ganztägig ähnelt.
/// </summary>
public static string AllDay {
get {
return ResourceManager.GetString("AllDay", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die BTU-Tag via NFC ähnelt.
/// </summary>
@@ -114,6 +123,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Termin ähnelt.
/// </summary>
public static string Appointment {
get {
return ResourceManager.GetString("Appointment", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Teilnehmer ähnelt.
/// </summary>
public static string Attendees {
get {
return ResourceManager.GetString("Attendees", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Automatisch scrollen zur Stunde ähnelt.
/// </summary>
public static string AutoScrollToHour {
get {
return ResourceManager.GetString("AutoScrollToHour", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Sie haben einen BTU-Tag eingescannt ähnelt.
/// </summary>
@@ -204,6 +240,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Abbrechen ähnelt.
/// </summary>
public static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Kategorie ähnelt.
/// </summary>
public static string Categories {
get {
return ResourceManager.GetString("Categories", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essenbeschreibung kopieren ähnelt.
/// </summary>
@@ -222,6 +276,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Erstellen ähnelt.
/// </summary>
public static string Creating {
get {
return ResourceManager.GetString("Creating", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Tagesansicht ähnelt.
/// </summary>
public static string DayView {
get {
return ResourceManager.GetString("DayView", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Löschen ähnelt.
/// </summary>
@@ -276,6 +348,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Beschreibung ähnelt.
/// </summary>
public static string Description {
get {
return ResourceManager.GetString("Description", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Dauer ähnelt.
/// </summary>
public static string Duration {
get {
return ResourceManager.GetString("Duration", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Bearbeiten ähnelt.
/// </summary>
public static string Edit {
get {
return ResourceManager.GetString("Edit", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
/// </summary>
@@ -303,6 +402,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Erweiterte Einstellungen ähnelt.
/// </summary>
public static string ExtendedProperties {
get {
return ResourceManager.GetString("ExtendedProperties", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Favoriten ähnelt.
/// </summary>
@@ -348,6 +456,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die groß ähnelt.
/// </summary>
public static string Large {
get {
return ResourceManager.GetString("Large", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Ebene ähnelt.
/// </summary>
@@ -501,6 +618,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Autoscrollauswahl ähnelt.
/// </summary>
public static string ListPickerHeaderAutoScroll {
get {
return ResourceManager.GetString("ListPickerHeaderAutoScroll", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Campusauswahl ähnelt.
/// </summary>
@@ -555,6 +681,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Anzeigegrößenauswahl ähnelt.
/// </summary>
public static string ListPickerHeaderVisualScale {
get {
return ResourceManager.GetString("ListPickerHeaderVisualScale", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Ort ähnelt.
/// </summary>
public static string Location {
get {
return ResourceManager.GetString("Location", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Webmail ähnelt.
/// </summary>
@@ -564,6 +708,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die mittel ähnelt.
/// </summary>
public static string Medium {
get {
return ResourceManager.GetString("Medium", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Die Mensa ist heute geschlossen ähnelt.
/// </summary>
@@ -870,6 +1023,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Priorität ähnelt.
/// </summary>
public static string Priority {
get {
return ResourceManager.GetString("Priority", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Lehrstühle ähnelt.
/// </summary>
@@ -879,6 +1041,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Einstellungen ähnelt.
/// </summary>
public static string Properties {
get {
return ResourceManager.GetString("Properties", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ... suche ähnelt.
/// </summary>
@@ -888,6 +1059,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Wiederholung ähnelt.
/// </summary>
public static string Repeat {
get {
return ResourceManager.GetString("Repeat", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die LeftToRight ähnelt.
/// </summary>
@@ -924,6 +1104,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Speichern ähnelt.
/// </summary>
public static string Save {
get {
return ResourceManager.GetString("Save", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Bitte halten Sie das Handy vor dem NFC-Tag und stellen Sie sicher das NFC (Tap+Send) eingeschaltet ist. ähnelt.
/// </summary>
@@ -1068,6 +1257,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die klein ähnelt.
/// </summary>
public static string Small {
get {
return ResourceManager.GetString("Small", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
/// </summary>
@@ -1086,6 +1284,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Fr ähnelt.
/// </summary>
public static string Time_Day_Friday_Short {
get {
return ResourceManager.GetString("Time_Day_Friday_Short", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Montag ähnelt.
/// </summary>
@@ -1095,6 +1302,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Mo ähnelt.
/// </summary>
public static string Time_Day_Monday_Short {
get {
return ResourceManager.GetString("Time_Day_Monday_Short", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Samstag ähnelt.
/// </summary>
@@ -1104,6 +1320,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Sa ähnelt.
/// </summary>
public static string Time_Day_Saturday_Short {
get {
return ResourceManager.GetString("Time_Day_Saturday_Short", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Sonntag ähnelt.
/// </summary>
@@ -1113,6 +1338,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die So ähnelt.
/// </summary>
public static string Time_Day_Sunday_Short {
get {
return ResourceManager.GetString("Time_Day_Sunday_Short", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Donnerstag ähnelt.
/// </summary>
@@ -1122,6 +1356,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Do ähnelt.
/// </summary>
public static string Time_Day_Thursday_Short {
get {
return ResourceManager.GetString("Time_Day_Thursday_Short", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Dienstag ähnelt.
/// </summary>
@@ -1131,6 +1374,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Di ähnelt.
/// </summary>
public static string Time_Day_Tuesday_Short {
get {
return ResourceManager.GetString("Time_Day_Tuesday_Short", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Mittwoch ähnelt.
/// </summary>
@@ -1140,6 +1392,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Mi ähnelt.
/// </summary>
public static string Time_Day_Wednesday_Short {
get {
return ResourceManager.GetString("Time_Day_Wednesday_Short", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Stundenplan ähnelt.
/// </summary>
@@ -1149,6 +1410,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Titel ähnelt.
/// </summary>
public static string Title {
get {
return ResourceManager.GetString("Title", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die bis ähnelt.
/// </summary>
public static string To {
get {
return ResourceManager.GetString("To", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Heute ähnelt.
/// </summary>
public static string ToDay {
get {
return ResourceManager.GetString("ToDay", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Aktuali-sieren ähnelt.
/// </summary>
@@ -1158,6 +1446,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Sichtbarkeit ähnelt.
/// </summary>
public static string Visibility {
get {
return ResourceManager.GetString("Visibility", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Anzeige Größe ähnelt.
/// </summary>
public static string VisualScale {
get {
return ResourceManager.GetString("VisualScale", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Wochenansicht ähnelt.
/// </summary>
public static string WeekView {
get {
return ResourceManager.GetString("WeekView", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Willkommen zur BTU-CampusApp WP8 ähnelt.
/// </summary>
@@ -1166,5 +1481,14 @@ namespace CampusAppWP8.Resources {
return ResourceManager.GetString("WelcomeString", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Wann ähnelt.
/// </summary>
public static string When {
get {
return ResourceManager.GetString("When", resourceCulture);
}
}
}
}

View File

@@ -374,6 +374,12 @@
<data name="PersonApp_Title" xml:space="preserve">
<value>Personen</value>
</data>
<data name="Appointment" xml:space="preserve">
<value>Termin</value>
</data>
<data name="Edit" xml:space="preserve">
<value>Bearbeiten</value>
</data>
<data name="PersonApp_Appointment" xml:space="preserve">
<value>Einrichtung</value>
</data>
@@ -395,6 +401,9 @@
<data name="MsgBox_NoResult" xml:space="preserve">
<value>Es gibt keine Ergebnisse zur gestellten Anfrage</value>
</data>
<data name="ToDay" xml:space="preserve">
<value>Heute</value>
</data>
<data name="MsgBox_NoLocation" xml:space="preserve">
<value>Akutelle Position konnte nicht bestimmt werden. Bitte schalten Sie ggf. die Ortung ein.</value>
</data>
@@ -419,6 +428,78 @@
<data name="ScarNfc_Search" xml:space="preserve">
<value>Bitte halten Sie das Handy vor dem NFC-Tag und stellen Sie sicher das NFC (Tap+Send) eingeschaltet ist.</value>
</data>
<data name="AutoScrollToHour" xml:space="preserve">
<value>Automatisch scrollen zur Stunde</value>
</data>
<data name="Properties" xml:space="preserve">
<value>Einstellungen</value>
</data>
<data name="Large" xml:space="preserve">
<value>groß</value>
</data>
<data name="ListPickerHeaderAutoScroll" xml:space="preserve">
<value>Autoscrollauswahl</value>
</data>
<data name="ListPickerHeaderVisualScale" xml:space="preserve">
<value>Anzeigegrößenauswahl</value>
</data>
<data name="Medium" xml:space="preserve">
<value>mittel</value>
</data>
<data name="Small" xml:space="preserve">
<value>klein</value>
</data>
<data name="VisualScale" xml:space="preserve">
<value>Anzeige Größe</value>
</data>
<data name="Duration" xml:space="preserve">
<value>Dauer</value>
</data>
<data name="Location" xml:space="preserve">
<value>Ort</value>
</data>
<data name="Title" xml:space="preserve">
<value>Titel</value>
</data>
<data name="To" xml:space="preserve">
<value>bis</value>
</data>
<data name="When" xml:space="preserve">
<value>Wann</value>
</data>
<data name="AllDay" xml:space="preserve">
<value>Ganztägig</value>
</data>
<data name="Attendees" xml:space="preserve">
<value>Teilnehmer</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="Description" xml:space="preserve">
<value>Beschreibung</value>
</data>
<data name="ExtendedProperties" xml:space="preserve">
<value>Erweiterte Einstellungen</value>
</data>
<data name="Repeat" xml:space="preserve">
<value>Wiederholung</value>
</data>
<data name="Save" xml:space="preserve">
<value>Speichern</value>
</data>
<data name="Visibility" xml:space="preserve">
<value>Sichtbarkeit</value>
</data>
<data name="Categories" xml:space="preserve">
<value>Kategorie</value>
</data>
<data name="Priority" xml:space="preserve">
<value>Priorität</value>
</data>
<data name="Creating" xml:space="preserve">
<value>Erstellen</value>
</data>
<data name="PlaceLabel_Accessbility" xml:space="preserve">
<value>Barrierefreiheit</value>
</data>
@@ -434,6 +515,12 @@
<data name="PlaceLabel_Type" xml:space="preserve">
<value>Type</value>
</data>
<data name="DayView" xml:space="preserve">
<value>Tagesansicht</value>
</data>
<data name="WeekView" xml:space="preserve">
<value>Wochenansicht</value>
</data>
<data name="MensaApp_CloseMensa" xml:space="preserve">
<value>Die Mensa ist heute geschlossen</value>
</data>
@@ -488,4 +575,25 @@
<data name="BTUTag_WrongTag" xml:space="preserve">
<value>Der eingescannte Tag ist kein BTU-Tag</value>
</data>
<data name="Time_Day_Friday_Short" xml:space="preserve">
<value>Fr</value>
</data>
<data name="Time_Day_Monday_Short" xml:space="preserve">
<value>Mo</value>
</data>
<data name="Time_Day_Saturday_Short" xml:space="preserve">
<value>Sa</value>
</data>
<data name="Time_Day_Sunday_Short" xml:space="preserve">
<value>So</value>
</data>
<data name="Time_Day_Thursday_Short" xml:space="preserve">
<value>Do</value>
</data>
<data name="Time_Day_Tuesday_Short" xml:space="preserve">
<value>Di</value>
</data>
<data name="Time_Day_Wednesday_Short" xml:space="preserve">
<value>Mi</value>
</data>
</root>

View File

@@ -417,6 +417,9 @@
<data name="UniCBTelPrefix" xml:space="preserve">
<value>035569</value>
</data>
<data name="Param_Appointment_Index" xml:space="preserve">
<value>AppointmentIndex</value>
</data>
<data name="PersonListValidRootName" xml:space="preserve">
<value>Uebersicht</value>
</data>
@@ -570,6 +573,21 @@
<data name="ParamRemoveBack" xml:space="preserve">
<value>removeBack</value>
</data>
<data name="PathTimeTable_Appointment" xml:space="preserve">
<value>/Pages/TimeTable/Appointment.xaml</value>
</data>
<data name="PathTimeTable_AppointmentEdit" xml:space="preserve">
<value>/Pages/TimeTable/AppointmentEdit.xaml</value>
</data>
<data name="PathTimeTable_Day" xml:space="preserve">
<value>/Pages/TimeTable/TimeTableDay.xaml</value>
</data>
<data name="PathTimeTable_Week" xml:space="preserve">
<value>/Pages/TimeTable/TimeTableWeek.xaml</value>
</data>
<data name="PathTimeTable_Properties" xml:space="preserve">
<value>/Pages/TimeTable/TimeTableProperties.xaml</value>
</data>
<data name="BTUTAG_QRStart" xml:space="preserve">
<value>BTU-CampusApp</value>
</data>

View File

@@ -600,6 +600,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die AppointmentIndex ähnelt.
/// </summary>
public static string Param_Appointment_Index {
get {
return ResourceManager.GetString("Param_Appointment_Index", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die BuildingId ähnelt.
/// </summary>
@@ -1005,6 +1014,51 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/TimeTable/Appointment.xaml ähnelt.
/// </summary>
public static string PathTimeTable_Appointment {
get {
return ResourceManager.GetString("PathTimeTable_Appointment", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/TimeTable/AppointmentEdit.xaml ähnelt.
/// </summary>
public static string PathTimeTable_AppointmentEdit {
get {
return ResourceManager.GetString("PathTimeTable_AppointmentEdit", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/TimeTable/TimeTableDay.xaml ähnelt.
/// </summary>
public static string PathTimeTable_Day {
get {
return ResourceManager.GetString("PathTimeTable_Day", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/TimeTable/TimeTableProperties.xaml ähnelt.
/// </summary>
public static string PathTimeTable_Properties {
get {
return ResourceManager.GetString("PathTimeTable_Properties", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/TimeTable/TimeTableWeek.xaml ähnelt.
/// </summary>
public static string PathTimeTable_Week {
get {
return ResourceManager.GetString("PathTimeTable_Week", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Uebersicht ähnelt.
/// </summary>

View File

@@ -1,45 +1,45 @@
<StyleCopSettings Version="105">
<GlobalSettings>
<CollectionProperty Name="RecognizedWords">
<Value>akadgrad</Value>
<Value>api</Value>
<Value>apis</Value>
<Value>enum</Value>
<Value>fiedlchr</Value>
<Value>initialise</Value>
<Value>initialises</Value>
<Value>ndef</Value>
<Value>ndefs</Value>
<Value>nfc</Value>
<Value>param</Value>
<Value>perodic</Value>
<Value>pid</Value>
<Value>pids</Value>
<Value>pis</Value>
<Value>prev</Value>
<Value>pss</Value>
<Value>qr</Value>
<Value>Senftenberg</Value>
<Value>sps</Value>
<Value>Stubbfel</Value>
<Value>uni</Value>
<Value>wc</Value>
<Value>wifi</Value>
</CollectionProperty>
</GlobalSettings>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings>
<StringProperty Name="CompanyName">BTU/IIT</StringProperty>
<StringProperty Name="Copyright">The MIT License (MIT). Copyright (c) 2013 BTU/IIT.</StringProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
<StyleCopSettings Version="105">
<GlobalSettings>
<CollectionProperty Name="RecognizedWords">
<Value>akadgrad</Value>
<Value>api</Value>
<Value>apis</Value>
<Value>enum</Value>
<Value>fiedlchr</Value>
<Value>initialise</Value>
<Value>initialises</Value>
<Value>ndef</Value>
<Value>ndefs</Value>
<Value>nfc</Value>
<Value>param</Value>
<Value>perodic</Value>
<Value>pid</Value>
<Value>pids</Value>
<Value>pis</Value>
<Value>prev</Value>
<Value>pss</Value>
<Value>qr</Value>
<Value>Senftenberg</Value>
<Value>sps</Value>
<Value>Stubbfel</Value>
<Value>uni</Value>
<Value>wc</Value>
<Value>wifi</Value>
</CollectionProperty>
</GlobalSettings>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings>
<StringProperty Name="CompanyName">BTU/IIT</StringProperty>
<StringProperty Name="Copyright">The MIT License (MIT). Copyright (c) 2013 BTU/IIT.</StringProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
</StyleCopSettings>

View File

@@ -0,0 +1,318 @@
//-----------------------------------------------------------------------------
// <copyright file="ICSClasses.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>29.08.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/// <summary>ICS structure classes.</summary>
/// <remarks>Fiedler, 05.09.2013.</remarks>
public class ICSClasses
{
/// <summary>Check parameter.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="paramStr">The parameter string.</param>
/// <param name="list"> The list.</param>
/// <returns>-1 if parameter is not in the list, otherwise index.</returns>
public static int CheckParam(string paramStr, Tuple<string, string>[] list)
{
int retValue = -1;
for (int i = 0; i < list.Count(); i++)
{
if (paramStr.Equals(list[i].Item1))
{
retValue = i;
}
}
return retValue;
}
/// <summary>Check parameter.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="paramStr">The parameter string.</param>
/// <param name="list"> The list.</param>
/// <returns>-1 if parameter is not in the list, otherwise index.</returns>
public static int CheckParam(string paramStr, Tuple<string, string[]>[] list)
{
int retValue = -1;
for (int i = 0; i < list.Count(); i++)
{
if (paramStr.Equals(list[i].Item1))
{
retValue = i;
}
}
return retValue;
}
/// <summary>Check parameter and parameter value. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="paramStr"> The parameter string.</param>
/// <param name="paramValueStr">The parameter value string.</param>
/// <param name="list"> The list.</param>
/// <returns>true if it succeeds, false if it fails. </returns>
public static bool CheckParamAndParamValue(string paramStr, string paramValueStr, Tuple<string, string[]>[] list)
{
bool retValue = false;
int paramPos = CheckParam(paramStr, list);
if (paramPos >= 0)
{
if (list[paramPos].Item2 == null)
{
retValue = true;
}
else
{
for (int i = 0; i < list[paramPos].Item2.Count(); i++)
{
if (paramValueStr.Equals(list[paramPos].Item2[i]))
{
retValue = true;
}
}
}
}
return retValue;
}
/// <summary>Check parameter and parameter value. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="paramStr"> The parameter string.</param>
/// <param name="paramValueStr">The parameter value string.</param>
/// <param name="list"> The list.</param>
/// <returns>true if it succeeds, false if it fails. </returns>
public static bool CheckParamAndParamValue(string paramStr, string[] paramValueStr, Tuple<string, string[]>[] list)
{
bool retValue = true;
for (int i = 0; i < paramValueStr.Count(); i++)
{
if (!CheckParamAndParamValue(paramStr, paramValueStr[i], list))
{
retValue = false;
}
}
return retValue;
}
/// <summary>UTC string to date time. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="timeStr">The time string.</param>
/// <returns>Date/Time object represented by the time string.</returns>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.3.5"/>
public static DateTime UTCStringToDateTime(string timeStr)
{
timeStr = timeStr.Insert(4, "-");
timeStr = timeStr.Insert(7, "-");
if (!IsDate(timeStr))
{
timeStr = timeStr.Insert(13, ":");
timeStr = timeStr.Insert(16, ":");
}
return DateTime.Parse(timeStr);
}
/// <summary>Query if time string is date. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="timeStr">The time string.</param>
/// <returns>true if date, false if not. </returns>
public static bool IsDate(string timeStr)
{
if (timeStr[timeStr.Length - 1].Equals('Z'))
{
return false;
}
else
{
return true;
}
}
/// <summary>String to time span. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <param name="timeStr">The time string.</param>
/// <returns>TimeSpan object represented by the time string.</returns>
public static TimeSpan StringToTimeSpan(string timeStr)
{
TimeSpan retValue = TimeSpan.Zero;
Tuple<int, char>[] valList = DurSplit(timeStr);
int days = 0;
int hours = 0;
int mins = 0;
int secs = 0;
for (int i = 0; i < valList.Count(); i++)
{
switch (valList[i].Item2)
{
case 'D':
days = valList[i].Item1;
break;
case 'W':
days = valList[i].Item1 * 7;
break;
case 'H':
hours = valList[i].Item1;
break;
case 'M':
mins = valList[i].Item1;
break;
case 'S':
secs = valList[i].Item1;
break;
default:
throw new NotSupportedException("duration tag (" + valList[i].Item2 + ") not supported");
}
}
retValue = new TimeSpan(days, hours, mins, secs);
return retValue;
}
/// <summary>Duration split. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="durStr">The duration string.</param>
/// <returns>Tuple of the string.</returns>
public static Tuple<int, char>[] DurSplit(string durStr)
{
List<Tuple<int, char>> retValue = new List<Tuple<int, char>>();
string str = durStr.Replace("P", string.Empty).Replace("T", string.Empty).Replace("+", string.Empty).Replace("-", string.Empty);
int val = 0;
char typeChar;
for (int i = 0; i < durStr.Length; i++)
{
if (durStr[i] >= '0' && durStr[i] <= '9')
{
val *= 10;
val += durStr[0] - '0';
}
else
{
typeChar = durStr[i];
retValue.Add(new Tuple<int, char>(val, typeChar));
val = 0;
}
}
return retValue.ToArray();
}
/// <summary>Time span to string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="timeSpan"> The time span.</param>
/// <param name="isNegative">(Optional) the is negative.</param>
/// <returns>String representing the TimeSpan object.</returns>
public static string TimeSpanToString(TimeSpan timeSpan, bool isNegative = false)
{
string retValue = string.Empty;
if (isNegative)
{
retValue += "-";
}
retValue += "P";
if (timeSpan.Days > 0)
{
retValue += timeSpan.Days.ToString() + "D";
}
if ((timeSpan.Hours > 0) || (timeSpan.Minutes > 0) || (timeSpan.Seconds > 0))
{
retValue += "T" + timeSpan.Hours.ToString() + "H" + timeSpan.Minutes.ToString() + "M" + timeSpan.Seconds.ToString() + "S";
}
return retValue;
}
/// <summary>Date time to string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="val"> Date/Time of the value.</param>
/// <param name="isDate">(Optional) date of the is.</param>
/// <returns>String representing the Date/Time object.</returns>
public static string DateTimeToString(DateTime val, bool isDate = false)
{
string retValue = string.Empty;
if (isDate)
{
retValue += string.Format("{0:yyyyMMdd}", val.ToUniversalTime());
}
else
{
retValue += string.Format("{0:yyyyMMdd}T{0:HHmmss}Z", val.ToUniversalTime());
}
return retValue;
}
/// <summary>Basic interface class.</summary>
/// <remarks>Fiedler, 05.09.2013.</remarks>
public abstract class Interface
{
/// <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>
/// <param name="paramStr">The parameter string.</param>
public virtual void Set(string valueStr, string paramStr)
{
this.Set(valueStr, paramStr.Split(';'));
}
/// <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>
/// <param name="paramStrList">List of parameter strings.</param>
public abstract void Set(string valueStr, string[] paramStrList);
/// <summary>Gets the bytes. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>An array of byte. </returns>
public virtual byte[] GetBytes()
{
return Encoding.UTF8.GetBytes(this.GetString());
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public abstract string GetString();
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public abstract string GetName();
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public abstract void SetValues(object icsProperty);
}
}
}

View File

@@ -0,0 +1,315 @@
//-----------------------------------------------------------------------------
// <copyright file="ICSManager.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 CampusAppWPortalLib8.Utility;
/// <summary>ICS manager.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
public static class ICSManager
{
/// <summary>Export to ICS byte.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="icalObj">The ICal object.</param>
/// <returns>ICalObject as byte array.</returns>
public static byte[] ExportToICSByte(ICalObject icalObj)
{
List<byte> retValue = new List<byte>();
retValue.AddRange(SubExportByte(icalObj));
return retValue.ToArray();
}
/// <summary>Import from ICS.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <param name="icsData">Information describing the ICS.</param>
/// <returns>ICalObject object.</returns>
public static ICalObject ImportFromICS(string icsData)
{
ICalObject retValue = null;
ICalObject retPointer = null;
string[] elems = Regex.Split(ICSManager.Unfold(icsData), "\r\n");
List<ICSDict.ICSValueDesc> parentList = new List<ICSDict.ICSValueDesc>();
parentList.Add(ICSDict.Root);
foreach (string e in elems)
{
ContentLine prop = ICSManager.ToContentLine(e);
ICSDict.ICSElemDesc tempElem = null;
if ((tempElem = parentList.Last().GetValue(prop.Name)) != null)
{
object propObj = tempElem.CreateObj(prop.ValueString, (prop.ParamList == null) ? null : prop.ParamList.ToArray());
if (ICSManager.Is((propObj as ICSClasses.Interface).GetName(), ICSTag.BEGIN))
{
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
{
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 + ")");
}
}
}
return retValue;
}
/// <summary>Export to ICS.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="icalObj">The ICal object.</param>
/// <returns>ICalObject as string.</returns>
public static string ExportToICS(ICalObject icalObj)
{
string retValue = string.Empty;
retValue += SubExport(icalObj);
return retValue;
}
/// <summary>Sub export.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="icalObj">The ICal object.</param>
/// <returns>ICalObject as string.</returns>
private static string SubExport(ICalObject icalObj)
{
string retValue = string.Empty;
retValue += icalObj.Header.GetString() + "\r\n";
foreach (object obj in icalObj.PropertieList)
{
if (obj.GetType().Equals(typeof(ICalObject)))
{
retValue += SubExport(obj as ICalObject);
}
else
{
retValue += (obj as ICSClasses.Interface).GetString() + "\r\n";
}
}
ICSProperties.End tempEnd = new ICSProperties.End();
tempEnd.Value = icalObj.Header.Value;
retValue += tempEnd.GetString() + "\r\n";
return retValue;
}
/// <summary>Sub export byte.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="icalObj">The ICal object.</param>
/// <returns>ICalObject as byte array</returns>
private static byte[] SubExportByte(ICalObject icalObj)
{
List<byte> retValue = new List<byte>();
retValue.AddRange(icalObj.Header.GetBytes());
retValue.AddRange(Encoding.UTF8.GetBytes("\r\n"));
foreach (object obj in icalObj.PropertieList)
{
if (obj.GetType().Equals(typeof(ICalObject)))
{
retValue.AddRange(SubExportByte(obj as ICalObject));
}
else
{
retValue.AddRange((obj as ICSClasses.Interface).GetBytes());
retValue.AddRange(Encoding.UTF8.GetBytes("\r\n"));
}
}
ICSProperties.End tempEnd = new ICSProperties.End();
tempEnd.Value = icalObj.Header.Value;
retValue.AddRange(tempEnd.GetBytes());
retValue.AddRange(Encoding.UTF8.GetBytes("\r\n"));
return retValue.ToArray();
}
/// <summary>Unfold a long ICS string.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="icsData">Information describing the ICS.</param>
/// <returns>Unfolded string.</returns>
private static string Unfold(string icsData)
{
return icsData.Replace("\r\n ", string.Empty).Replace("\r\n\x09", string.Empty);
}
/// <summary>Folds a long string.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="data">The data.</param>
/// <returns>Folded ICS string.</returns>
private static 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;
}
/// <summary>Gets sub value.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <param name="tag">The tag.</param>
/// <param name="elemDesc">Information describing the element.</param>
/// <returns>The sub value.</returns>
private static 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;
}
/// <summary>Check if the object has the name of the tag.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="obj">The object.</param>
/// <param name="tag">The tag.</param>
/// <returns>true if it succeeds, false if it fails.</returns>
private static bool Is(ContentLine obj, string tag)
{
return obj.Name.Equals(tag);
}
/// <summary>check if the two strings are equal.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
/// <param name="str1">The first string.</param>
/// <param name="str2">The second string.</param>
/// <returns>true if it succeeds, false if it fails.</returns>
private static bool Is(string str1, string str2)
{
return str1.Equals(str2);
}
/// <summary>Converts an ICS line to a content line.</summary>
/// <remarks>Fiedler, 27.08.2013.</remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <param name="icsLine">The ICS line.</param>
/// <returns>ICS line as a ContentLine.</returns>
private static 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");
}
retValue.ValueString = valueSplit[1];
// params
int paramNum = DefaultStringManager.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;
}
/// <summary>Content line.</summary>
/// <remarks>Fiedler, 09.09.2013.</remarks>
private struct ContentLine
{
/// <summary>The name.</summary>
public string Name;
/// <summary>List of parameters.</summary>
public List<string> ParamList;
/// <summary>The value string.</summary>
public string ValueString;
}
}
}

View File

@@ -0,0 +1,741 @@
//-----------------------------------------------------------------------------
// <copyright file="ICSObjectConst.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;
public class ICSDict
{
public class ICSDesc
{
private string name = string.Empty;
public ICSDesc()
{
}
public string Name
{
get
{
return this.name;
}
protected set
{
this.name = value;
}
}
public bool Is(string tag)
{
return this.name.Equals(tag);
}
}
public class ICSParamDesc : ICSDesc
{
private List<string> types = null;
public ICSParamDesc(string name, string[] typeList) : base()
{
this.Name = name;
if((typeList != null) && (typeList.Length > 0))
{
this.types = new List<string>();
this.types.AddRange(types);
}
}
public List<string> List
{
get
{
return this.types;
}
private set
{
this.types = value;
}
}
public bool HasList()
{
return ((this.types != null) && (this.types.Count > 0));
}
}
public class ICSValueDesc : ICSDesc
{
private List<ICSElemDesc> subs = null;
public ICSValueDesc(string name, ICSElemDesc[] elemList) : base()
{
this.Name = name;
if((elemList != null) && (elemList.Length > 0))
{
this.subs = new List<ICSElemDesc>();
this.subs.AddRange(elemList);
}
}
public List<ICSElemDesc> List
{
get
{
return this.subs;
}
private set
{
this.subs = value;
}
}
public bool HasList()
{
return ((this.subs != null) && (this.subs.Count > 0));
}
public bool IsInList(string tagName)
{
bool retValue = false;
if (this.HasList() == true)
{
foreach (ICSElemDesc e in this.subs)
{
if (e.Is(tagName) == true)
{
retValue = true;
}
}
}
return retValue;
}
public ICSElemDesc GetValue(string tagName)
{
ICSElemDesc retValue = null;
if (this.HasList() == true)
{
foreach (ICSElemDesc e in this.subs)
{
if (e.Is(tagName) == true)
{
retValue = e;
}
}
}
return retValue;
}
}
public class ICSElemDesc : ICSDesc
{
private List<ICSValueDesc> value = null;
private Type objType;
public ICSElemDesc(Type t, ICSValueDesc[] valueList) : base()
{
this.objType = t;
this.Name = (this.CreateObj() as ICSClasses.Interface).GetName();
if ((valueList != null) && (valueList.Length > 0))
{
this.value = new List<ICSValueDesc>();
this.value.AddRange(valueList);
}
}
/*
public List<ICSParamDesc> ParamList
{
get
{
return this.param;
}
private set
{
this.param = value;
}
}
*/
public List<ICSValueDesc> ValueList
{
get
{
return this.value;
}
private set
{
this.value = value;
}
}
/*
public bool HasParams()
{
return ((this.param != null) && (this.param.Count > 0));
}
*/
public bool HasValues()
{
return ((this.value != null) && (this.value.Count > 0));
}
public ICSValueDesc GetValue(string tagName)
{
ICSValueDesc retValue = null;
if (this.HasValues() == true)
{
foreach (ICSValueDesc e in this.value)
{
if (e.Is(tagName) == true)
{
retValue = e;
}
}
}
return retValue;
}
public object CreateObj()
{
return Activator.CreateInstance(this.objType);
}
public object CreateObj(string valueString, string paramString)
{
object retValue = this.CreateObj();
(retValue as ICSClasses.Interface).Set(valueString, paramString);
return retValue;
}
public object CreateObj(string valueString, string[] paramStringList)
{
object retValue = this.CreateObj();
(retValue as ICSClasses.Interface).Set(valueString, paramStringList);
return retValue;
}
public Type GetObjType()
{
return this.objType;
}
}
public static ICSValueDesc Root = new ICSValueDesc("ROOT", new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.Begin), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VCALENDAR, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.Version), null),
new ICSElemDesc(typeof(ICSProperties.ProductID), null),
new ICSElemDesc(typeof(ICSProperties.CalendarScale), new ICSValueDesc[] {
new ICSValueDesc(ICSValue.GREGORIAN, null)
}),
new ICSElemDesc(typeof(ICSProperties.Method), null),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VCALENDAR, null)
}),
new ICSElemDesc(typeof(ICSProperties.Begin), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VEVENT, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.DTStamp), null),
new ICSElemDesc(typeof(ICSProperties.UniqueID), null),
new ICSElemDesc(typeof(ICSProperties.DTStart), null),
new ICSElemDesc(typeof(ICSProperties.AccessClass), null),
new ICSElemDesc(typeof(ICSProperties.DTCreated), null),
new ICSElemDesc(typeof(ICSProperties.Description), null),
new ICSElemDesc(typeof(ICSProperties.Geo), null),
new ICSElemDesc(typeof(ICSProperties.LastModified), null),
new ICSElemDesc(typeof(ICSProperties.Location), null),
new ICSElemDesc(typeof(ICSProperties.Organizer), null),
new ICSElemDesc(typeof(ICSProperties.Priority), null),
new ICSElemDesc(typeof(ICSProperties.SequenceNumber), null),
new ICSElemDesc(typeof(ICSProperties.Status), null),
new ICSElemDesc(typeof(ICSProperties.Summary), null),
new ICSElemDesc(typeof(ICSProperties.TimeTransparency), null),
new ICSElemDesc(typeof(ICSProperties.Url), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceID), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceRule), null),
new ICSElemDesc(typeof(ICSProperties.DTEnd), null),
new ICSElemDesc(typeof(ICSProperties.Duration), null),
new ICSElemDesc(typeof(ICSProperties.Attachment), null),
new ICSElemDesc(typeof(ICSProperties.Attendee), null),
new ICSElemDesc(typeof(ICSProperties.Categories), null),
new ICSElemDesc(typeof(ICSProperties.Comment), null),
new ICSElemDesc(typeof(ICSProperties.Contact), null),
new ICSElemDesc(typeof(ICSProperties.DTException), null),
new ICSElemDesc(typeof(ICSProperties.RequestStatus), null),
new ICSElemDesc(typeof(ICSProperties.RelatedTo), null),
new ICSElemDesc(typeof(ICSProperties.Resources), null),
new ICSElemDesc(typeof(ICSProperties.DTRecurrence), null),
new ICSElemDesc(typeof(ICSProperties.Begin), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VALARM, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.Action), new ICSValueDesc[] { // audio, display, email
new ICSValueDesc(ICSValue.AUDIO, null),
new ICSValueDesc(ICSValue.DISP, null),
new ICSValueDesc(ICSValue.EMAIL, null)
}),
new ICSElemDesc(typeof(ICSProperties.Trigger), null), // audio, display, email
new ICSElemDesc(typeof(ICSProperties.Duration), null), // audio, display, email
new ICSElemDesc(typeof(ICSProperties.RepeatCount), null), // audio, display, email
new ICSElemDesc(typeof(ICSProperties.Attachment), null), // audio, email
new ICSElemDesc(typeof(ICSProperties.Description), null),// display, eamil
new ICSElemDesc(typeof(ICSProperties.Summary), null), // email
new ICSElemDesc(typeof(ICSProperties.Attendee), null), // email
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] { // audio, display, email
new ICSValueDesc(ICSTag.VALARM, null)
})
})
}),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VEVENT, null)
})
}),
new ICSValueDesc(ICSTag.VTODO, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.DTStamp), null),
new ICSElemDesc(typeof(ICSProperties.UniqueID), null),
new ICSElemDesc(typeof(ICSProperties.AccessClass), null),
new ICSElemDesc(typeof(ICSProperties.DTCompleted), null),
new ICSElemDesc(typeof(ICSProperties.DTCreated), null),
new ICSElemDesc(typeof(ICSProperties.Description), null),
new ICSElemDesc(typeof(ICSProperties.DTStart), null),
new ICSElemDesc(typeof(ICSProperties.Geo), null),
new ICSElemDesc(typeof(ICSProperties.LastModified), null),
new ICSElemDesc(typeof(ICSProperties.Location), null),
new ICSElemDesc(typeof(ICSProperties.Organizer), null),
new ICSElemDesc(typeof(ICSProperties.PercentComplete), null),
new ICSElemDesc(typeof(ICSProperties.Priority), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceID), null),
new ICSElemDesc(typeof(ICSProperties.SequenceNumber), null),
new ICSElemDesc(typeof(ICSProperties.Status), null),
new ICSElemDesc(typeof(ICSProperties.Summary), null),
new ICSElemDesc(typeof(ICSProperties.Url), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceRule), null),
new ICSElemDesc(typeof(ICSProperties.DTDue), null),
new ICSElemDesc(typeof(ICSProperties.Duration), null),
new ICSElemDesc(typeof(ICSProperties.Attachment), null),
new ICSElemDesc(typeof(ICSProperties.Attendee), null),
new ICSElemDesc(typeof(ICSProperties.Categories), null),
new ICSElemDesc(typeof(ICSProperties.Comment), null),
new ICSElemDesc(typeof(ICSProperties.Contact), null),
new ICSElemDesc(typeof(ICSProperties.DTException), null),
new ICSElemDesc(typeof(ICSProperties.RequestStatus), null),
new ICSElemDesc(typeof(ICSProperties.RelatedTo), null),
new ICSElemDesc(typeof(ICSProperties.Resources), null),
new ICSElemDesc(typeof(ICSProperties.DTRecurrence), null),
new ICSElemDesc(typeof(ICSProperties.Begin), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VALARM, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.Action), new ICSValueDesc[] { // audio, display, email
new ICSValueDesc(ICSValue.AUDIO, null),
new ICSValueDesc(ICSValue.DISP, null),
new ICSValueDesc(ICSValue.EMAIL, null)
}),
new ICSElemDesc(typeof(ICSProperties.Trigger), null), // audio, display, email
new ICSElemDesc(typeof(ICSProperties.Duration), null), // audio, display, email
new ICSElemDesc(typeof(ICSProperties.RepeatCount), null), // audio, display, email
new ICSElemDesc(typeof(ICSProperties.Attachment), null), // audio, email
new ICSElemDesc(typeof(ICSProperties.Description), null),// display, eamil
new ICSElemDesc(typeof(ICSProperties.Summary), null), // email
new ICSElemDesc(typeof(ICSProperties.Attendee), null), // email
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] { // audio, display, email
new ICSValueDesc(ICSTag.VALARM, null)
})
})
}),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VTODO, null)
})
}),
new ICSValueDesc(ICSTag.VJOURNAL, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.DTStamp), null),
new ICSElemDesc(typeof(ICSProperties.UniqueID), null),
new ICSElemDesc(typeof(ICSProperties.AccessClass), null),
new ICSElemDesc(typeof(ICSProperties.DTCreated), null),
new ICSElemDesc(typeof(ICSProperties.DTStart), null),
new ICSElemDesc(typeof(ICSProperties.LastModified), null),
new ICSElemDesc(typeof(ICSProperties.Organizer), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceID), null),
new ICSElemDesc(typeof(ICSProperties.SequenceNumber), null),
new ICSElemDesc(typeof(ICSProperties.Status), null),
new ICSElemDesc(typeof(ICSProperties.Summary), null),
new ICSElemDesc(typeof(ICSProperties.Url), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceRule), null),
new ICSElemDesc(typeof(ICSProperties.Attachment), null),
new ICSElemDesc(typeof(ICSProperties.Attendee), null),
new ICSElemDesc(typeof(ICSProperties.Categories), null),
new ICSElemDesc(typeof(ICSProperties.Comment), null),
new ICSElemDesc(typeof(ICSProperties.Contact), null),
new ICSElemDesc(typeof(ICSProperties.Description), null),
new ICSElemDesc(typeof(ICSProperties.DTException), null),
new ICSElemDesc(typeof(ICSProperties.RelatedTo), null),
new ICSElemDesc(typeof(ICSProperties.DTRecurrence), null),
new ICSElemDesc(typeof(ICSProperties.RequestStatus), null),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VJOURNAL, null)
})
}),
new ICSValueDesc(ICSTag.VFREEBUSY, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.DTStamp), null),
new ICSElemDesc(typeof(ICSProperties.UniqueID), null),
new ICSElemDesc(typeof(ICSProperties.Contact), null),
new ICSElemDesc(typeof(ICSProperties.DTStart), null),
new ICSElemDesc(typeof(ICSProperties.DTEnd), null),
new ICSElemDesc(typeof(ICSProperties.Organizer), null),
new ICSElemDesc(typeof(ICSProperties.Url), null),
new ICSElemDesc(typeof(ICSProperties.Attendee), null),
new ICSElemDesc(typeof(ICSProperties.Comment), null),
new ICSElemDesc(typeof(ICSProperties.FreeBusyTime), null),
new ICSElemDesc(typeof(ICSProperties.RequestStatus), null),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VFREEBUSY, null)
})
}),
new ICSValueDesc(ICSTag.VTIMEZONE, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.TimeZoneIdentifier), null),
new ICSElemDesc(typeof(ICSProperties.LastModified), null),
new ICSElemDesc(typeof(ICSProperties.TimeZoneUrl), null),
new ICSElemDesc(typeof(ICSProperties.Begin), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.STANDARD, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.DTStart), null),
new ICSElemDesc(typeof(ICSProperties.TimeZoneOffsetTo), null),
new ICSElemDesc(typeof(ICSProperties.TimeZoneOffsetFrom), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceRule), null),
new ICSElemDesc(typeof(ICSProperties.Comment), null),
new ICSElemDesc(typeof(ICSProperties.DTRecurrence), null),
new ICSElemDesc(typeof(ICSProperties.TimeZoneName), null),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.STANDARD, null)
})
}),
new ICSValueDesc(ICSTag.DAYLIGHT, new ICSElemDesc[] {
new ICSElemDesc(typeof(ICSProperties.DTStart), null),
new ICSElemDesc(typeof(ICSProperties.TimeZoneOffsetTo), null),
new ICSElemDesc(typeof(ICSProperties.TimeZoneOffsetFrom), null),
new ICSElemDesc(typeof(ICSProperties.RecurrenceRule), null),
new ICSElemDesc(typeof(ICSProperties.Comment), null),
new ICSElemDesc(typeof(ICSProperties.DTRecurrence), null),
new ICSElemDesc(typeof(ICSProperties.TimeZoneName), null),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.STANDARD, null)
})
})
}),
new ICSElemDesc(typeof(ICSProperties.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VTIMEZONE, null)
})
})
})
})
})
});
}
public class ICSTag
{
public const string BEGIN = "BEGIN";
public const string END = "END";
// Calendar Components
public const string VCALENDAR = "VCALENDAR";
// 1-*
public const string VERSION = "VERSION";
public const string PRODUCT_ID = "PRODID";
// 0-1
public const string CAL_SCALE = "CALSCALE";
public const string METHOD = "METHOD";
// 0-*
public const string X_WR_CALNAME = "X-WR-CALNAME";
// Event Component
public const string VEVENT = "VEVENT";
// 1-1
public const string DT_STAMP = "DTSTAMP";
public const string UNIQUE_ID = "UID";
// if METHOD is NOT set: 1-1
// otherwise: 0-1
public const string DT_START = "DTSTART";
// 0-1
public const string ACCESS_CLASS = "CLASS";
public const string DT_CREATED = "CREATED";
public const string DESCRIPTION = "DESCRIPTION";
public const string GEO = "GEO"; // value-format: float;float
public const string DT_MODIFIED = "LAST-MODIFIED";
public const string LOCATION = "LOCATION";
public const string ORGANIZER = "ORGANIZER";
public const string PRIORITY = "PRIORITY";
public const string SEQ = "SEQ";
public const string STATUS = "STATUS";
public const string SUMMARY = "SUMMARY";
public const string TRANSP = "TRANSP";
public const string URL = "URL";
public const string RECURRENCE_ID = "RECURID"; // "RECURRENCE-ID"; ???
public const string RRULE = "RRULE";
// one of them can (0-1), but NOT both
public const string DT_END = "DTEND";
public const string DURATION = "DURATION";
// 0-*
public const string ATTACHMENT = "ATTACH";
public const string ATTENDEE = "ATTENDEE";
public const string CATEGORIES = "CATEGORIES";
public const string COMMENT = "COMMENT";
public const string CONTACT = "CONTACT";
public const string EXDATE = "EXDATE";
public const string RSTATUS = "REQUEST-STATUS";
public const string RELATED = "RELATED";
public const string RESOURCES = "RESOURCES";
public const string RDATE = "RDATE";
// To-Do Component
public const string VTODO = "VTODO";
public const string COMPLETED = "COMPLETED";
public const string PERCENT = "PERCENT-COMPLETE";
public const string DUE = "DUE";
// Journal Component
public const string VJOURNAL = "VJOURNAL";
// Free/Busy Component
public const string VFREEBUSY = "VFREEBUSY";
// 0-*
public const string FREEBUSY = "FREEBUSY";
// Time Zone Component
public const string VTIMEZONE = "VTIMEZONE";
// 1-1
public const string TIME_ZONE_ID = "TZID";
// 0-1
// DT_MODIFIED
public const string TIME_ZONE_URL = "TZURL";
// one of both MUST occure: 1-*
// Time Zone: Standardc/Daylightc
public const string STANDARD = "STANDARD";
public const string DAYLIGHT = "DAYLIGHT";
// 1-1
// DT_START
public const string TIME_ZONE_OFFSET_TO = "TZOFFSETTO";
public const string TIME_ZONE_OFFSET_FROM = "TZOFFSETFROM";
// 0-1
// RRULE
// 0-*
// COMMENT
// RDATE
public const string TIME_ZONE_NAME = "TZNAME";
// Alarm Component
public const string VALARM = "VALARM";
// Alarm by audio
// 1-1
public const string TRIGGER = "TRIGGER";
public const string ACTION = "ACTION"; // (AUDIO)
// 0-1 , when one occure so MUST the other
// DURATION
public const string REPEAT = "REPEAT";
// 0-1
// ATTACHMENT
// Alarm by disp
// 1-1
// ACTION (DISPLAY)
// DESCRIPTION
// TRIGGER
// 0-1, when one occure so MUST the other
// DURATION
// REPEAT
// Alarm by email
// 1-1
// ACTION (EMAIL)
// DESCRIPTION
// TRIGGER
// SUMMARY
// 1-*
// ATTENDEE
// 0-1, when one occure so MUST the other
// DURATION
// REPEAT
// 0-*
// ATTACH
// ???
// public const string RELATED_TO = "RELATED-TO";
public const string SEQUENCE = "SEQUENCE";
}
public class ICSParam
{
// see http://tools.ietf.org/html/rfc5545 3.2.
public const string ALT_REPRESENTATION = "ALTREP";
public const string COMMON_NAME = "CN";
public const string CALENDAR_USER_TYPE = "CUTYPE";
public const string DELEGATORS = "DELEGATED-FROM";
public const string DELEGATEES = "DELEGATED-TO";
public const string DIR_REFERENCE = "DIR";
public const string ENCODING = "ENCODING";
public const string FORMAT_TYPE = "FMTTYPE";
public const string FREE_BUSY_TIME_TYPE = "FBTYPE";
public const string LANGUAGE = "LANGUAGE";
public const string MEMBER = "MEMBER";
public const string PARTICIPATION_STATUS = "PARTSTAT";
public const string RECUR_ID_RANGE = "RANGE";
public const string ALARM_TRIGGER_RELATIONSHIP = "RELATED";
public const string RELATIONSHIP_TYPE = "RELTYPE";
public const string PARTICIPATION_ROLE = "ROLE";
public const string REPLY_EXPECTATION = "RSVP";
public const string SENT_BY = "SENT-BY";
public const string TIME_ZONE_ID = "TZID";
public const string VALUE_TYPE = "VALUE";
public const string NONE = "";
}
public class ICSValue
{
// CAL_SCALE (see 3.7.1.)
public const string GREGORIAN = "GREGORIAN";
// VALARM.ACTION
public const string AUDIO = "AUDIO";
public const string DISP = "DISPLAY";
public const string EMAIL = "EMAIL";
// ACCESS_CLASS
public const string PUBLIC = "PUBLIC";
public const string PRIVATE = "PRIVATE";
public const string CONFIDENTIAL = "CONFIDENTIAL";
// STATUS
// (in vevent)
public const string TENTATIVE = "TENTATIVE";
public const string CONFIRMED = "CONFIRMED";
public const string CANCELLED = "CANCELLED";
// (in vtodo)
public const string NEEDS_ACTION = "NEEDS-ACTION";
public const string COMPLETED = "COMPLETED";
public const string IN_PROCESS = "IN-PROCESS";
// public const string CANCELLED = "CANCELLED";
// (in vjournal)
public const string DRAFT = "DRAFT";
public const string FINAL = "FINAL";
// public const string CANCELLED = "CANCELLED";
// TRANSP
public const string OPAQUE = "OPAQUE";
public const string TRANSPARENT = "TRANSPARENT";
// recur
public const string FREQ = "FREQ";
public const string UNTIL = "UNTIL";
public const string COUNT = "COUNT";
public const string INTERVAL = "INTERVAL";
public const string BY_SECOND = "BYSECOND";
public const string BY_MINUTE = "BYMINUTE";
public const string BY_HOUR = "BYHOUR";
public const string BY_DAY = "BYDAY";
public const string BY_MONTH_DAY = "BYMONTHDAY";
public const string BY_YEAR_DAY = "BYYEARDAY";
public const string BY_WEEK_NO = "BYWEEKNO";
public const string BY_MONTH = "BYMONTH";
public const string BY_SET_POS = "BYSETPOS";
public const string WKST = "WKST";
}
public class ICSParamValue
{
// CALENDAR_USER_TYPE
public const string INDIVIDUAL = "INDIVIDUAL"; // default
public const string GROUP = "GROUP";
public const string RESOURCE = "RESOURCE";
public const string ROOM = "ROOM";
public const string UNKNOWN = "UNKNOWN";
// ENCODING
public const string BIT8 = "8BIT"; // default
public const string BASE64 = "BASE64";
// FREE_BUSY_TIME_TYPE
public const string FREE = "FREE";
public const string BUSY = "BUSY";
public const string BUSY_UNAVAILABLE = "BUSY-UNAVAILABLE";
public const string BUSY_TENTATIVE = "BUSY-TENTATIVE";
// PARTICIPATION_STATUS
public const string NEEDS_ACTION = "NEEDS_ACTION"; // default
public const string ACCEPTED = "ACCEPTED";
public const string DECLINED = "DECLINED";
public const string TENTATIVE = "TENTATIVE";
public const string DELEGATED = "DELEGATED";
public const string COMPLETED = "COMPLETED";
// RECUR_ID_RANGE
public const string THIS_AND_FUTURE = "THISANDFUTURE";
public const string THIS_AND_PRIOR = "THISANDPRIOR";
// ALARM_TRIGGER_RELATIONSHIP
public const string START = "START";
public const string END = "END";
// RELATIONSHIP_TYPE
public const string PARENT = "PARENT"; // default
public const string CHILD = "CHILD";
public const string SIBLING = "SIBLING";
// PARTICIPATION_ROLE
public const string CHAIR = "CHAIR";
public const string REQ_PARTICIPANT = "REQ-PARTICIPANT"; //default
public const string OPT_PARTICIPANT = "OPT-PARTICIPANT";
public const string NON_PARTICIPANT = "NON-PARTICIPANT";
// REPLY_EXPECTATION
public const string TRUE = "TRUE";
public const string FALSE = "FALSE"; // default
// VALUE_TYPE (see http://tools.ietf.org/html/rfc5545 3.3.)
public const string BINARY = "BINARY";
public const string BOOLEAN = "BOOLEAN";
public const string CAL_ADDRESS = "CAL-ADDRESS";
public const string DATE = "DATE";
public const string DATE_TIME = "DATE-TIME";
public const string DURATION = "DURATION";
public const string FLOAT = "FLOAT";
public const string INTEGER = "INTEGER";
public const string PERIOD = "PERIOD";
public const string RECUR = "RECUR";
public const string TEXT = "TEXT";
public const string TIME = "TIME";
public const string URI = "URI";
public const string UTC_OFFSET = "UTC-OFFSET";
// PARTSTAT
public const string IN_PROCESS = "IN-PROCESS";
}
public class ICSValueValue
{
// recur (3.3.10.)
// freq
public const string SECONDLY = "SECONDLY";
public const string MINUTELY = "MINUTELY";
public const string HOURLY = "HOURLY";
public const string DAILY = "DAILY";
public const string WEEKLY = "WEEKLY";
public const string MONTHLY = "MONTHLY";
public const string YEARLY = "YEARLY";
// until
public const string DATE = "DATE";
public const string DATE_TIME = "DATE-TIME";
// ...
public const string DAY_SU = "SU";
public const string DAY_MO = "MO";
public const string DAY_TU = "TU";
public const string DAY_WE = "WE";
public const string DAY_TH = "TH";
public const string DAY_FR = "FR";
public const string DAY_SA = "SA";
}
}

View File

@@ -0,0 +1,124 @@
//-----------------------------------------------------------------------------
// <copyright file="AccessClass.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Access class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.3"/>
public class AccessClass : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.ACCESS_CLASS;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>List of values. </summary>
public readonly List<string> ValueList = null;
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="AccessClass" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public AccessClass()
{
this.ValueList = new List<string>();
this.ValueList.AddRange(new string[]
{
ICSValue.PUBLIC,
ICSValue.PRIVATE,
ICSValue.CONFIDENTIAL
});
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
if (this.ValueList.IndexOf(value) >= 0)
{
this.value = value;
}
else
{
throw new NotSupportedException("value (" + value + ") is not supported");
}
}
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null)
{
if (paramStrList.Count() > 0)
{
throw new NotSupportedException("in (" + Name + ") is no param supported");
}
}
if (this.ValueList.IndexOf(valueStr) >= 0)
{
this.value = valueStr;
}
else
{
throw new NotSupportedException("value (" + valueStr + ") is not supported");
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
return Name + ":" + this.value;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return AccessClass.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as AccessClass).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,126 @@
//-----------------------------------------------------------------------------
// <copyright file="Action.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Action property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.6.1"/>
public class Action : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.ACTION;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The values. </summary>
public static readonly List<string> PValues
= new List<string>(new string[]
{
ICSValue.AUDIO,
ICSValue.DISP,
ICSValue.EMAIL
});
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="Action" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Action()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
if (PValues.IndexOf(value) >= 0)
{
this.value = value;
}
else
{
throw new NotSupportedException("unsupported 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
int pos = PValues.IndexOf(valueStr);
if (pos >= 0)
{
this.value = valueStr;
}
else
{
throw new NotSupportedException("unsuported value (" + valueStr + ")");
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Action.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Action).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,233 @@
//-----------------------------------------------------------------------------
// <copyright file="Attachment.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Text;
using CampusAppWP8.Utility;
/// <summary>Attachment property class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.1"/>
public class Attachment : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.ATTACHMENT;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(ICSParam.FORMAT_TYPE, null),
new Tuple<string, string[]>(
ICSParam.ENCODING,
new string[] { ICSParamValue.BIT8, ICSParamValue.BASE64 }),
new Tuple<string, string[]>(
ICSParam.VALUE_TYPE,
new string[] { ICSParamValue.BINARY })
});
/// <summary>Type of the value. </summary>
private string valueType = string.Empty;
/// <summary>Type of the encoding. </summary>
private string encodingType = string.Empty;
/// <summary>Type of the format. </summary>
private string formatType = string.Empty;
/// <summary>The value. </summary>
private byte[] value;
/// <summary>Initializes a new instance of the <see cref="Attachment" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Attachment()
{
}
/// <summary>Gets or sets the value bytes. </summary>
/// <value>The value bytes. </value>
public byte[] ValueBytes
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>Gets or sets the value string. </summary>
/// <value>The value string. </value>
public string ValueString
{
get
{
return Encoding.UTF8.GetString(this.value, 0, this.value.Length);
}
set
{
this.value = Encoding.UTF8.GetBytes(value);
}
}
/// <summary>Gets or sets the type of the encoding. </summary>
/// <value>The type of the encoding. </value>
public string EncodingType
{
get
{
return this.encodingType;
}
set
{
if (value.Equals(ICSParamValue.BIT8) || value.Equals(ICSParamValue.BASE64))
{
this.encodingType = value;
}
}
}
/// <summary>Gets or sets the type of the value. </summary>
/// <value>The type of the value. </value>
public string ValueType
{
get
{
return this.valueType;
}
set
{
if (value.Equals(ICSParamValue.BINARY))
{
this.valueType = value;
}
}
}
/// <summary>Gets or sets the type of the format. </summary>
/// <value>The type of the format. </value>
public string FormatType
{
get
{
return this.formatType;
}
set
{
this.formatType = 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
foreach (string param in paramStrList)
{
string[] p = param.Split('=');
if (p.Length != 2)
{
throw new NotSupportedException("the number of '=' in the parameter (" + param + ") is less or greater then 1");
}
switch (p[0])
{
case ICSParam.FORMAT_TYPE:
this.formatType = p[1];
break;
case ICSParam.ENCODING:
this.encodingType = p[1];
break;
case ICSParam.VALUE_TYPE:
this.valueType = p[1];
break;
default:
throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported");
}
}
if (this.encodingType.Equals(ICSParamValue.BASE64))
{
this.value = Convert.FromBase64String(valueStr);
}
else
{
this.value = Encoding.UTF8.GetBytes(valueStr);
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (this.formatType.Equals(string.Empty) == false)
{
retValue += ";" + ICSParam.FORMAT_TYPE + "=" + this.formatType;
}
if (this.encodingType.Equals(string.Empty) == false)
{
retValue += ";" + ICSParam.ENCODING + "=" + this.encodingType;
}
if (this.valueType.Equals(string.Empty) == false)
{
retValue += ";" + ICSParam.VALUE_TYPE + "=" + this.valueType;
}
retValue += ":" + Encoding.UTF8.GetString(this.value, 0, this.value.Length);
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Attachment.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Attachment).value;
this.valueType = (icsProperty as Attachment).valueType;
this.encodingType = (icsProperty as Attachment).encodingType;
this.formatType = (icsProperty as Attachment).formatType;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,202 @@
//-----------------------------------------------------------------------------
// <copyright file="Attendee.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Attendee property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.4.1"/>
public class Attendee : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.ATTENDEE;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(
ICSParam.CALENDAR_USER_TYPE,
new string[] { ICSParamValue.INDIVIDUAL, ICSParamValue.GROUP, ICSParamValue.RESOURCE, ICSParamValue.ROOM, ICSParamValue.UNKNOWN }),
new Tuple<string, string[]>(ICSParam.MEMBER, null),
new Tuple<string, string[]>(
ICSParam.PARTICIPATION_ROLE,
new string[] { ICSParamValue.CHAIR, ICSParamValue.REQ_PARTICIPANT, ICSParamValue.OPT_PARTICIPANT, ICSParamValue.NON_PARTICIPANT }),
new Tuple<string, string[]>(
ICSParam.PARTICIPATION_STATUS,
new string[] { ICSParamValue.NEEDS_ACTION, ICSParamValue.ACCEPTED, ICSParamValue.DECLINED, ICSParamValue.TENTATIVE, ICSParamValue.DELEGATED, ICSParamValue.COMPLETED, ICSParamValue.IN_PROCESS }),
new Tuple<string, string[]>(
ICSParam.REPLY_EXPECTATION,
new string[] { ICSParamValue.TRUE, ICSParamValue.FALSE }),
new Tuple<string, string[]>(ICSParam.DELEGATEES, null),
new Tuple<string, string[]>(ICSParam.DELEGATORS, null),
new Tuple<string, string[]>(ICSParam.SENT_BY, null),
new Tuple<string, string[]>(ICSParam.COMMON_NAME, null),
new Tuple<string, string[]>(ICSParam.DIR_REFERENCE, null),
new Tuple<string, string[]>(ICSParam.LANGUAGE, null)
});
/// <summary>List of parameters. </summary>
private List<Tuple<string, string>> paramList = null;
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="Attendee" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Attendee()
{
this.paramList = new List<Tuple<string, string>>();
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <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="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
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 = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
for (int i = 0; i < this.paramList.Count(); i++)
{
retValue += ";" + this.paramList[i].Item1 + "=" + this.paramList[i].Item2;
}
retValue += ":" + this.value;
return retValue;
}
/// <summary>Adds a parameter to value string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="paramStr">The parameter string.</param>
/// <param name="valueStr">The value string.</param>
public void AddParam(string paramStr, string valueStr)
{
if (ICSClasses.CheckParamAndParamValue(paramStr, valueStr, PParams.ToArray()))
{
this.RemoveParam(paramStr);
this.paramList.Add(new Tuple<string, string>(paramStr, valueStr));
}
}
/// <summary>Removes the parameter described by parameter string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="paramStr">The parameter string.</param>
public void RemoveParam(string paramStr)
{
int pos = ICSClasses.CheckParam(paramStr, this.paramList.ToArray());
if (pos >= 0)
{
this.paramList.RemoveAt(pos);
}
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Attendee.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Attendee).value;
this.paramList = (icsProperty as Attendee).paramList;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,130 @@
//-----------------------------------------------------------------------------
// <copyright file="Begin.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Begin property class</summary>
/// <remarks>Fiedler, 05.09.2013.</remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545"/>
public class Begin : ICSClasses.Interface
{
/// <summary>The name. </summary>
public static readonly string Name = ICSTag.BEGIN;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The values. </summary>
public static readonly List<string> PValues
= new List<string>(new string[]
{
ICSTag.VCALENDAR,
ICSTag.VEVENT,
ICSTag.VTODO,
ICSTag.VJOURNAL,
ICSTag.VFREEBUSY,
ICSTag.VTIMEZONE,
ICSTag.STANDARD,
ICSTag.DAYLIGHT,
ICSTag.VALARM
});
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="Begin" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Begin()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
if (PValues.IndexOf(value) >= 0)
{
this.value = value;
}
else
{
throw new NotSupportedException("value (" + value + ") is not supported");
}
}
}
/// <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>
/// <param name="valueStr">The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
if (PValues.IndexOf(valueStr) >= 0)
{
this.value = valueStr;
}
else
{
throw new NotSupportedException("value " + valueStr + ") is not suppiorted");
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Begin.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Begin).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,122 @@
//-----------------------------------------------------------------------------
// <copyright file="CalendarScale.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Calendar scale. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.7.1"/>
public class CalendarScale : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.CAL_SCALE;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The values. </summary>
public static readonly List<string> PValues
= new List<string>(new string[]
{
ICSValue.GREGORIAN
});
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="CalendarScale" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public CalendarScale()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
if (PValues.IndexOf(value) >= 0)
{
this.value = value;
}
else
{
throw new NotSupportedException("value (" + value + ") is not supported");
}
}
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
if (PValues.IndexOf(valueStr) >= 0)
{
this.value = valueStr;
}
else
{
throw new NotSupportedException("value " + valueStr + ") is not suppiorted");
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return CalendarScale.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as CalendarScale).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,177 @@
//-----------------------------------------------------------------------------
// <copyright file="Categories.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Categories property class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.2"/>
public class Categories : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.CATEGORIES;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(ICSParam.LANGUAGE, null)
});
/// <summary>List of values. </summary>
private List<string> valueList = null;
/// <summary>Type of the language. </summary>
private string languageType = string.Empty;
/// <summary>Initializes a new instance of the <see cref="Categories" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Categories()
{
this.valueList = new List<string>();
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public List<string> Value
{
get
{
return this.valueList;
}
set
{
this.valueList = value;
}
}
/// <summary>Gets or sets the language. </summary>
/// <value>The language. </value>
public string Language
{
get
{
return this.languageType;
}
set
{
this.languageType = 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null)
{
if (paramStrList.Count() > 1)
{
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)
{
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");
}
}
}
this.valueList.AddRange(valueStr.Split(','));
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (this.languageType.Equals(string.Empty) == false)
{
retValue += ";" + ICSParam.LANGUAGE + "=" + this.languageType;
}
retValue += ":" + this.valueList.First();
for (int i = 1; i < this.valueList.Count(); i++)
{
retValue += "," + this.valueList[i];
}
return retValue;
}
/// <summary>Adds a category. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="categoryName">Name of the category.</param>
public void AddCategory(string categoryName)
{
if (this.valueList.IndexOf(categoryName) < 0)
{
this.valueList.Add(categoryName);
}
}
/// <summary>Removes the category described by categoryName. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="categoryName">Name of the category.</param>
public void RemoveCategory(string categoryName)
{
this.valueList.Remove(categoryName);
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Categories.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.valueList = (icsProperty as Categories).valueList;
this.languageType = (icsProperty as Categories).languageType;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,178 @@
//-----------------------------------------------------------------------------
// <copyright file="Comment.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Comment property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.4"/>
public class Comment : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.COMMENT;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(ICSParam.ALT_REPRESENTATION, null),
new Tuple<string, string[]>(ICSParam.LANGUAGE, null)
});
/// <summary>The alternative representation. </summary>
private string altrep = string.Empty;
/// <summary>Type of the language. </summary>
private string languageType = string.Empty;
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="Comment" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Comment()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>Gets or sets the alternate representation. </summary>
/// <value>The alternate representation. </value>
public string AltRepresentation
{
get
{
return this.altrep;
}
set
{
this.altrep = value;
}
}
/// <summary>Gets or sets the language. </summary>
/// <value>The language. </value>
public string Language
{
get
{
return this.languageType;
}
set
{
this.languageType = 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null)
{
foreach (string param in paramStrList)
{
string[] p = param.Split('=');
if (p.Count() != 2)
{
throw new NotSupportedException("the number of '=' in the parameter (" + param + ") is less or greater then 1");
}
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");
}
}
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (this.altrep.Equals(string.Empty) == false)
{
// TODO: add DQUOTES "
retValue += ";" + ICSParam.ALT_REPRESENTATION + "=" + this.altrep;
}
if (this.languageType.Equals(string.Empty) == false)
{
retValue += ";" + ICSParam.LANGUAGE + "=" + this.languageType;
}
retValue += ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Comment.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.altrep = (icsProperty as Comment).altrep;
this.languageType = (icsProperty as Comment).languageType;
this.value = (icsProperty as Comment).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="Contact.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Contact property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.4.2"/>
public class Contact : Comment // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.CONTACT;
/// <summary>Initializes a new instance of the <see cref="Contact" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Contact()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Contact.Name;
}
}
}

View File

@@ -0,0 +1,117 @@
//-----------------------------------------------------------------------------
// <copyright file="DTCompleted.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>DTCompleted property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.2.1"/>
public class DTCompleted : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.COMPLETED;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>Date/Time of the value. </summary>
private DateTime value = DateTime.MinValue;
/// <summary>Initializes a new instance of the <see cref="DTCompleted" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public DTCompleted()
{
}
/// <summary>Gets or sets the Date/Time of the value. </summary>
/// <value>The value. </value>
public DateTime Value
{
get
{
return this.value;
}
set
{
this.value = 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>
/// <param name="valueStr">The value string.</param>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
if (paramStr == null || paramStr.Equals(string.Empty))
{
this.Set(valueStr);
}
else
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
this.value = ICSClasses.UTCStringToDateTime(valueStr);
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + ICSClasses.DateTimeToString(this.value);
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTCompleted.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as DTCompleted).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,151 @@
//-----------------------------------------------------------------------------
// <copyright file="DTCreated.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>DTCreated property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.7.1"/>
public class DTCreated : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.DT_CREATED;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= 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;
/// <summary>Initializes a new instance of the <see cref="DTCreated" /> class.</summary>
/// <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>
/// <value>The value. </value>
public DateTime Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
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);
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + ICSClasses.DateTimeToString(this.value);
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTCreated.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.paramList = (icsProperty as DTCreated).paramList;
this.value = (icsProperty as DTCreated).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="DTDue.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>DTDue property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.2.3"/>
public class DTDue : DTEnd // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.DUE;
/// <summary>Initializes a new instance of the <see cref="DTDue" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public DTDue()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTDue.Name;
}
}
}

View File

@@ -0,0 +1,240 @@
//-----------------------------------------------------------------------------
// <copyright file="DTEnd.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>DTEnd property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.2.2"/>
public class DTEnd : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.DT_END;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(
ICSParam.VALUE_TYPE,
new string[] { ICSParamValue.DATE_TIME, ICSParamValue.DATE }),
new Tuple<string, string[]>(ICSParam.TIME_ZONE_ID, null)
});
/// <summary>Date/Time of the value. </summary>
private DateTime value = DateTime.MinValue;
/// <summary>List of parameters. </summary>
private List<Tuple<string, string>> paramList = null;
/// <summary>Initializes a new instance of the <see cref="DTEnd" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public DTEnd()
{
this.paramList = new List<Tuple<string, string>>();
}
/// <summary>Gets or sets the Date/Time of the value. </summary>
/// <value>The value. </value>
public DateTime Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>Gets or sets a value indicating whether this object is date. </summary>
/// <value>true if this object is date, false if not. </value>
public bool IsDate
{
get
{
bool isDate = false;
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (pos >= 0 && this.paramList[pos].Item2.Equals(ICSParamValue.DATE))
{
isDate = true;
}
return isDate;
}
set
{
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (pos < 0)
{
this.paramList.Add(new Tuple<string, string>(ICSParam.VALUE_TYPE, (value == true) ? ICSParamValue.DATE : ICSParamValue.DATE_TIME));
}
else
{
this.paramList[pos] = new Tuple<string, string>(ICSParam.VALUE_TYPE, (value == true) ? ICSParamValue.DATE : ICSParamValue.DATE_TIME);
}
}
}
/// <summary>Gets or sets the time zone. </summary>
/// <value>The time zone. </value>
public string TimeZone
{
get
{
int pos = ICSClasses.CheckParam(ICSParam.TIME_ZONE_ID, this.paramList.ToArray());
if (pos >= 0)
{
return this.paramList[pos].Item2;
}
else
{
return string.Empty;
}
}
set
{
int pos = ICSClasses.CheckParam(ICSParam.TIME_ZONE_ID, this.paramList.ToArray());
if (pos < 0)
{
this.paramList.Add(new Tuple<string, string>(ICSParam.TIME_ZONE_ID, value));
}
else
{
this.paramList[pos] = new Tuple<string, string>(ICSParam.TIME_ZONE_ID, 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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
if (paramStrList.Count() > 2)
{
throw new NotSupportedException("too many params in (" + Name + ")");
}
for (int i = 0; i < paramStrList.Count(); i++)
{
string[] p = paramStrList[i].Split('=');
if (p.Count() != 2)
{
throw new FormatException("incorrect param string (" + paramStrList[0] + ")");
}
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
{
int pos = ICSClasses.CheckParam(p[0], this.paramList.ToArray());
if (pos < 0)
{
this.paramList.Add(new Tuple<string, string>(p[0], p[1]));
}
else
{
throw new FormatException("param (" + p[0] + ") sould only occure once");
}
}
else
{
throw new NotSupportedException("param (" + p[0] + ") is not supported in (" + Name + ")");
}
}
}
bool tempIsDate = ICSClasses.IsDate(valueStr);
bool isDate = false;
int posVal = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (posVal >= 0 && this.paramList[posVal].Item2.Equals(ICSParamValue.DATE))
{
isDate = true;
}
if (isDate != tempIsDate)
{
throw new NotSupportedException("time value has not the same type as declared in param in(" + Name + ")");
}
this.value = ICSClasses.UTCStringToDateTime(valueStr);
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
for (int i = 0; i < this.paramList.Count(); i++)
{
retValue += ";" + this.paramList[i].Item1 + "=" + this.paramList[i].Item2;
}
retValue += ":";
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
bool isDate = false;
if (pos >= 0 && this.paramList[pos].Item2.Equals(ICSParamValue.DATE))
{
isDate = true;
}
retValue += ICSClasses.DateTimeToString(this.value, isDate);
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTEnd.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.paramList = (icsProperty as DTEnd).paramList;
this.value = (icsProperty as DTEnd).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="DTException.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>DTException property class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.5.1"/>
public class DTException : DTEnd // because structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.EXDATE;
/// <summary>Initializes a new instance of the <see cref="DTException" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public DTException()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTException.Name;
}
}
}

View File

@@ -0,0 +1,263 @@
//-----------------------------------------------------------------------------
// <copyright file="DTRecurrence.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>DTRecurrence property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.5.2"/>
public class DTRecurrence : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.RDATE;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(
ICSParam.VALUE_TYPE,
new string[] { ICSParamValue.DATE_TIME, ICSParamValue.DATE, ICSParamValue.PERIOD }),
new Tuple<string, string[]>(ICSParam.TIME_ZONE_ID, null)
});
/// <summary>The values. </summary>
private List<Tuple<DateTime, DateTime, TimeSpan, bool>> values = null;
/// <summary>List of parameters. </summary>
private List<Tuple<string, string>> paramList = null;
/// <summary>Initializes a new instance of the <see cref="DTRecurrence" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public DTRecurrence()
{
this.values = new List<Tuple<DateTime, DateTime, TimeSpan, bool>>();
this.paramList = new List<Tuple<string, string>>();
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public List<Tuple<DateTime, DateTime, TimeSpan, bool>> Value
{
get
{
return this.values;
}
set
{
this.values = value;
}
}
/// <summary>Gets or sets the type of the value. </summary>
/// <value>The type of the value. </value>
public string ValueType
{
get
{
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (pos < 0)
{
return string.Empty;
}
else
{
return this.paramList[pos].Item2;
}
}
set
{
if (ICSClasses.CheckParamAndParamValue(ICSParam.VALUE_TYPE, value, PParams.ToArray()))
{
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (pos < 0)
{
this.paramList.Add(new Tuple<string, string>(ICSParam.VALUE_TYPE, value));
}
else
{
this.paramList[pos] = new Tuple<string, string>(ICSParam.VALUE_TYPE, value);
}
}
else
{
throw new NotSupportedException("param value (" + value + ") is not supported");
}
}
}
/// <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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <exception cref="NotImplementedException">Thrown when the requested operation is unimplemented.</exception>
/// <param name="valueStr"> The value string.</param>
/// <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.Count() > 1)
{
throw new NotSupportedException("there is only 1 param supported");
}
else
{
string[] p = paramStrList[0].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[0] + ") in (" + Name + ")");
}
}
}
string[] valSplit = valueStr.Split(',');
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (pos < 0
|| this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME)
|| this.paramList[pos].Item2.Equals(ICSParamValue.DATE))
{
for (int i = 0; i < valSplit.Count(); i++)
{
this.values.Add(new Tuple<DateTime, DateTime, TimeSpan, bool>(ICSClasses.UTCStringToDateTime(valSplit[i]), DateTime.MinValue, TimeSpan.Zero, false));
}
}
else if (this.paramList[pos].Item2.Equals(ICSParamValue.PERIOD))
{
for (int i = 0; i < valSplit.Count(); i++)
{
string[] subVal = valSplit[i].Split('/');
if (subVal.Count() != 2)
{
throw new FormatException("unsupported format in (" + valSplit[i] + ")");
}
bool isNegative = false;
if (subVal[1][0].Equals('-') || subVal[1][0].Equals('+'))
{
isNegative = subVal[1][0].Equals('-');
subVal[1] = subVal[1].Remove(0, 1);
}
this.values.Add(
new Tuple<DateTime, DateTime, TimeSpan, bool>(
ICSClasses.UTCStringToDateTime(subVal[0]),
subVal[1][0].Equals('P') == false ? ICSClasses.UTCStringToDateTime(subVal[1]) : DateTime.MinValue,
subVal[1][0].Equals('P') == true ? ICSClasses.StringToTimeSpan(subVal[1]) : TimeSpan.Zero,
isNegative));
}
}
else
{
throw new NotImplementedException("unhandled value type");
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
for (int i = 0; i < this.paramList.Count(); i++)
{
retValue += ";" + this.paramList[i].Item1 + "=" + this.paramList[i].Item2;
}
retValue += ":";
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
for (int i = 0; i < this.values.Count(); i++)
{
if (i > 0)
{
retValue += ',';
}
if (pos < 0 || this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME))
{
retValue += ICSClasses.DateTimeToString(this.values[i].Item1);
}
else if (this.paramList[pos].Item2.Equals(ICSParamValue.DATE))
{
retValue += ICSClasses.DateTimeToString(this.values[i].Item1, true);
}
else if (this.paramList[pos].Item2.Equals(ICSParamValue.PERIOD))
{
retValue += ICSClasses.DateTimeToString(this.values[i].Item1) + "/";
if (this.values[i].Item3.Equals(TimeSpan.Zero))
{
retValue += ICSClasses.DateTimeToString(this.values[i].Item2);
}
else
{
retValue += ICSClasses.TimeSpanToString(this.values[i].Item3, this.values[i].Item4);
}
}
else
{
throw new NotSupportedException("value type is not supported");
}
}
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTRecurrence.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.paramList = (icsProperty as DTRecurrence).paramList;
this.values = (icsProperty as DTRecurrence).values;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="DTStamp.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>DTStamp property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.7.2"/>
public class DTStamp : DTCreated // because has same structure
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.DT_STAMP;
/// <summary>Initializes a new instance of the <see cref="DTStamp" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public DTStamp()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTStamp.Name;
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="DTStart.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>DTStart property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.2.4"/>
public class DTStart : DTEnd // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.DT_START;
/// <summary>Initializes a new instance of the <see cref="DTStart" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public DTStart()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return DTStart.Name;
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="Description.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Description property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.5"/>
public class Description : Comment // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.DESCRIPTION;
/// <summary>Initializes a new instance of the <see cref="Description" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Description()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Description.Name;
}
}
}

View File

@@ -0,0 +1,134 @@
//-----------------------------------------------------------------------------
// <copyright file="Duration.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Duration property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.2.5"/>
public class Duration : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.DURATION;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private TimeSpan value = TimeSpan.Zero;
/// <summary>true if this object is negative. </summary>
private bool isNegative = false;
/// <summary>Initializes a new instance of the <see cref="Duration" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Duration()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public TimeSpan Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>Gets or sets a value indicating whether this object is negative. </summary>
/// <value>true if this object is negative, false if not. </value>
public bool IsNegative
{
get
{
return this.isNegative;
}
set
{
this.isNegative = value;
}
}
/// <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>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
this.Set(valueStr);
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("params are not supported in (" + Name + ")");
}
if (valueStr[0].Equals('-') || valueStr[0].Equals('+'))
{
this.isNegative = valueStr[0].Equals('-');
valueStr = valueStr.Remove(0, 1);
}
this.value = ICSClasses.StringToTimeSpan(valueStr);
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + ICSClasses.TimeSpanToString(this.value, this.isNegative);
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Duration.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.isNegative = (icsProperty as Duration).isNegative;
this.value = (icsProperty as Duration).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,56 @@
//-----------------------------------------------------------------------------
// <copyright file="End.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>End property class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545"/>
public class End : Begin // same
{
/// <summary>The name. </summary>
public static new readonly string Name = ICSTag.END;
/// <summary>Options for controlling the operation. </summary>
public static new readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The values. </summary>
public static new readonly List<string> PValues
= new List<string>(new string[]
{
ICSTag.VCALENDAR,
ICSTag.VEVENT,
ICSTag.VTODO,
ICSTag.VJOURNAL,
ICSTag.VFREEBUSY,
ICSTag.VTIMEZONE,
ICSTag.STANDARD,
ICSTag.DAYLIGHT,
ICSTag.VALARM
});
/// <summary>Initializes a new instance of the <see cref="End" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public End()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return End.Name;
}
}
}

View File

@@ -0,0 +1,238 @@
//-----------------------------------------------------------------------------
// <copyright file="FreeBusyTime.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Free busy time property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.2.6"/>
public class FreeBusyTime : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.FREEBUSY;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(
ICSParam.FREE_BUSY_TIME_TYPE,
new string[] { ICSParamValue.FREE, ICSParamValue.BUSY, ICSParamValue.BUSY_UNAVAILABLE, ICSParamValue.BUSY_TENTATIVE })
});
/// <summary>Type of the free busy. </summary>
private string freebusyType = string.Empty;
/// <summary>List of values. </summary>
private List<Tuple<DateTime, TimeSpan, DateTime, bool>> valueList = null;
/// <summary>Initializes a new instance of the <see cref="FreeBusyTime" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public FreeBusyTime()
{
this.valueList = new List<Tuple<DateTime, TimeSpan, DateTime, bool>>();
}
/// <summary>Gets or sets a list of values. </summary>
/// <value>A List of values. </value>
public List<Tuple<DateTime, TimeSpan, DateTime, bool>> ValueList
{
get
{
return this.valueList;
}
set
{
this.valueList = value;
}
}
/// <summary>Gets or sets the type of the free busy. </summary>
/// <value>The type of the free busy. </value>
public string FreeBusyType
{
get
{
return this.freebusyType;
}
set
{
if (!ICSClasses.CheckParamAndParamValue(ICSParam.FREE_BUSY_TIME_TYPE, value, PParams.ToArray()))
{
throw new NotSupportedException("param value (" + value + ") is not supported");
}
else
{
this.freebusyType = 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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <param name="valueStr"> The value string.</param>
/// <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.Count() > 1)
{
throw new NotSupportedException("there is only 1 param in (" + Name + ") supported");
}
string[] p = paramStrList[0].Split('=');
if (p.Count() != 2)
{
throw new FormatException("parameter string (" + paramStrList[0] + ") is wrong");
}
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
{
if (this.freebusyType.Equals(string.Empty))
{
this.freebusyType = p[1];
}
else
{
throw new FormatException("param (" + p[0] + ") sould only occure once");
}
}
else
{
throw new NotSupportedException("unsupported param (" + p[0] + ")");
}
}
string[] valSplit = valueStr.Split(',');
for (int i = 0; i < valueStr.Count(); i++)
{
string[] subSplit = valSplit[i].Split('/');
if (subSplit.Count() != 2)
{
throw new FormatException("value has a unsupported format (" + valSplit[i] + ")");
}
DateTime partDTStart = ICSClasses.UTCStringToDateTime(subSplit[0]);
TimeSpan partTSDur = TimeSpan.Zero;
DateTime partDTEnd = DateTime.MinValue;
bool partTSDurNegative = false;
if (subSplit[1][subSplit[1].Length - 1].Equals('Z')
|| (subSplit[1][subSplit[1].Length - 1] >= '0' && subSplit[1][subSplit[1].Length - 1] <= '9'))
{
partDTEnd = ICSClasses.UTCStringToDateTime(subSplit[1]);
}
else
{
if (subSplit[1][0].Equals('-') || subSplit[1][0].Equals('+'))
{
partTSDurNegative = subSplit[1][0].Equals('-');
subSplit[1] = subSplit[1].Remove(0, 1);
}
partTSDur = ICSClasses.StringToTimeSpan(subSplit[1]);
}
this.valueList.Add(new Tuple<DateTime, TimeSpan, DateTime, bool>(partDTStart, partTSDur, partDTEnd, partTSDurNegative));
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (!this.freebusyType.Equals(string.Empty))
{
retValue += ICSParam.FREE_BUSY_TIME_TYPE + "=" + this.freebusyType;
}
retValue += ":";
for (int i = 0; i < this.valueList.Count(); i++)
{
if (i > 0)
{
retValue += ",";
}
retValue += ICSClasses.DateTimeToString(this.valueList[i].Item1) + "/";
if (this.valueList[i].Item2.Equals(TimeSpan.Zero))
{
retValue += ICSClasses.DateTimeToString(this.valueList[i].Item3);
}
else
{
retValue += ICSClasses.TimeSpanToString(this.valueList[i].Item2, this.valueList[i].Item4);
}
}
return retValue;
}
/// <summary>Adds a value. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="datetimeStart"> Date/Time of the start.</param>
/// <param name="timespanDur"> The duration.</param>
/// <param name="isNegative">(Optional) the is negative.</param>
public void AddValue(DateTime datetimeStart, TimeSpan timespanDur, bool isNegative = false)
{
this.valueList.Add(new Tuple<DateTime, TimeSpan, DateTime, bool>(datetimeStart, timespanDur, DateTime.MinValue, isNegative));
}
/// <summary>Adds a value. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <param name="datetimeStart">Date/Time of the start.</param>
/// <param name="datetimeEnd"> Date/Time of the end.</param>
public void AddValue(DateTime datetimeStart, DateTime datetimeEnd)
{
this.ValueList.Add(new Tuple<DateTime, TimeSpan, DateTime, bool>(datetimeStart, TimeSpan.Zero, datetimeEnd, false));
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return FreeBusyTime.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.freebusyType = (icsProperty as FreeBusyTime).freebusyType;
this.valueList = (icsProperty as FreeBusyTime).valueList;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,134 @@
//-----------------------------------------------------------------------------
// <copyright file="Geo.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Geo property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.6"/>
public class Geo : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.GEO;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private Tuple<float, float> value = null;
/// <summary>Initializes a new instance of the <see cref="Geo" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Geo()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public Tuple<float, float> Value
{
get
{
return this.value;
}
set
{
this.value = 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>
/// <param name="valueStr">The value string.</param>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
if (paramStr == null || paramStr.Equals(string.Empty))
{
this.Set(valueStr);
}
else
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
}
/// <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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
string[] valSplit = valueStr.Split(';');
if (valSplit.Count() != 2)
{
throw new FormatException("there are not 2 float values, seperated by ';', in the value string");
}
this.value = new Tuple<float, float>(float.Parse(valSplit[0]), float.Parse(valSplit[1]));
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (this.value == null)
{
throw new NotSupportedException("there is no value set for (" + Name + ")");
}
retValue += ":" + this.value.Item1.ToString() + ";" + this.value.Item2.ToString();
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Geo.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Geo).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,17 @@
//-----------------------------------------------------------------------------
// <copyright file="IANAProperty.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
/// <summary>IANA property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public class IANAProperty
{
// 3.8.8.1.
// TODO
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="LastModified.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Last modified property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.7.3"/>
public class LastModified : DTCreated // because has same structure
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.DT_MODIFIED;
/// <summary>Initializes a new instance of the <see cref="LastModified" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public LastModified()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return LastModified.Name;
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="Location.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Location property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.7"/>
public class Location : Comment // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.LOCATION;
/// <summary>Initializes a new instance of the <see cref="Location" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Location()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Location.Name;
}
}
}

View File

@@ -0,0 +1,101 @@
//-----------------------------------------------------------------------------
// <copyright file="Method.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Method property class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.7.2"/>
public class Method : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.METHOD;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="Method" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Method()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Method.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Method).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,17 @@
//-----------------------------------------------------------------------------
// <copyright file="NonStandardProperty.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
/// <summary>Non standard property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public class NonStandardProperty
{
// 3.8.8.2.
// TODO
}
}

View File

@@ -0,0 +1,47 @@
//-----------------------------------------------------------------------------
// <copyright file="Organizer.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Organizer property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.4.3"/>
public class Organizer : Attendee // nearly the same structure
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.ORGANIZER;
/// <summary>Options for controlling the operation. </summary>
public static new readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(ICSParam.COMMON_NAME, null),
new Tuple<string, string[]>(ICSParam.DIR_REFERENCE, null),
new Tuple<string, string[]>(ICSParam.SENT_BY, null),
new Tuple<string, string[]>(ICSParam.LANGUAGE, null)
});
/// <summary>Initializes a new instance of the <see cref="Organizer" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Organizer()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Organizer.Name;
}
}
}

View File

@@ -0,0 +1,132 @@
//-----------------------------------------------------------------------------
// <copyright file="PercentComplete.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Percent complete. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.8"/>
public class PercentComplete : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.PERCENT;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private int value = -1;
/// <summary>Initializes a new instance of the <see cref="PercentComplete" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public PercentComplete()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public int Value
{
get
{
return this.value;
}
set
{
if ((value >= 0) && (value <= 100))
{
this.value = value;
}
else
{
throw new ArgumentOutOfRangeException("value must be in rang of [0..100] in (" + Name + ")");
}
}
}
/// <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>
/// <param name="valueStr">The value string.</param>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
if (paramStr == null || paramStr.Equals(string.Empty))
{
this.Set(valueStr);
}
else
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
this.value = int.Parse(valueStr);
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (this.value < 0)
{
throw new NotSupportedException("there is no value set for (" + Name + ")");
}
retValue += ":" + this.value.ToString();
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return PercentComplete.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as PercentComplete).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,140 @@
//-----------------------------------------------------------------------------
// <copyright file="Priority.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Priority property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.9"/>
public class Priority : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.PRIORITY;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private int value = -1;
/// <summary>Initializes a new instance of the <see cref="Priority" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Priority()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public int Value
{
get
{
return this.value;
}
set
{
if (value >= 0 && value <= 9)
{
this.value = value;
}
else
{
throw new ArgumentOutOfRangeException("value must be in rage of [0..9] in (" + Name + ")");
}
}
}
/// <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>
/// <param name="valueStr">The value string.</param>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
if (paramStr == null || paramStr.Equals(string.Empty))
{
this.Set(valueStr);
}
else
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
}
/// <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>
/// <exception cref="ArgumentOutOfRangeException">Thrown when one or more arguments are outside the
/// required range.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
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 + ")");
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (this.value < 0 || this.value > 9)
{
throw new NotSupportedException("there is no value set for (" + Name + ")");
}
retValue += ":" + this.value.ToString();
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Priority.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Priority).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,101 @@
//-----------------------------------------------------------------------------
// <copyright file="ProductID.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Product identifier. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.7.3"/>
public class ProductID : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.PRODUCT_ID;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string>> PParams
= new List<Tuple<string, string>>();
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="ProductID" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public ProductID()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return ProductID.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as ProductID).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="RecurrenceID.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Recurrence identifier property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.4.4"/>
public class RecurrenceID : DTEnd // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.RECURRENCE_ID;
/// <summary>Initializes a new instance of the <see cref="RecurrenceID" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public RecurrenceID()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return RecurrenceID.Name;
}
}
}

View File

@@ -0,0 +1,170 @@
//-----------------------------------------------------------------------------
// <copyright file="RecurrenceRule.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Recurrence rule property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.5.3"/>
public class RecurrenceRule : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.RRULE;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The values. </summary>
public static readonly List<Tuple<string, string[]>> PValues
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(
ICSValue.FREQ,
new string[] { ICSValueValue.SECONDLY, ICSValueValue.MINUTELY, ICSValueValue.HOURLY, ICSValueValue.DAILY, ICSValueValue.WEEKLY, ICSValueValue.MONTHLY, ICSValueValue.YEARLY }),
new Tuple<string, string[]>(
ICSValue.UNTIL,
new string[] { ICSValueValue.DATE, ICSValueValue.DATE_TIME }),
new Tuple<string, string[]>(ICSValue.COUNT, null),
new Tuple<string, string[]>(ICSValue.INTERVAL, null),
new Tuple<string, string[]>(ICSValue.BY_SECOND, null),
new Tuple<string, string[]>(ICSValue.BY_MINUTE, null),
new Tuple<string, string[]>(ICSValue.BY_HOUR, null),
new Tuple<string, string[]>(ICSValue.BY_DAY, null),
new Tuple<string, string[]>(ICSValue.BY_MONTH_DAY, null),
new Tuple<string, string[]>(ICSValue.BY_YEAR_DAY, null),
new Tuple<string, string[]>(ICSValue.BY_WEEK_NO, null),
new Tuple<string, string[]>(ICSValue.BY_MONTH, null),
new Tuple<string, string[]>(ICSValue.BY_SET_POS, null),
new Tuple<string, string[]>(
ICSValue.WKST,
new string[] { ICSValueValue.DAY_SU, ICSValueValue.DAY_MO, ICSValueValue.DAY_TU, ICSValueValue.DAY_WE, ICSValueValue.DAY_TH, ICSValueValue.DAY_FR, ICSValueValue.DAY_SA })
});
/// <summary>The values. </summary>
private List<Tuple<string, List<string>>> values = null;
/// <summary>Initializes a new instance of the <see cref="RecurrenceRule" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public RecurrenceRule()
{
this.values = new List<Tuple<string, List<string>>>();
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public List<Tuple<string, List<string>>> Value
{
get
{
return this.values;
}
set
{
this.values = 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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
string[] valSplit = valueStr.Split(';');
for (int i = 0; i < valSplit.Count(); i++)
{
string[] subVal = valSplit[i].Split('=');
if (subVal.Count() != 2)
{
throw new FormatException("unsupported format (" + valSplit[i] + ")");
}
string[] subValVal = subVal[1].Split(',');
if (ICSClasses.CheckParamAndParamValue(subVal[0], subValVal, PValues.ToArray()))
{
this.values.Add(new Tuple<string, List<string>>(subVal[0], new List<string>(subValVal)));
}
else
{
throw new NotSupportedException("unsupported value (" + valSplit[i] + ")");
}
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":";
for (int i = 0; i < this.values.Count(); i++)
{
if (i > 0)
{
retValue += ';';
}
retValue += this.values[i].Item1 + "=";
for (int k = 0; k < this.values[i].Item2.Count(); k++)
{
if (k > 0)
{
retValue += ",";
}
retValue += this.values[i].Item2[k];
}
}
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return RecurrenceRule.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.values = (icsProperty as RecurrenceRule).values;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,161 @@
//-----------------------------------------------------------------------------
// <copyright file="RelatedTo.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Related to property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.4.5"/>
public class RelatedTo : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.RELATED;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(
ICSParam.RELATIONSHIP_TYPE,
new string[] { ICSParamValue.PARENT, ICSParamValue.CHILD, ICSParamValue.SIBLING })
});
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Type of the real. </summary>
private string realType = string.Empty;
/// <summary>Initializes a new instance of the <see cref="RelatedTo" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public RelatedTo()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>Gets or sets the type of the real. </summary>
/// <value>The type of the real. </value>
public string RealType
{
get
{
return this.realType;
}
set
{
if (ICSClasses.CheckParamAndParamValue(ICSParam.RELATIONSHIP_TYPE, value, PParams.ToArray()))
{
this.realType = value;
}
else
{
throw new NotSupportedException("param value (" + value + ") is not supported");
}
}
}
/// <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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <param name="valueStr"> The value string.</param>
/// <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.Count() > 1)
{
throw new NotSupportedException("there is only 1 param supported");
}
else
{
string[] p = paramStrList[0].Split('=');
if (p.Count() != 2)
{
throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")");
}
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
{
this.realType = p[1];
}
else
{
throw new NotSupportedException("unsupported param (" + paramStrList[0] + ") in (" + Name + ")");
}
}
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (!this.realType.Equals(string.Empty))
{
retValue += ";" + ICSParam.RELATIONSHIP_TYPE + "=" + this.realType;
}
retValue += ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return RelatedTo.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.realType = (icsProperty as RelatedTo).realType;
this.value = (icsProperty as RelatedTo).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,106 @@
//-----------------------------------------------------------------------------
// <copyright file="RepeatCount.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Repeat count property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.6.2"/>
public class RepeatCount : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.REPEAT;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private int value;
/// <summary>Initializes a new instance of the <see cref="RepeatCount" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public RepeatCount()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public int Value
{
get
{
return this.value;
}
set
{
if (value < 0)
{
value = 0;
}
this.value = 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
this.value = int.Parse(valueStr);
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value.ToString();
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return RepeatCount.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as RepeatCount).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,187 @@
//-----------------------------------------------------------------------------
// <copyright file="RequestStatus.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Request status property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.8.3"/>
public class RequestStatus : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.RSTATUS;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(ICSParam.LANGUAGE, null)
});
/// <summary>List of parameters. </summary>
private List<Tuple<string, string>> paramList = null;
/// <summary>The value code. </summary>
private float valueCode = 0.0f;
/// <summary>List of values. </summary>
private List<string> valueList = null;
/// <summary>Initializes a new instance of the <see cref="RequestStatus" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public RequestStatus()
{
this.paramList = new List<Tuple<string, string>>();
this.valueList = new List<string>();
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public List<string> Value
{
get
{
return this.valueList;
}
set
{
if (value.Count() >= 1)
{
this.valueList = value;
}
else
{
throw new NotSupportedException("not enougth params");
}
}
}
/// <summary>Gets or sets the code. </summary>
/// <value>The code. </value>
public float Code
{
get
{
return this.valueCode;
}
set
{
if (value < 5.0)
{
this.valueCode = value;
}
else
{
throw new NotSupportedException("code value has to be lower then 5.0");
}
}
}
/// <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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <param name="valueStr"> The value string.</param>
/// <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.Count() > 1)
{
throw new NotSupportedException("there is only 1 param supported");
}
string[] p = paramStrList[0].Split('=');
if (ICSClasses.CheckParamAndParamValue(p[0], p[1], PParams.ToArray()))
{
this.paramList.Add(new Tuple<string, string>(p[0], p[1]));
}
else
{
throw new NotSupportedException("param (" + paramStrList[0] + ") is not supported");
}
}
string[] v = valueStr.Split(';');
if (v.Count() < 2)
{
throw new FormatException("not enought values");
}
for (int i = 0; i < v.Count(); i++)
{
if (i == 0)
{
this.valueCode = float.Parse(v[i]);
}
else
{
this.valueList.Add(v[i]);
}
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
for (int i = 0; i < this.paramList.Count(); i++)
{
retValue += ";" + this.paramList[i].Item1 + "=" + this.paramList[i].Item2;
}
retValue += ":" + string.Format("{0:0.0}", this.valueCode);
for (int i = 0; i < this.valueList.Count(); i++)
{
retValue += ";" + this.valueList[i];
}
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return RequestStatus.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.paramList = (icsProperty as RequestStatus).paramList;
this.valueCode = (icsProperty as RequestStatus).valueCode;
this.valueList = (icsProperty as RequestStatus).valueList;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="Resources.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Resources property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.10"/>
public class Resources : Comment // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.RESOURCES;
/// <summary>Initializes a new instance of the <see cref="Resources" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Resources()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Resources.Name;
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="SequenceNumber.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Sequence number property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.7.4"/>
public class SequenceNumber : RepeatCount
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.SEQUENCE;
/// <summary>Initializes a new instance of the <see cref="SequenceNumber" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public SequenceNumber()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return SequenceNumber.Name;
}
}
}

View File

@@ -0,0 +1,166 @@
//-----------------------------------------------------------------------------
// <copyright file="Status.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Status property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.11"/>
public class Status : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.STATUS;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value list event. </summary>
public readonly List<string> ValueListEvent = null;
/// <summary>The value list to do. </summary>
public readonly List<string> ValueListToDo = null;
/// <summary>The value list journal. </summary>
public readonly List<string> ValueListJournal = null;
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="Status" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Status()
{
this.ValueListEvent = new List<string>();
this.ValueListEvent.AddRange(new string[]
{
ICSValue.TENTATIVE,
ICSValue.CONFIRMED,
ICSValue.CANCELLED
});
this.ValueListToDo = new List<string>();
this.ValueListToDo.AddRange(new string[]
{
ICSValue.NEEDS_ACTION,
ICSValue.COMPLETED,
ICSValue.IN_PROCESS,
ICSValue.CANCELLED
});
this.ValueListJournal = new List<string>();
this.ValueListJournal.AddRange(new string[]
{
ICSValue.DRAFT,
ICSValue.FINAL,
ICSValue.CANCELLED
});
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
if ((this.ValueListEvent.IndexOf(value) >= 0)
|| (this.ValueListToDo.IndexOf(value) >= 0)
|| (this.ValueListJournal.IndexOf(value) >= 0))
{
this.value = value;
}
else
{
throw new NotSupportedException("value (" + value + ") is not supported in (" + Name + ")");
}
}
}
/// <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>
/// <param name="valueStr">The value string.</param>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
if (paramStr == null || paramStr.Equals(string.Empty))
{
this.Set(valueStr);
}
else
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("parameter are not supported in (" + Name + ")");
}
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 + ")");
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Status.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as Status).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="Summary.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Summary property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.1.12"/>
public class Summary : Comment // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.SUMMARY;
/// <summary>Initializes a new instance of the <see cref="Summary" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Summary()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Summary.Name;
}
}
}

View File

@@ -0,0 +1,130 @@
//-----------------------------------------------------------------------------
// <copyright file="Timetransparency.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Time transparency property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.2.7"/>
public class TimeTransparency : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.TRANSP;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>List of values. </summary>
public readonly List<string> ValueList = null;
/// <summary>The value. </summary>
private string value = ICSValue.OPAQUE;
/// <summary>Initializes a new instance of the <see cref="TimeTransparency" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public TimeTransparency()
{
this.ValueList = new List<string>();
this.ValueList.AddRange(new string[]
{
ICSValue.OPAQUE,
ICSValue.TRANSPARENT
});
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
if (this.ValueList.IndexOf(value) < 0)
{
throw new NotSupportedException("value (" + value + ") is not supported");
}
else
{
this.value = value;
}
}
}
/// <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>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
this.Set(valueStr);
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("params are not supported in (" + Name + ")");
}
if (this.ValueList.IndexOf(valueStr) < 0)
{
throw new NotSupportedException("value (" + valueStr + ") is not supported");
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return TimeTransparency.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as TimeTransparency).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,109 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeZoneIdentifier.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Time zone identifier property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.3.1"/>
public class TimeZoneIdentifier : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.TIME_ZONE_ID;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="TimeZoneIdentifier" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public TimeZoneIdentifier()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <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>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
this.Set(valueStr);
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("params are not supported in (" + Name + ")");
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return TimeZoneIdentifier.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as TimeZoneIdentifier).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,153 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeZoneName.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Time zone name property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.3.2"/>
public class TimeZoneName : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.TIME_ZONE_NAME;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(ICSParam.LANGUAGE, null)
});
/// <summary>The language. </summary>
private string language = string.Empty;
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="TimeZoneName" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public TimeZoneName()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>Gets or sets the language. </summary>
/// <value>The language. </value>
public string Language
{
get
{
return this.language;
}
set
{
this.language = 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>
/// <exception cref="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
if (paramStrList.Count() > 1)
{
throw new NotSupportedException("there is only 1 param supported in (" + Name + ")");
}
if (paramStrList.Count() == 1)
{
string[] p = paramStrList[0].Split('=');
if (p.Count() != 2)
{
throw new FormatException("unsupported format in param (" + paramStrList[0] + ")");
}
if (p[0].Equals(ICSParam.LANGUAGE))
{
this.language = p[1];
}
else
{
throw new NotSupportedException("unsupported param (" + p[0] + ")");
}
}
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
if (!this.language.Equals(string.Empty))
{
retValue += ";" + ICSParam.LANGUAGE + "=" + this.language;
}
retValue += ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return TimeZoneName.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.language = (icsProperty as TimeZoneName).language;
this.value = (icsProperty as TimeZoneName).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,142 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeZoneOffsetFrom.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Time zone offset from property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.3.3"/>
public class TimeZoneOffsetFrom : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.TIME_ZONE_OFFSET_FROM;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>true if this object is negative. </summary>
private bool isNegative = false;
/// <summary>The value. </summary>
private TimeSpan value = TimeSpan.Zero;
/// <summary>Initializes a new instance of the <see cref="TimeZoneOffsetFrom" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public TimeZoneOffsetFrom()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public TimeSpan Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>Gets or sets a value indicating whether this object is negative. </summary>
/// <value>true if this object is negative, false if not. </value>
public bool IsNegative
{
get
{
return this.isNegative;
}
set
{
this.isNegative = value;
}
}
/// <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>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
this.Set(valueStr);
}
/// <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>
/// <exception cref="NotImplementedException">Thrown when the requested operation is unimplemented.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("no param supported in (" + Name + ")");
}
if (valueStr[0].Equals('+'))
{
this.isNegative = false;
}
else if (valueStr[0].Equals('-'))
{
this.isNegative = true;
}
else
{
throw new NotImplementedException("unhandled starting char (" + valueStr + ")");
}
this.value = new TimeSpan(int.Parse(valueStr.Substring(1, 2)), int.Parse(valueStr.Substring(3, 2)), (valueStr.Length > 5) ? int.Parse(valueStr.Substring(5, 2)) : 0);
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + (this.isNegative ? "-" : "+") + string.Format("{0:HHmm}", this.value);
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return TimeZoneOffsetFrom.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.isNegative = (icsProperty as TimeZoneOffsetFrom).isNegative;
this.value = (icsProperty as TimeZoneOffsetFrom).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeZoneOffsetTo.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Time zone offset to property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.3.4"/>
public class TimeZoneOffsetTo : TimeZoneOffsetFrom // because the structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.TIME_ZONE_OFFSET_TO;
/// <summary>Initializes a new instance of the <see cref="TimeZoneOffsetTo" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public TimeZoneOffsetTo()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return TimeZoneOffsetTo.Name;
}
}
}

View File

@@ -0,0 +1,109 @@
//-----------------------------------------------------------------------------
// <copyright file="TimeZoneUrl.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using CampusAppWP8.Utility;
/// <summary>Time zone url property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.3.5"/>
public class TimeZoneUrl : ICSClasses.Interface // INTERFACE: string value only
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.TIME_ZONE_URL;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>The value. </summary>
private string value = string.Empty;
/// <summary>Initializes a new instance of the <see cref="TimeZoneUrl" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public TimeZoneUrl()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <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>
/// <param name="paramStr">The parameter string.</param>
public override void Set(string valueStr, string paramStr)
{
this.Set(valueStr);
}
/// <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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null)
{
throw new NotSupportedException("no param supported in (" + Name + ")");
}
this.value = valueStr;
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return TimeZoneUrl.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.value = (icsProperty as TimeZoneUrl).value;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,220 @@
//-----------------------------------------------------------------------------
// <copyright file="Trigger.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Trigger property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.6.3"/>
public class Trigger : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.TRIGGER;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>(new Tuple<string, string[]>[]
{
new Tuple<string, string[]>(
ICSParam.VALUE_TYPE,
new string[] { ICSParamValue.DURATION, ICSParamValue.DATE_TIME }),
new Tuple<string, string[]>(
ICSParam.ALARM_TRIGGER_RELATIONSHIP,
new string[] { ICSParamValue.START, ICSParamValue.END })
});
/// <summary>List of parameters. </summary>
private List<Tuple<string, string>> paramList = null;
/// <summary>Date/Time of the value. </summary>
private DateTime valueDT = DateTime.MinValue;
/// <summary>The value. </summary>
private TimeSpan valueTS = TimeSpan.Zero;
/// <summary>true to value negative. </summary>
private bool valueTSNegative = false;
/// <summary>Initializes a new instance of the <see cref="Trigger" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Trigger()
{
this.paramList = new List<Tuple<string, string>>();
}
/// <summary>Gets or sets the Date/Time of the value. </summary>
/// <value>The value. </value>
public DateTime ValueDT
{
get
{
return this.valueDT;
}
set
{
this.valueDT = value;
}
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public TimeSpan ValueTS
{
get
{
return this.valueTS;
}
set
{
this.valueTS = value;
}
}
/// <summary>Gets or sets options for controlling the operation. </summary>
/// <value>The parameters. </value>
public List<Tuple<string, string>> Params
{
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("unsupported param (" + value[i].Item1 + ") with value (" + value[i].Item2 + ")");
}
}
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="FormatException"> Thrown when the format of the ? is incorrect.</exception>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">(Optional) List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList = null)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
for (int i = 0; i < paramStrList.Count(); i++)
{
string[] p = paramStrList[i].Split('=');
if (p.Count() != 2)
{
throw new FormatException("unsupported param format (" + paramStrList[i] + ")");
}
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] + ")");
}
}
}
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (pos < 0 || this.paramList[pos].Item2.Equals(ICSParamValue.DURATION))
{
if (valueStr[0].Equals('-') || valueStr[0].Equals('+'))
{
this.valueTSNegative = valueStr[0].Equals('-');
valueStr = valueStr.Remove(0, 1);
}
this.valueTS = ICSClasses.StringToTimeSpan(valueStr);
}
else if (this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME))
{
this.valueDT = ICSClasses.UTCStringToDateTime(valueStr);
}
else
{
throw new NotSupportedException("unsupported value format");
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name;
for (int i = 0; i < this.paramList.Count(); i++)
{
retValue += ";" + this.paramList[i].Item1 + "=" + this.paramList[i].Item2;
}
retValue += ":";
int pos = ICSClasses.CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray());
if (pos < 0 || this.paramList[pos].Item2.Equals(ICSParamValue.DURATION))
{
retValue += ICSClasses.TimeSpanToString(this.valueTS, this.valueTSNegative);
}
else if (this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME))
{
retValue += ICSClasses.DateTimeToString(this.valueDT);
}
else
{
throw new NotSupportedException("unsupported value format");
}
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Trigger.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.paramList = (icsProperty as Trigger).paramList;
this.valueDT = (icsProperty as Trigger).valueDT;
this.valueTS = (icsProperty as Trigger).valueTS;
this.valueTSNegative = (icsProperty as Trigger).valueTSNegative;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="UniqueID.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Unique identifier property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.4.7"/>
public class UniqueID : TimeZoneUrl // because structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.UNIQUE_ID;
/// <summary>Initializes a new instance of the <see cref="UniqueID" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public UniqueID()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return UniqueID.Name;
}
}
}

View File

@@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// <copyright file="Url.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using CampusAppWP8.Utility;
/// <summary>Url property class. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.8.4.6"/>
public class Url : TimeZoneUrl // because structure is the same
{
/// <summary>The name.</summary>
public static new readonly string Name = ICSTag.URL;
/// <summary>Initializes a new instance of the <see cref="Url" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Url()
: base()
{
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Url.Name;
}
}
}

View File

@@ -0,0 +1,171 @@
//-----------------------------------------------------------------------------
// <copyright file="Version.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.09.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility.ICSProperties
{
using System;
using System.Collections.Generic;
using System.Linq;
using CampusAppWP8.Utility;
/// <summary>Version property class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <see cref="http://tools.ietf.org/html/rfc5545#section-3.7.4"/>
public class Version : ICSClasses.Interface
{
/// <summary>The name.</summary>
public static readonly string Name = ICSTag.VERSION;
/// <summary>Options for controlling the operation. </summary>
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
/// <summary>also used for single val. </summary>
private float maxVer = -1.0f;
/// <summary>The minimum version. </summary>
private float minVer = -1.0f;
/// <summary>Initializes a new instance of the <see cref="Version" /> class.</summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
public Version()
{
}
/// <summary>Gets or sets the value. </summary>
/// <value>The value. </value>
public float Value
{
get
{
return this.maxVer;
}
set
{
if (value >= 0.0f)
{
this.maxVer = value;
this.minVer = -1.0f;
}
else
{
throw new NotSupportedException("value (" + value + ") is not supported");
}
}
}
/// <summary>Gets or sets the minimum version. </summary>
/// <value>The minimum version. </value>
public float MinVersion
{
get
{
return this.minVer;
}
set
{
if (value >= 0.0f)
{
this.minVer = value;
}
else
{
throw new NotSupportedException("value (" + value + ") is not supported");
}
}
}
/// <summary>Gets or sets the maximum version. </summary>
/// <value>The maximum version. </value>
public float MaxVersion
{
get
{
return this.Value;
}
set
{
this.Value = 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>
/// <param name="valueStr"> The value string.</param>
/// <param name="paramStrList">List of parameter strings.</param>
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
string[] v = valueStr.Split(';');
if (v.Count() > 2 || v.Count() == 0)
{
throw new NotSupportedException("unsupported value (" + valueStr + ")");
}
else if (v.Count() == 2)
{
this.minVer = float.Parse(v[0]);
this.maxVer = float.Parse(v[1]);
}
else
{
this.maxVer = float.Parse(v[0]);
}
}
/// <summary>Gets the string. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The string. </returns>
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":";
if (this.minVer >= 0.0f)
{
retValue += this.minVer.ToString() + ";";
}
retValue += this.maxVer.ToString();
return retValue;
}
/// <summary>Gets the name. </summary>
/// <remarks>Fiedler, 05.09.2013. </remarks>
/// <returns>The name. </returns>
public override string GetName()
{
return Version.Name;
}
/// <summary>Get the values from a property of the same type.</summary>
/// <remarks>Fiedler, 25.09.2013.</remarks>
/// <param name="icsProperty">property object.</param>
public override void SetValues(object icsProperty)
{
if (icsProperty.GetType().Equals(this.GetType()) == true)
{
this.maxVer = (icsProperty as Version).maxVer;
this.minVer = (icsProperty as Version).minVer;
}
else
{
throw new FormatException("param has a wrong type (" + icsProperty.GetType().ToString() + ")");
}
}
}
}

View File

@@ -0,0 +1,118 @@
//-----------------------------------------------------------------------------
// <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];
}
}
else
{
if ((this.props[i] as ICalObject).Header.Value.Equals(propName))
{
retValue = this.props[i];
}
}
}
return retValue;
}
public void AddProperty(object icsProperty)
{
object tempProp = this.GetProperty((icsProperty as ICSClasses.Interface).GetName());
if (tempProp == null)
{
this.props.Add(icsProperty);
}
else
{
(tempProp as ICSClasses.Interface).SetValues(icsProperty);
}
}
}
}

View File

@@ -0,0 +1,74 @@
<UserControl x:Class="CampusAppWP8.Utility.Lui.Header.WeekViewPivotHeader"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
>
<Grid x:Name="LayoutRoot" Background="DarkBlue" Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<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="&lt;" HorizontalAlignment="Center" FontSize="24"/>
<TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding WeekChar, Mode=OneWay}" 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>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Column="0" Grid.Row="0" BorderThickness="0" Width="40">
</Border>
<Border Grid.Column="1" Grid.Row="0" BorderThickness="1" BorderBrush="White">
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Monday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" FontSize="16"/>
</Border>
<Border Grid.Column="2" Grid.Row="0" BorderThickness="1" BorderBrush="White">
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Tuesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" FontSize="16"/>
</Border>
<Border Grid.Column="3" Grid.Row="0" BorderThickness="1" BorderBrush="White">
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Wednesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" FontSize="16"/>
</Border>
<Border Grid.Column="4" Grid.Row="0" BorderThickness="1" BorderBrush="White">
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Thursday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" FontSize="16"/>
</Border>
<Border Grid.Column="5" Grid.Row="0" BorderThickness="1" BorderBrush="White">
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Friday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" FontSize="16"/>
</Border>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,22 @@
namespace CampusAppWP8.Utility.Lui.Header
{
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;
public partial class WeekViewPivotHeader : UserControl
{
public WeekViewPivotHeader()
{
this.InitializeComponent();
}
}
}

View File

@@ -0,0 +1,41 @@
//-----------------------------------------------------------------------
// <copyright file="ListBoxFixed.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>22.10.2013</date>
// <summary>Implements the list box fixed class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility.Lui
{
using System.Windows.Controls;
/// <summary> A list box fixed. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
/// <seealso cref="T:System.Windows.Controls.ListBox"/>
public class ListBoxFixed : ListBox
{
/// <summary> Initializes a new instance of the ListBoxFixed class. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
public ListBoxFixed()
: base()
{
this.SelectionMode = SelectionMode.Single;
this.SelectionChanged += new SelectionChangedEventHandler(this.SelectionFix);
}
/// <summary> Selection fix. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Selection changed event information. </param>
private void SelectionFix(object sender, SelectionChangedEventArgs e)
{
ListBox obj = sender as ListBox;
if (obj.SelectedIndex >= 0)
{
obj.SelectedIndex = -1;
}
}
}
}

View File

@@ -0,0 +1,74 @@
<UserControl x:Class="CampusAppWP8.Utility.Lui.Templates.WeekView"
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"
xmlns:weekView="clr-namespace:CampusAppWP8.Utility.Lui.Templates"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
>
<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.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"/>
</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>
</UserControl>

View File

@@ -0,0 +1,81 @@
//-----------------------------------------------------------------------------
// <copyright file="WeekView.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>14.10.2013</sience>
//-----------------------------------------------------------------------------
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 System.Windows.Media;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
public partial class WeekView : UserControl
{
public static readonly DependencyProperty StartDateProperty = DependencyProperty.Register("StartDate", typeof(DateTime), typeof(WeekView), new PropertyMetadata(null));
private List<Border> borderList = new List<Border>();
private string[] timeStrings = new string[24];
private string[] monStrings = new string[24];
public WeekView()
{
this.InitializeComponent();
this.InitLayout();
}
public DateTime StartDate
{
get
{
return (DateTime)this.GetValue(StartDateProperty);
}
set
{
this.SetValue(StartDateProperty, value);
}
}
public void SetColumnBackground(int column, Brush brush = null)
{
if (column < this.borderList.Count())
{
this.borderList[column].Background = brush;
}
}
private void InitLayout()
{
for (int i = 0; i < 24; i++)
{
this.timeStrings[i] = string.Format("{0:00}:00", i);
this.monStrings[i] = i.ToString();
}
this.borderList.Add(this.MonBorder);
this.borderList.Add(this.TueBorder);
this.borderList.Add(this.WedBorder);
this.borderList.Add(this.ThuBorder);
this.borderList.Add(this.FriBorder);
this.TimeList.ItemsSource = this.timeStrings;
//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;
}
}
}

View File

@@ -0,0 +1,35 @@
<UserControl x:Class="CampusAppWP8.Utility.Lui.Templates.WeekViewDay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
>
<Grid x:Name="TheGrid">
<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="BGCanvas"
Canvas.ZIndex="1"
Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}"
Width="{Binding Path=ActualWidth, ElementName=MainCanvas, Mode=OneWay}"
/>
<Canvas
x:Name="UserCanvas"
Canvas.ZIndex="2"
Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}"
Width="{Binding Path=ActualWidth, ElementName=MainCanvas, Mode=OneWay}"
/>
</Canvas>
</Grid>
</UserControl>

View File

@@ -0,0 +1,114 @@
//-----------------------------------------------------------------------
// <copyright file="WeekViewDay.xaml.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>22.10.2013</date>
// <summary>Implements the week view day.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 System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Data;
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> Initializes a new instance of the WeekViewDay class. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
public WeekViewDay()
{
this.InitializeComponent();
}
/// <summary> Gets or sets the background list elements. </summary>
/// <value> The background list elements. </value>
public int BgListElements
{
get
{
return (int)this.GetValue(BgListElementsProperty);
}
set
{
if (value > 0)
{
this.SetValue(BgListElementsProperty, value);
this.DrawLines();
}
}
}
/// <summary> Gets or sets the height of the background list element. </summary>
/// <value> The height of the background list element. </value>
public double BgListElementHeight
{
get
{
return (double)this.GetValue(BgListElementHeightProperty);
}
set
{
if (value > 0)
{
this.SetValue(BgListElementHeightProperty, value);
this.DrawLines();
}
}
}
/// <summary> Draw lines. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
private void DrawLines()
{
if (this.BgListElementHeight > 0
&& this.BgListElements > 1)
{
this.BGCanvas.Children.Clear();
Binding colLineBind = new Binding();
colLineBind.Path = new PropertyPath("ActualWidth");
colLineBind.ElementName = "MainCanvas";
colLineBind.Mode = BindingMode.OneWay;
for (int i = 1; i < this.BgListElements; i++)
{
Line hLineInn = new Line();
hLineInn.X1 = 0;
hLineInn.Y1 = 0;
hLineInn.SetBinding(Line.X2Property, colLineBind);
hLineInn.Y2 = 0;
hLineInn.Stroke = new SolidColorBrush(Colors.DarkGray);
hLineInn.Stretch = Stretch.Fill;
hLineInn.HorizontalAlignment = HorizontalAlignment.Left;
hLineInn.SetValue(Canvas.TopProperty, (this.BgListElementHeight * i));
hLineInn.StrokeDashArray = new DoubleCollection();
hLineInn.StrokeDashArray.Add(2);
hLineInn.StrokeDashArray.Add(4);
hLineInn.StrokeThickness = 1;
hLineInn.SetValue(Canvas.ZIndexProperty, 0);
this.BGCanvas.Children.Add(hLineInn);
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWP8.Utility.NDEF
{
public class BTUTagMessage : ndefpclib.message.Text.TextMessageUTF8
{
public BTUTagMessage(string content): base(content,ndefpclib.type.Const.Language.DE)
{
}
public BTUTagMessage(byte[] array) : base(array)
{
}
}
}

View File

@@ -1,155 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="NDEFMessage.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>21.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Utility.NDEF
{
using System.Collections.Generic;
using System.IO;
/// <summary> Ndef message. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
public class NDEFMessage
{
#region Members
/// <summary> The records. </summary>
private List<NDEFRecord> records;
#endregion
#region constructors
/// <summary> Initializes a new instance of the NDEFMessage class. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <param name="content"> The content. </param>
/// <param name="type"> The type. </param>
/// <param name="tnf"> (Optional) the tnf. </param>
public NDEFMessage(string content, TYPEVAL type, NDEFRecord.TNFVAL tnf = NDEFRecord.TNFVAL.WKT)
{
this.records = new List<NDEFRecord>();
float recordsCount = (float)content.Length / NDEFRecord.MaxRecordPayLoad;
NDEFRecord tmpRecord = null;
string praefix = NDEFMessage.GetPraefix(type);
for (int i = 0; recordsCount > 0; i++)
{
tmpRecord = new NDEFShortRecord();
tmpRecord.Type = type;
tmpRecord.TNF = tnf;
tmpRecord.PayloadPraefix = praefix;
int recordsize = 255;
if (content.Length < (i + 1) * recordsize)
{
recordsize = content.Length - (i * recordsize);
}
tmpRecord.Payload = content.Substring(i * 255, recordsize);
if (i == 0)
{
tmpRecord.MB = NDEFRecord.NDEFFlags.MBSET;
}
this.records.Add(tmpRecord);
recordsCount--;
}
this.records[this.records.IndexOf(tmpRecord)].ME = NDEFRecord.NDEFFlags.MESET;
}
/// <summary> Initializes a new instance of the NDEFMessage class. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <param name="array"> The array. </param>
public NDEFMessage(byte[] array)
{
this.records = new List<NDEFRecord>();
NDEFRecord tmpRecord = null;
for (int i = 0; i < array.Length; i += tmpRecord.RecordSize)
{
tmpRecord = new NDEFShortRecord(array, i);
this.records.Add(tmpRecord);
}
}
#endregion
#region enum
/// <summary> Values that represent TYPEVAL. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
public enum TYPEVAL
{
/// <summary>An enum constant representing the empty option.</summary>
EMPTY = 0x00,
/// <summary>An enum constant representing the URL option.</summary>
URL = 0x55,
/// <summary>An enum constant representing the text option.</summary>
TEXT = 0x54,
}
#endregion
#region Methods
/// <summary> Gets a praefix. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <param name="type"> The type. </param>
/// <returns> The praefix. </returns>
public static string GetPraefix(TYPEVAL type)
{
string praefix = string.Empty;
switch (type)
{
case TYPEVAL.TEXT:
praefix = "\x02" + "de";
break;
case TYPEVAL.URL:
praefix = "\x01";
break;
default:
break;
}
return praefix;
}
/// <summary> Gets the content. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <returns> The content. </returns>
public string GetContent()
{
string result = string.Empty;
foreach (NDEFRecord record in this.records)
{
result += record.Payload;
}
return result;
}
/// <summary> Converts this object to a byte array. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <returns> This object as a byte[]. </returns>
public byte[] ToByteArray()
{
MemoryStream ms = new MemoryStream();
foreach (NDEFRecord record in this.records)
{
ms.Write(record.ToByteArray(), 0, record.RecordSize);
}
return ms.ToArray();
}
#endregion
}
}

View File

@@ -1,191 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="NDEFRecord.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>15.10.2013</date>
// <summary>Implements the ndef record class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility.NDEF
{
using System.IO;
using System.Text;
/// <summary> Ndef record of a NDEFMessage. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
public abstract class NDEFRecord
{
#region Members
/// <summary> The maximum record pay load. </summary>
public const int MaxRecordPayLoad = 255;
/// <summary> Size of the type. </summary>
protected const byte TypeSize = 0x01;
#endregion
#region Constructors
/// <summary> Initializes a new instance of the NDEFRecord class. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
public NDEFRecord()
{
}
/// <summary> Initializes a new instance of the NDEFRecord class. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <param name="array"> The array. </param>
/// <param name="index"> (Optional) zero-based index of the. </param>
public NDEFRecord(byte[] array, int index = 0)
{
this.FormatFlags = array[index];
}
#endregion
#region enum
/// <summary> Values that represent NDEFFlags. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
public enum NDEFFlags
{
/// <summary>An Enum constant representing the UNSET option.</summary>
UNSET = 0x00,
/// <summary>An Enum constant representing the Message begin option.</summary>
MBSET = 0x80,
/// <summary>An Enum constant representing the Message end option.</summary>
MESET = 0x40,
/// <summary>An Enum constant representing the CHUNK FLAG option.</summary>
CFSET = 0x20,
/// <summary>An Enum constant representing the Short Record set option.</summary>
SRSET = 0x10,
/// <summary>An Enum constant representing the ID length option.</summary>
ILSET = 0x08,
/// <summary>An enum constant representing the tnfset option.</summary>
TNFSET = 0x03
}
/// <summary> Values that represent TNFVAL. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
public enum TNFVAL
{
/// <summary>An enum constant representing the empty option.</summary>
EMPTY = 0x00,
/// <summary>An enum constant representing the Well-Know-Type option.</summary>
WKT = 0x01,
/// <summary>An enum constant representing the MediaType option.</summary>
MEDIATYPE = 0x02,
/// <summary>An enum constant representing the URI option.</summary>
URI = 0x03,
/// <summary>An enum constant representing the NFCE option.</summary>
NFCE = 0x04,
/// <summary>An enum constant representing the unknow option.</summary>
unknow = 0x05,
/// <summary>An enum constant representing the unchanged option.</summary>
UNCHANGED = 0x06,
/// <summary>An enum constant representing the reserved option.</summary>
RESERVED = 0x07
}
#endregion
#region Properties
/// <summary> Gets or sets the MBFlag. </summary>
/// <value> The MBFlag. </value>
public NDEFFlags MB { get; set; }
/// <summary> Gets or sets MEFlag. </summary>
/// <value> The MEFlag . </value>
public NDEFFlags ME { get; set; }
/// <summary> Gets or sets the CFFlag. </summary>
/// <value> The CFFlag. </value>
public NDEFFlags CF { get; set; }
/// <summary> Gets or sets the SRFlag. </summary>
/// <value> The SRFlag. </value>
public NDEFFlags SR { get; set; }
/// <summary> Gets or sets the ILFlag. </summary>
/// <value> The ILFlag. </value>
public NDEFFlags IL { get; set; }
/// <summary> Gets or sets the TNFField. </summary>
/// <value> The TNFField. </value>
public TNFVAL TNF { get; set; }
/// <summary> Gets or sets the type. </summary>
/// <value> The type. </value>
public NDEFMessage.TYPEVAL Type { get; set; }
/// <summary> Gets the format flags. </summary>
/// <value> The format flags. </value>
public byte FormatFlags
{
get
{
return (byte)((byte)this.TNF | ((byte)this.MB) | ((byte)this.ME) | ((byte)this.CF) | ((byte)this.SR) | ((byte)this.IL));
}
protected set
{
this.TNF = (TNFVAL)(value & (byte)NDEFFlags.TNFSET);
this.MB = (NDEFFlags)(value & (byte)NDEFFlags.MBSET);
this.ME = (NDEFFlags)(value & (byte)NDEFFlags.MESET);
this.CF = (NDEFFlags)(value & (byte)NDEFFlags.CFSET);
this.SR = (NDEFFlags)(value & (byte)NDEFFlags.SRSET);
this.IL = (NDEFFlags)(value & (byte)NDEFFlags.ILSET);
}
}
/// <summary> Gets or sets the payload. </summary>
/// <value> The payload. </value>
public string Payload { get; set; }
/// <summary> Gets the size of the record. </summary>
/// <value> The size of the record. </value>
public int RecordSize
{
get
{
return this.HeaderSize + this.Payload.Length + this.PayloadPraefix.Length;
}
}
/// <summary> Gets or sets the payload praefix. </summary>
/// <value> The payload praefix. </value>
public string PayloadPraefix { get; set; }
/// <summary> Gets or sets the size of the header. </summary>
/// <value> The size of the header. </value>
protected int HeaderSize { get; set; }
#endregion
#region Methods
/// <summary> Converts the record to a byte array. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <returns> This object as a byte[]. </returns>
public abstract byte[] ToByteArray();
#endregion
}
}
// End of Utility\NDEF\NDEFRecord.cs

View File

@@ -1,73 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="NDEFShortRecord.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>15.10.2013</date>
// <summary>Implements the ndef short record class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility.NDEF
{
using System.Text;
/// <summary> Ndef short record. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Utility.NDEF.NDEFRecord"/>
public class NDEFShortRecord : NDEFRecord
{
#region Constructor
/// <summary> Initializes a new instance of the NDEFShortRecord class. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
public NDEFShortRecord()
{
this.HeaderSize = 4;
this.SR = NDEFFlags.SRSET;
this.IL = NDEFFlags.UNSET;
this.CF = NDEFFlags.UNSET;
}
/// <summary> Initializes a new instance of the NDEFShortRecord class. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <param name="array"> The array. </param>
/// <param name="index"> (Optional) zero-based index of the. </param>
public NDEFShortRecord(byte[] array, int index = 0)
: base(array)
{
this.HeaderSize = 4;
this.Type = (NDEFMessage.TYPEVAL)array[index + 3];
this.PayloadPraefix = NDEFMessage.GetPraefix(this.Type);
int payLoadSize = array[index + 2] - this.PayloadPraefix.Length;
this.Payload = Encoding.UTF8.GetString(array, index + this.HeaderSize + this.PayloadPraefix.Length, payLoadSize);
}
#endregion
#region Method
/// <summary> Converts this NDEFShortRecord to a byte array. </summary>
/// <remarks> Stubbfel, 21.08.2013. </remarks>
/// <seealso cref="M:CampusAppWP8.Utility.NDEF.NDEFRecord.ToByteArray()"/>
public override byte[] ToByteArray()
{
byte[] payloadAr = Encoding.UTF8.GetBytes(this.PayloadPraefix + this.Payload);
byte[] array = new byte[payloadAr.Length + this.HeaderSize];
array[0] = this.FormatFlags;
array[1] = NDEFRecord.TypeSize;
array[2] = (byte)(Payload.Length + this.PayloadPraefix.Length);
array[3] = (byte)this.Type;
int i = this.HeaderSize;
foreach (byte b in payloadAr)
{
array[i] = b;
i++;
}
return array;
}
#endregion
}
}

View File

@@ -0,0 +1,127 @@
//-----------------------------------------------------------------------
// <copyright file="StringManager.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>06.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System;
using System.Text.RegularExpressions;
using CampusAppWP8.Resources;
/// <summary>
/// Class provides some special StringMethods
/// </summary>
public static class StringManager
{
#region Members
/// <summary>
/// Patter for Html-Tags
/// </summary>
private static readonly string HtmlTagPattern = "<.*?>";
/// <summary>The mail valid regular expression.</summary>
private static readonly string EMailValidRegex = @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$";
#endregion
#region Methods
/// <summary>
/// Method removes Html-Tag of a String
/// </summary>
/// <param name="inputString">String with Html-Tags</param>
/// <returns>String without Html-Tags</returns>
public static string StripHTML(string inputString)
{
string result = Regex.Replace(inputString, HtmlTagPattern, string.Empty);
return System.Net.HttpUtility.HtmlDecode(result);
}
/// <summary>
/// Method add an Newline to a string
/// </summary>
/// <param name="str">input string</param>
/// <returns>input string + newline</returns>
public static string AddNewLine(string str)
{
return str.ToString() + "\n";
}
/// <summary>Method remove(TrimEND!) an Newline to a string.</summary>
/// <remarks>Stubbfel, 12.09.2013.</remarks>
/// <param name="str">input string.</param>
/// <returns>input string - newline.</returns>
public static string RemoveNewLine(string str)
{
return str.TrimEnd('\n');
}
/// <summary>Query if 'strIn' is valid email.</summary>
/// <remarks>Stubbfel, 04.09.2013.</remarks>
/// <param name="strIn">The in.</param>
/// <returns>true if valid email, false if not.</returns>
public static bool IsValidEmail(string strIn)
{
// Return true if strIn is in valid e-mail format.
try
{
return Regex.IsMatch(
strIn,
StringManager.EMailValidRegex,
RegexOptions.IgnoreCase);
}
catch (Exception)
{
return false;
}
}
/// <summary>Creates uni telefon number.</summary>
/// <remarks>Stubbfel, 04.09.2013.</remarks>
/// <param name="input">The input.</param>
/// <returns>The new uni telefon number.</returns>
public static string CreateUniTelefonNumber(string input)
{
string result = null;
if (input.Length < 5)
{
result = Constants.UniCBTelPrefix + input.TrimStart('0');
}
else
{
result = input;
}
Regex regexObj = new Regex(@"[^\d]");
result = regexObj.Replace(result.TrimStart('0'), string.Empty);
result = Constants.DeTelPrefix + result;
return result;
}
/// <summary>Count character.</summary>
/// <remarks>Fiedler, 27.08.2013.</remarks>
/// <param name="str">input string.</param>
/// <param name="c">The character.</param>
/// <returns>The total number of the specified character in the string.</returns>
public static int CountChar(string str, char c)
{
int retValue = 0;
for (int i = 0; i < str.Length; i++)
{
if (str[i].Equals(c))
{
retValue++;
}
}
return retValue;
}
#endregion
}
}

View File

@@ -426,6 +426,20 @@ namespace CampusAppWP8.Utility
return result;
}
/// <summary> List box selection fixer. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Selection changed event information. </param>
public static void ListBoxSelectionFixer(object sender, SelectionChangedEventArgs e)
{
ListBox obj = sender as ListBox;
if (obj.SelectedIndex >= 0)
{
obj.SelectedIndex = -1;
}
}
#endregion
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="WPtoolkit" version="4.2013.08.16" targetFramework="wp80" />
<<<<<<< HEAD
<package id="WPToolkit" version="4.2013.06.11" targetFramework="wp80" />
=======
<package id="ZXing.Net" version="0.11.0.1" targetFramework="wp80" />
>>>>>>> feature/#17
</packages>

View File

@@ -1,18 +1,44 @@
using System.Globalization;
using System.Runtime.Serialization;
//-----------------------------------------------------------------------
// <copyright file="GeoMapPoint.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>23.10.2013</date>
// <summary>Implements the geo map point class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Utility
{
using System.Globalization;
/// <summary> A geo map point. </summary>
/// <remarks> Stubbfel, 23.10.2013. </remarks>
/// <seealso cref="T:CampusAppWPortalLib8.Model.Utility.MapPoint"/>
public class GeoMapPoint : MapPoint
{
#region Constructor
/// <summary> Initializes a new instance of the GeoMapPoint class. </summary>
/// <remarks> Stubbfel, 23.10.2013. </remarks>
public GeoMapPoint()
{
}
/// <summary> Initializes a new instance of the GeoMapPoint class. </summary>
/// <remarks> Stubbfel, 23.10.2013. </remarks>
/// <param name="latitude"> The latitude. </param>
/// <param name="longitude"> The longitude. </param>
/// <param name="timestamp"> The timestamp. </param>
public GeoMapPoint(double latitude, double longitude, long timestamp)
: base(longitude, latitude)
{
this.Timestamp = timestamp;
}
/// <summary> Initializes a new instance of the GeoMapPoint class. </summary>
/// <remarks> Stubbfel, 23.10.2013. </remarks>
/// <param name="latitude"> The latitude. </param>
/// <param name="longitude"> The longitude. </param>
/// <param name="timestamp"> The timestamp. </param>
public GeoMapPoint(string latitude, string longitude, string timestamp)
{
double lat;
@@ -34,7 +60,8 @@ namespace CampusAppWPortalLib8.Model.Utility
#region Property
[DataMember]
/// <summary> Gets or sets the latitude. </summary>
/// <value> The latitude. </value>
public double Latitude
{
get
@@ -48,7 +75,8 @@ namespace CampusAppWPortalLib8.Model.Utility
}
}
[DataMember]
/// <summary> Gets or sets the longitude. </summary>
/// <value> The longitude. </value>
public double Longitude
{
get
@@ -62,7 +90,8 @@ namespace CampusAppWPortalLib8.Model.Utility
}
}
[DataMember]
/// <summary> Gets or sets the timestamp. </summary>
/// <value> The timestamp. </value>
public long Timestamp { get; set; }

View File

@@ -1,30 +1,30 @@
<StyleCopSettings Version="105">
<GlobalSettings>
<CollectionProperty Name="RecognizedWords">
<Value>akadgrad</Value>
<Value>api</Value>
<Value>cb</Value>
<Value>enum</Value>
<Value>fiedlchr</Value>
<Value>nfc</Value>
<Value>param</Value>
<Value>qr</Value>
<Value>senftenberg</Value>
<Value>sfb</Value>
<Value>sps</Value>
<Value>str</Value>
<Value>stubbfel</Value>
<Value>telefon</Value>
<Value>uni</Value>
<Value>wc</Value>
</CollectionProperty>
</GlobalSettings>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<AnalyzerSettings>
<StringProperty Name="CompanyName">BTU/IIT</StringProperty>
<StringProperty Name="Copyright">The MIT License (MIT). Copyright (c) 2013 BTU/IIT.</StringProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
<StyleCopSettings Version="105">
<GlobalSettings>
<CollectionProperty Name="RecognizedWords">
<Value>akadgrad</Value>
<Value>api</Value>
<Value>cb</Value>
<Value>enum</Value>
<Value>fiedlchr</Value>
<Value>nfc</Value>
<Value>param</Value>
<Value>qr</Value>
<Value>senftenberg</Value>
<Value>sfb</Value>
<Value>sps</Value>
<Value>str</Value>
<Value>stubbfel</Value>
<Value>telefon</Value>
<Value>uni</Value>
<Value>wc</Value>
</CollectionProperty>
</GlobalSettings>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<AnalyzerSettings>
<StringProperty Name="CompanyName">BTU/IIT</StringProperty>
<StringProperty Name="Copyright">The MIT License (MIT). Copyright (c) 2013 BTU/IIT.</StringProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
</StyleCopSettings>

View File

@@ -196,6 +196,26 @@ namespace CampusAppWPortalLib8.Utility
return null;
}
/// <summary>Count character.</summary>
/// <remarks>Fiedler, 27.08.2013.</remarks>
/// <param name="str">input string.</param>
/// <param name="c">The character.</param>
/// <returns>The total number of the specified character in the string.</returns>
public static int CountChar(string str, char c)
{
int retValue = 0;
foreach(char tc in str)
{
if(tc.Equals(c) == true)
{
retValue++;
}
}
return retValue;
}
#endregion
}
}