ics import
This commit is contained in:
@@ -112,10 +112,14 @@
|
||||
<Compile Include="Model\Mensa\MealModel.cs" />
|
||||
<Compile Include="Model\Setting\AppSettings.cs" />
|
||||
<Compile Include="Model\Setting\UserProfilModel.cs" />
|
||||
<Compile Include="Model\TimeTable\AppointmentModel.cs" />
|
||||
<Compile Include="Model\Utility\CourseListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\DegreeListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\CleanUrlParamModel.cs" />
|
||||
<Compile Include="Model\Utility\CampusListPickerItemListModel.cs" />
|
||||
<Compile Include="Pages\TimeTable\TimeTableDay.xaml.cs">
|
||||
<DependentUpon>TimeTableDay.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\NDEF\NDEFMessage.cs" />
|
||||
<Compile Include="Utility\NDEF\NDEFRecord.cs" />
|
||||
<Compile Include="Utility\NDEF\NDEFShortRecord.cs" />
|
||||
@@ -352,6 +356,10 @@
|
||||
<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\Webmail\WebmailPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
151
CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
Normal file
151
CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <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;
|
||||
|
||||
/// <summary>
|
||||
/// Model for appointments.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class AppointmentModel
|
||||
{
|
||||
/// <summary>The Visual object.</summary>
|
||||
private Rectangle rect = null;
|
||||
|
||||
private IcsVEvent data;
|
||||
|
||||
private struct IcsVEvent
|
||||
{
|
||||
public DateTime created;
|
||||
public string uid;
|
||||
public DateTime lastModified;
|
||||
public DateTime stamp;
|
||||
public string summary;
|
||||
public DateTime start;
|
||||
public DateTime end;
|
||||
public string accessClass;
|
||||
public string location;
|
||||
public string description;
|
||||
public string categories;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="AppointmentModel" /> class. </summary>
|
||||
public AppointmentModel()
|
||||
{
|
||||
}
|
||||
|
||||
public AppointmentModel(string icsData) : this()
|
||||
{
|
||||
this.ImportFromICS(icsData);
|
||||
}
|
||||
|
||||
public Rectangle GetRectangle()
|
||||
{
|
||||
return this.rect;
|
||||
}
|
||||
|
||||
public void ImportFromICS(string icsData)
|
||||
{
|
||||
string[] elems = Regex.Split(icsData, "\r\n");
|
||||
|
||||
foreach (string e in elems)
|
||||
{
|
||||
string[] parts = e.Split(':');
|
||||
|
||||
if (parts.Length != 2)
|
||||
{
|
||||
throw new NotImplementedException("error in ics string");
|
||||
}
|
||||
|
||||
if (parts[0].Contains(";"))
|
||||
{
|
||||
parts[0] = parts[0].Split(';')[0];
|
||||
}
|
||||
|
||||
switch (parts[0])
|
||||
{
|
||||
case "BEGIN":
|
||||
break;
|
||||
case "CREATED":
|
||||
this.data.created = this.ParseUTC(parts[1]);
|
||||
break;
|
||||
case "UID":
|
||||
this.data.uid = parts[1];
|
||||
break;
|
||||
case "LAST-MODIFIED":
|
||||
this.data.lastModified = this.ParseUTC(parts[1]);
|
||||
break;
|
||||
case "DTSTAMP":
|
||||
this.data.stamp = this.ParseUTC(parts[1]);
|
||||
break;
|
||||
case "SUMMARY":
|
||||
this.data.summary = parts[1];
|
||||
break;
|
||||
case "DTSTART":
|
||||
this.data.start = this.ParseUTC(parts[1]);
|
||||
break;
|
||||
case "DTEND":
|
||||
this.data.end = this.ParseUTC(parts[1]);
|
||||
break;
|
||||
case "CLASS":
|
||||
this.data.accessClass = parts[1];
|
||||
break;
|
||||
case "LOCATION":
|
||||
this.data.location = parts[1];
|
||||
break;
|
||||
case "DESCRIPTION":
|
||||
this.data.description = parts[1];
|
||||
break;
|
||||
case "CATEGORIES":
|
||||
this.data.categories = parts[1];
|
||||
break;
|
||||
case "END":
|
||||
break;
|
||||
case "VERSION":
|
||||
break;
|
||||
case "PRODID":
|
||||
break;
|
||||
case "X-WR-CALNAME":
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("unknown tag in ics: " + parts[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ExportToICS()
|
||||
{
|
||||
string retValue = string.Empty;
|
||||
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private void CreateRect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private DateTime ParseUTC(string datetime)
|
||||
{
|
||||
datetime = datetime.Insert(4, "-");
|
||||
datetime = datetime.Insert(7, "-");
|
||||
datetime = datetime.Insert(13, ":");
|
||||
datetime = datetime.Insert(16, ":");
|
||||
|
||||
return DateTime.Parse(datetime);
|
||||
}
|
||||
}
|
||||
}
|
||||
37
CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml
Normal file
37
CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml
Normal file
@@ -0,0 +1,37 @@
|
||||
<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">
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot Title="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<!--Pivotelement eins-->
|
||||
<phone:PivotItem Header="So 21.08.2013">
|
||||
<Grid/>
|
||||
</phone:PivotItem>
|
||||
|
||||
<!--Pivotelement zwei-->
|
||||
<phone:PivotItem Header="Mo 22.08.2013">
|
||||
<Grid/>
|
||||
</phone:PivotItem>
|
||||
|
||||
<!--3. Element-->
|
||||
<phone:PivotItem Header="Di 23.08.2013">
|
||||
<Grid/>
|
||||
</phone:PivotItem>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
|
||||
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
public partial class TimeTableDay : PhoneApplicationPage
|
||||
{
|
||||
private AppointmentModel testMod = null;
|
||||
|
||||
public TimeTableDay()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.testMod = new AppointmentModel("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:ownCloud Calendar 0.6.3\r\nX-WR-CALNAME:MyTestAppointment\r\nBEGIN:VEVENT\r\nCREATED;VALUE=DATE-TIME:20130826T142318Z\r\nUID:617332baab\r\nLAST-MODIFIED;VALUE=DATE-TIME:20130826T142318Z\r\nDTSTAMP;VALUE=DATE-TIME:20130826T142318Z\r\nSUMMARY:MyTestAppointment\r\nDTSTART;VALUE=DATE-TIME:20130730T130000Z\r\nDTEND;VALUE=DATE-TIME:20130730T133000Z\r\nCLASS:PUBLIC\r\nLOCATION:BTU Campus\r\nDESCRIPTION:bla\r\nCATEGORIES:Arbeit\r\nEND:VEVENT\r\nEND:VCALENDAR");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<Capability Name="ID_CAP_SPEECH_RECOGNITION" />
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name="_default" NavigationPage="Pages/StartPage.xaml" />
|
||||
<DefaultTask Name="_default" NavigationPage="Pages/TimeTable/TimetableDay.xaml" />
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">
|
||||
|
||||
Reference in New Issue
Block a user