week view first submit
This commit is contained in:
@@ -146,6 +146,9 @@
|
||||
<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" />
|
||||
@@ -475,6 +478,10 @@
|
||||
<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>
|
||||
|
||||
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -27,11 +28,13 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
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
|
||||
@@ -43,10 +46,11 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
{
|
||||
this.appointmentList.Add(a);
|
||||
}
|
||||
this.hasChangedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ObservableCollection<AppointmentModel> Appointments
|
||||
{
|
||||
get
|
||||
@@ -59,5 +63,23 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,6 +303,12 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
public void SetWidth(double maxWidth)
|
||||
{
|
||||
this.width = maxWidth - this.canvas.Margin.Left;
|
||||
|
||||
if (this.width < 200)
|
||||
{
|
||||
this.width = 200;
|
||||
}
|
||||
|
||||
this.CalcRect();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
@@ -18,9 +19,12 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
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();
|
||||
@@ -42,42 +46,66 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
|
||||
string appointmentIndex = string.Empty;
|
||||
|
||||
// Navigate to the selected pivotitem
|
||||
if (NavigationContext.QueryString.TryGetValue(Constants.Param_Appointment_Index, out appointmentIndex))
|
||||
if (e.NavigationMode == NavigationMode.Back)
|
||||
{
|
||||
int appointmentIndexInt = int.Parse(appointmentIndex);
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
this.DataContext = this.appModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
string appointmentIndexStr = string.Empty;
|
||||
|
||||
// if the index is in the range of the array
|
||||
if ((appointmentIndexInt >= 0) && (appointmentIndexInt < TimeTable.AppointmentsModel.Appointments.Count()))
|
||||
// Navigate to the selected pivotitem
|
||||
if (NavigationContext.QueryString.TryGetValue(Constants.Param_Appointment_Index, out appointmentIndexStr))
|
||||
{
|
||||
this.DataContext = TimeTable.AppointmentsModel.Appointments[appointmentIndexInt];
|
||||
}
|
||||
else
|
||||
{
|
||||
string o = string.Empty;
|
||||
int appointmentIndex = int.Parse(appointmentIndexStr);
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in NavigationContext.QueryString)
|
||||
// if the index is in the range of the array
|
||||
if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
|
||||
{
|
||||
o += string.Format("Key = {0}, Value = {1}", kvp.Key, kvp.Value) + "\n";
|
||||
this.appModel = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
|
||||
this.DataContext = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
string o = string.Empty;
|
||||
|
||||
MessageBox.Show("ERROR: appointment index out of range!!! (" + o + ")");
|
||||
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.DataContext as Model.TimeTable.AppointmentModel);
|
||||
TimeTable.AppointmentsModel.Appointments.Remove(this.appModel);
|
||||
this.NavigationService.GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<!--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.Edit, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
<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-->
|
||||
@@ -126,18 +126,28 @@
|
||||
</StackPanel>
|
||||
<!--status-->
|
||||
|
||||
<!--Attendees-->
|
||||
<!--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="4">
|
||||
<StackPanel Grid.Row="5">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Visibility, Source={StaticResource LocalizedStrings}}"/>
|
||||
<toolkit:ListPicker x:Name="InAccessClass"/>
|
||||
</StackPanel>
|
||||
<!--Description-->
|
||||
<StackPanel Grid.Row="5">
|
||||
<StackPanel Grid.Row="6">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Description, Source={StaticResource LocalizedStrings}}"/>
|
||||
<TextBox x:Name="InDescription" AcceptsReturn="True" Height="160" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
@@ -26,8 +26,11 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
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()
|
||||
{
|
||||
@@ -35,6 +38,8 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
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);
|
||||
@@ -53,6 +58,40 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
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)
|
||||
@@ -115,22 +154,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
newLM.Value = DateTime.Now;
|
||||
newItem.SetValue(newLM);
|
||||
|
||||
//byte[] deviceID = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
|
||||
long uid = DateTime.Now.Ticks;
|
||||
long[] unique = new long[5];
|
||||
|
||||
//unique[0] = deviceID[0] << 24 | deviceID[13] << 16 | deviceID[7] << 8 | deviceID[16] << 0;
|
||||
//unique[1] = deviceID[11] << 24 | deviceID[18] << 16 | deviceID[1] << 8 | deviceID[5] << 0;
|
||||
//unique[2] = deviceID[17] << 24 | deviceID[8] << 16 | deviceID[3] << 8 | deviceID[19] << 0;
|
||||
//unique[3] = deviceID[10] << 24 | deviceID[6] << 16 | deviceID[12] << 8 | deviceID[2] << 0;
|
||||
//unique[4] = deviceID[9] << 24 | deviceID[14] << 16 | deviceID[4] << 8 | deviceID[15] << 0;
|
||||
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
unique[i] += uid;
|
||||
}
|
||||
|
||||
string unique_string = string.Format("{0:x08}{1:x08}{2:x08}{3:x08}{4:x08}", unique[0], unique[1], unique[2], unique[3], unique[4]) + "@" + AppResources.ApplicationTitle;
|
||||
|
||||
string unique_string = string.Format("{0:x}", uid) + "@" + AppResources.ApplicationTitle;
|
||||
unique_string = unique_string.Replace(" ", "");
|
||||
|
||||
UniqueID newUID = new UniqueID();
|
||||
@@ -168,6 +194,15 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
@@ -193,8 +228,14 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
|
||||
newItem.Calc();
|
||||
TimeTable.AppointmentsModel.Appointments.Add(newItem);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -84,8 +85,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
if (e.NavigationMode == NavigationMode.Back)
|
||||
{
|
||||
// only after edit/create/delete
|
||||
//this.SetupItemPage(this.lastSelectedIndex, this.itemDate[this.lastSelectedIndex]);
|
||||
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,6 +142,8 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
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);
|
||||
@@ -212,11 +214,38 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
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.itemDate[i]) > -1)
|
||||
{
|
||||
this.SetupItemPage(i, this.itemDate[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddContentUIElement(int index, UIElement elem)
|
||||
{
|
||||
(((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children[1] as Canvas).Children.Add(elem);
|
||||
|
||||
23
CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml
Normal file
23
CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml
Normal file
@@ -0,0 +1,23 @@
|
||||
<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: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">
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
214
CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs
Normal file
214
CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs
Normal file
@@ -0,0 +1,214 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <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;
|
||||
|
||||
public partial class TimeTableWeek : PhoneApplicationPage
|
||||
{
|
||||
private static readonly double WEEK_TABLE_CELL_HEIGHT = 30;
|
||||
private static readonly double WEEK_TABLE_HEAD_WIDTH = 30;
|
||||
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 struct PageItem
|
||||
{
|
||||
public Canvas Content { get; set; }
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public char WeekChar { get; set; }
|
||||
}
|
||||
|
||||
private static readonly int PIVOT_PAGES = 3;
|
||||
|
||||
private PageItem[] itemPages = new PageItem[PIVOT_PAGES];
|
||||
|
||||
public TimeTableWeek()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
{
|
||||
this.CreatePage(i, DateTime.Now);
|
||||
|
||||
Rectangle testRect = new Rectangle();
|
||||
testRect.Width = 50;
|
||||
testRect.Height = 50;
|
||||
testRect.Fill = new SolidColorBrush(Colors.Red);
|
||||
|
||||
this.itemPages[i].Content.Children.Add(testRect);
|
||||
}
|
||||
|
||||
|
||||
//this.DrawBackground(this.TestCanvas);
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void EventAutoScroll(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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(7);
|
||||
this.itemPages[itemIndex].WeekChar = 'A';
|
||||
|
||||
|
||||
ScrollViewer sv = new ScrollViewer();
|
||||
sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
|
||||
Canvas container = new Canvas();
|
||||
container.Height = WEEK_TABLE_CELL_HEIGHT * 24;
|
||||
Canvas canBG = new Canvas();
|
||||
canBG.Height = WEEK_TABLE_CELL_HEIGHT * 24;
|
||||
PivotItem pvItem = new PivotItem();
|
||||
|
||||
this.DrawBackground(canBG);
|
||||
|
||||
container.Children.Add(canBG);
|
||||
container.Children.Add(this.itemPages[itemIndex].Content);
|
||||
sv.Content = container;
|
||||
pvItem.Content = sv;
|
||||
|
||||
/*
|
||||
Grid headGrid = new Grid();
|
||||
ColumnDefinition col_0 = new ColumnDefinition();
|
||||
ColumnDefinition col_1 = new ColumnDefinition();
|
||||
ColumnDefinition col_2 = new ColumnDefinition();
|
||||
|
||||
col_0.Width = GridLength.Auto;
|
||||
col_1.Width = GridLength.Auto;
|
||||
col_2.Width = GridLength.Auto;
|
||||
|
||||
headGrid.ColumnDefinitions.Add(col_0);
|
||||
headGrid.ColumnDefinitions.Add(col_1);
|
||||
headGrid.ColumnDefinitions.Add(col_2);
|
||||
*/
|
||||
|
||||
TextBlock tbHead = new TextBlock();
|
||||
tbHead.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
tbHead.Text = string.Format("{0:dd.MM.yyyy} < {1:c} > {2:dd.MM.yyyy}", this.itemPages[itemIndex].DateFrom, this.itemPages[itemIndex].WeekChar, this.itemPages[itemIndex].DateTo);
|
||||
tbHead.FontSize = 24;
|
||||
|
||||
pvItem.Header = tbHead;
|
||||
|
||||
this.ThePivot.Items.Add(pvItem);
|
||||
|
||||
}
|
||||
|
||||
private void DrawBackground(Canvas can)
|
||||
{
|
||||
Line vertLine = new Line();
|
||||
vertLine.X1 = 0;
|
||||
vertLine.Y1 = 0;
|
||||
vertLine.X2 = 0;
|
||||
vertLine.Y2 = (WEEK_TABLE_CELL_HEIGHT * 24);
|
||||
vertLine.Stroke = new SolidColorBrush(Colors.White);
|
||||
vertLine.Stretch = Stretch.Fill;
|
||||
vertLine.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
vertLine.Margin = new Thickness(WEEK_TABLE_HEAD_WIDTH, 0, 0, 0);
|
||||
vertLine.StrokeThickness = WEEK_TABLE_HEAD_THICKNESS;
|
||||
|
||||
for (int i = 0; i <= 24; i++)
|
||||
{
|
||||
// lines
|
||||
Line hLineHead = new Line();
|
||||
hLineHead.X1 = 0;
|
||||
hLineHead.Y1 = 0;
|
||||
hLineHead.X2 = WEEK_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, (WEEK_TABLE_CELL_HEIGHT * i), 0, 0);
|
||||
hLineHead.StrokeThickness = WEEK_TABLE_HEAD_THICKNESS;
|
||||
|
||||
Line hLineHalf = new Line();
|
||||
hLineHalf.X1 = 0;
|
||||
hLineHalf.Y1 = 0;
|
||||
hLineHalf.X2 = WEEK_TABLE_HEAD_HALF;
|
||||
hLineHalf.Y2 = 0;
|
||||
hLineHalf.Stroke = new SolidColorBrush(Colors.Gray);
|
||||
hLineHalf.Stretch = Stretch.Fill;
|
||||
hLineHalf.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
hLineHalf.Margin = new Thickness((WEEK_TABLE_HEAD_WIDTH - WEEK_TABLE_HEAD_HALF), (WEEK_TABLE_CELL_HEIGHT * i) + (WEEK_TABLE_CELL_HEIGHT / 2), 0, 0);
|
||||
hLineHalf.StrokeThickness = WEEK_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(WEEK_TABLE_HEAD_WIDTH, (WEEK_TABLE_CELL_HEIGHT * i), 0, 0);
|
||||
hLineInn.StrokeDashArray = new DoubleCollection();
|
||||
hLineInn.StrokeDashArray.Add(2);
|
||||
hLineInn.StrokeDashArray.Add(4);
|
||||
hLineInn.StrokeThickness = WEEK_TABLE_INNER_THICKNESS;
|
||||
|
||||
can.Children.Add(hLineHead);
|
||||
can.Children.Add(hLineInn);
|
||||
|
||||
if (i < 24)
|
||||
{
|
||||
can.Children.Add(hLineHalf);
|
||||
|
||||
// text
|
||||
TextBlock timeStamp = new TextBlock();
|
||||
timeStamp.Text = i.ToString("00") + ":00";
|
||||
timeStamp.Margin = new Thickness(0, (WEEK_TABLE_CELL_HEIGHT * i) + 2, 0, 0);
|
||||
timeStamp.FontSize = 10;
|
||||
|
||||
can.Children.Add(timeStamp);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < 5; i++)
|
||||
{
|
||||
Line dayLine = new Line();
|
||||
dayLine.X1 = WEEK_TABLE_HEAD_WIDTH + (i * (720 - WEEK_TABLE_HEAD_WIDTH) / 5);
|
||||
dayLine.Y1 = 0;
|
||||
dayLine.X2 = dayLine.X1;
|
||||
dayLine.Y2 = (WEEK_TABLE_CELL_HEIGHT * 24);
|
||||
dayLine.Stroke = new SolidColorBrush(Colors.White);
|
||||
dayLine.Stretch = Stretch.Fill;
|
||||
dayLine.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
dayLine.Margin = new Thickness(WEEK_TABLE_HEAD_WIDTH, 0, 0, 0);
|
||||
dayLine.StrokeThickness = WEEK_TABLE_HEAD_THICKNESS / 2;
|
||||
|
||||
can.Children.Add(dayLine);
|
||||
}
|
||||
|
||||
can.Children.Add(vertLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<Capability Name="ID_CAP_SPEECH_RECOGNITION" />
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name="_default" NavigationPage="Pages/TimeTable/TimetableDay.xaml" />
|
||||
<DefaultTask Name="_default" NavigationPage="Pages/TimeTable/TimetableWeek.xaml" />
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">
|
||||
|
||||
@@ -213,6 +213,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 Auf Startseite ähnelt.
|
||||
/// </summary>
|
||||
@@ -222,6 +231,15 @@ 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 Bachelor ähnelt.
|
||||
/// </summary>
|
||||
@@ -897,6 +915,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>
|
||||
|
||||
@@ -524,4 +524,13 @@
|
||||
<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>
|
||||
</root>
|
||||
Reference in New Issue
Block a user