This commit is contained in:
Christian Fiedler
2013-09-23 14:00:05 +02:00
parent 5f7a563f26
commit 3ce33a803b
8 changed files with 228 additions and 50 deletions

View File

@@ -140,6 +140,9 @@
<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="Utility\ICalObject.cs" />
<Compile Include="Utility\ICSClasses.cs" />
<Compile Include="Utility\ICSManager.cs" />
@@ -461,6 +464,10 @@
<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\Webmail\WebmailPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@@ -109,6 +109,8 @@ namespace CampusAppWP8.Model.TimeTable
this.rect.StrokeThickness = 1;
this.rect.Stroke = new SolidColorBrush(Colors.DarkGray);
this.rect.Fill = new SolidColorBrush(Colors.Green);
this.rect.RadiusX = 10;
this.rect.RadiusY = 10;
this.canvas.Children.Add(this.rect);
@@ -123,8 +125,8 @@ namespace CampusAppWP8.Model.TimeTable
txtTitle.FontWeight = FontWeights.Bold;
txtTitle.TextWrapping = TextWrapping.Wrap;
txtTitle.Width = this.rect.Width - 4.0;
txtTitle.SetValue(Canvas.LeftProperty, 2.0);
txtTitle.SetValue(Canvas.TopProperty, 2.0);
txtTitle.SetValue(Canvas.LeftProperty, 5.0);
txtTitle.SetValue(Canvas.TopProperty, 5.0);
/*
Description desc = eventObj.GetProperty(ICSTag.DESCRIPTION) as Description;

View File

@@ -31,6 +31,8 @@ namespace CampusAppWP8.Pages.TimeTable
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")
});
public static int AutoScrollToHour = 7;
public TimeTable()
{
//this.InitializeComponent();
@@ -38,11 +40,6 @@ namespace CampusAppWP8.Pages.TimeTable
TimeTable.appList = new AppointmentListModel();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
}
public static AppointmentListModel AppointmentsModel
{
get

View File

@@ -25,11 +25,9 @@ namespace CampusAppWP8.Pages.TimeTable
private readonly double DAY_TABLE_INNER_THICKNESS = 1;
private static readonly int PIVOT_ITEM_PAGES = 5;
private static readonly int PIVOT_ITEM_PAGES_HALF_UP = 3;
//private static readonly int PIVOT_ITEM_PAGES_HALF_UP = 4;
private static readonly int PIVOT_ITEM_PAGES_HALF_DOWN = 2;
private bool DayLayoutDone = false;
private PivotItem[] itemPages = new PivotItem[PIVOT_ITEM_PAGES];
private DateTime[] itemDate = new DateTime[PIVOT_ITEM_PAGES];
private DateTime itemPage_0_Day = DateTime.Now.AddDays(PIVOT_ITEM_PAGES_HALF_DOWN * -1);
@@ -44,7 +42,6 @@ namespace CampusAppWP8.Pages.TimeTable
{
this.itemPages[i] = new PivotItem();
this.itemDate[i] = itemPage_0_Day.AddDays(i);
this.SetupItemPageBackground(this.itemPages[i], this.itemDate[i]);
this.ThePivot.Items.Add(this.itemPages[i]);
}
@@ -57,6 +54,12 @@ namespace CampusAppWP8.Pages.TimeTable
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);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -74,45 +77,56 @@ namespace CampusAppWP8.Pages.TimeTable
this.SetupItemPage(i, this.itemDate[i]);
}
}
this.DayLayoutDone = true;
}
private void EventPivotSelectionChanged(object sender, SelectionChangedEventArgs e)
{
int[] indexToChange = new int[2];
int indexToChange = 0;
/*
0: 2,3
1: 3,4
2: 4,0
3: 0,1
4: 1,2
=>
0->1: 3
1->2: 4
2->3: 0
3->4: 1
4->0: 2
<=
4<-0: 2
3<-4: 1
2<-3: 0
1<-2: 4
0<-1: 3
*
*
(0)1 2|3 4
0(1)2 3|4
0 1(2)3 4|
0|1 2(3)4
0 1|2 3(4)
*/
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
if ((this.ThePivot.SelectedIndex == 0) && (this.lastSelectedIndex == (PIVOT_ITEM_PAGES - 1)))
{
delta = 1;
}
else if ((this.ThePivot.SelectedIndex == (PIVOT_ITEM_PAGES - 1)) && (this.lastSelectedIndex == 0))
{
delta = -1;
}
if (Math.Abs(delta) > 1)
{
delta = (delta < 0) ? -1 : 1;
}
indexToChange[0] = (this.ThePivot.SelectedIndex + PIVOT_ITEM_PAGES_HALF_DOWN) % PIVOT_ITEM_PAGES;
indexToChange[1] = (indexToChange[0] + 1) % PIVOT_ITEM_PAGES;
for (int i = 0; i < indexToChange.Count(); i++)
{
if (delta < 0)
{
this.itemDate[indexToChange[1 - i]] = this.itemDate[this.ThePivot.SelectedIndex].AddDays(delta * (PIVOT_ITEM_PAGES_HALF_DOWN + i));
this.SetupItemPage(indexToChange[1 - i], this.itemDate[indexToChange[1 - i]]);
}
else
{
this.itemDate[indexToChange[i]] = this.itemDate[this.ThePivot.SelectedIndex].AddDays(delta * (PIVOT_ITEM_PAGES_HALF_DOWN + i));
this.SetupItemPage(indexToChange[i], this.itemDate[indexToChange[i]]);
}
}
indexToChange = (this.ThePivot.SelectedIndex + PIVOT_ITEM_PAGES + (PIVOT_ITEM_PAGES_HALF_DOWN * delta)) % PIVOT_ITEM_PAGES;
this.itemDate[indexToChange] = this.itemDate[this.ThePivot.SelectedIndex].AddDays(delta * PIVOT_ITEM_PAGES_HALF_DOWN);
this.SetupItemPage(indexToChange, this.itemDate[indexToChange]);
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
}
@@ -130,6 +144,16 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
private void EventOnMultiBubbleClick(int stackID)
{
}
private void EventAutoScroll(object sender, RoutedEventArgs e)
{
(sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
}
private void OnClickToDay(object sender, EventArgs e)
{
this.itemPage_0_Day = DateTime.Now.AddDays(PIVOT_ITEM_PAGES_HALF_DOWN * -1);
@@ -142,24 +166,23 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
private void AutoScrollToDay(object sender, EventArgs e)
private void OnClickProperties(object sender, EventArgs e)
{
if (this.DayLayoutDone == true)
{
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
{
(this.itemPages[i].Content as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * 7);
}
this.DayLayoutDone = false;
//this.DayScroll.LayoutUpdated -= this.AutoScrollToDay;
}
Uri url = new Uri("/Pages/TimeTable/TimeTableProperties.xaml", UriKind.Relative);
Page page = App.RootFrame.Content as Page;
page.NavigationService.Navigate(url);
}
private void SetupItemPage(int index, DateTime date)
{
this.itemPages[index].Header = string.Format("{0:ddd dd.MM.yy}", date);
((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Clear();
if (this.itemPages[index].Content != null)
{
((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Clear();
}
this.SetupItemPageBackground(this.itemPages[index]);
for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
{
@@ -170,7 +193,7 @@ namespace CampusAppWP8.Pages.TimeTable
TimeTable.AppointmentsModel.Appointments[i].OnClick += new AppointmentModel.OnAppointmentClick(this.EventOnAppointmentClick);
Canvas temp = TimeTable.AppointmentsModel.Appointments[i].GetCanvas();
temp.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2, TimeTable.AppointmentsModel.Appointments[i].GetYOffset, 0, 0);
// ((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Add(temp);
((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Add(temp);
/*
temp = this.testMod2.GetCanvas();
@@ -181,17 +204,46 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
private void SetupItemPageBackground(PivotItem item, DateTime date)
private void SetupItemPageBackground(PivotItem item)
{
ScrollViewer sv = new ScrollViewer();
Canvas ca = new Canvas();
this.DrawDayViewBackground(ca);
sv.Content = ca;
sv.LayoutUpdated += new EventHandler(this.AutoScrollToDay);
sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
item.Content = sv;
}
private void DrawMultiBubble(Canvas dayView, int stackIndex, int number, int yOffset)
{
Canvas can = new Canvas();
Rectangle rect = new Rectangle();
rect.Width = 50;
rect.Height = 50;
rect.RadiusX = 25;
rect.RadiusY = 25;
rect.StrokeThickness = 1;
rect.Stroke = new SolidColorBrush(Colors.DarkGray);
rect.Fill = new SolidColorBrush(Colors.Blue);
TextBlock block = new TextBlock();
block.Text = "" + number;
block.HorizontalAlignment = HorizontalAlignment.Center;
block.VerticalAlignment = VerticalAlignment.Center;
block.Height = 50;
block.Width = 50;
block.FontWeight = FontWeights.Bold;
can.Children.Add(rect);
can.Children.Add(block);
// can.
// .DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(this.OnCanvasClick);
dayView.Children.Add(can);
}
private void DrawDayViewBackground(Canvas dayView)
{
dayView.Height = DAY_TABLE_CELL_HEIGHT * 24;

View File

@@ -0,0 +1,59 @@
<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="Portrait" 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">
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="0">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.AutoScrollToHour, Source={StaticResource LocalizedStrings}}"/>
<!-- Listpicket of courses -->
<toolkit:ListPicker Name="AutoScroll" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
<!--
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Text}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
-->
</toolkit:ListPicker>
</StackPanel>
</Border>
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,37 @@
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;
namespace CampusAppWP8.Pages.TimeTable
{
public partial class TimeTableProperties : PhoneApplicationPage
{
public TimeTableProperties()
{
this.InitializeComponent();
string[] tempAutoScroll = new string[25];
for (int i = 0; i < 24; i++)
{
tempAutoScroll[i] = "" + i;
}
this.AutoScroll.ItemsSource = tempAutoScroll;
this.AutoScroll.SelectedIndex = TimeTable.AutoScrollToHour;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
TimeTable.AutoScrollToHour = this.AutoScroll.SelectedIndex;
}
}
}

View File

@@ -105,6 +105,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <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 Gebäude ähnelt.
/// </summary>
@@ -798,6 +807,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>

View File

@@ -461,4 +461,10 @@
<data name="ScarNfc_Search" xml:space="preserve">
<value>Bitte halten Sie das Handy vor dem NFC-Tag</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>
</root>