appointment edit/create

This commit is contained in:
Christian Fiedler
2013-09-24 17:55:54 +02:00
parent 29efcd8ddb
commit cb9b2d62a4
5 changed files with 149 additions and 56 deletions

View File

@@ -136,6 +136,9 @@
<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>
@@ -460,6 +463,10 @@
<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>

View File

@@ -0,0 +1,40 @@
<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"
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.Appointment, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock 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>
</ScrollViewer>
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,27 @@
//-----------------------------------------------------------------------------
// <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;
public partial class AppointmentEdit : PhoneApplicationPage
{
public AppointmentEdit()
{
this.InitializeComponent();
}
}
}

View File

@@ -1,10 +1,15 @@
//-----------------------------------------------------------------------------
// <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.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@@ -13,7 +18,6 @@ namespace CampusAppWP8.Pages.TimeTable
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Utility;
using CampusAppWP8.Resources;
public partial class TimeTableDay : PhoneApplicationPage
@@ -72,7 +76,12 @@ namespace CampusAppWP8.Pages.TimeTable
{
base.OnNavigatedTo(e);
if (e.NavigationMode != NavigationMode.Back)
if (e.NavigationMode == NavigationMode.Back)
{
// only after edit/create/delete
//this.SetupItemPage(this.lastSelectedIndex, this.itemDate[this.lastSelectedIndex]);
}
else
{
double maxW = Application.Current.Host.Content.ActualWidth;
@@ -90,28 +99,13 @@ namespace CampusAppWP8.Pages.TimeTable
int indexToChange = 0;
/*
=>
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)
0<->1: 3
1<->2: 4
2<->3: 0
3<->4: 1
4<->0: 2
*/
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
if ((this.ThePivot.SelectedIndex == 0) && (this.lastSelectedIndex == (PIVOT_ITEM_PAGES - 1)))
@@ -162,7 +156,7 @@ namespace CampusAppWP8.Pages.TimeTable
for (int i = 0; i < this.appointmentStackList[stackIndex][listIndex].Count(); i++)
{
((this.itemPages[stackIndex].Content as ScrollViewer).Content as Canvas).Children.Remove(this.appointmentStackList[stackIndex][listIndex][i].Canvas);
this.RemoveContentUIElement(stackIndex, this.appointmentStackList[stackIndex][listIndex][i].Canvas);
if (i > 0)
{
@@ -174,9 +168,8 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
((this.itemPages[stackIndex].Content as ScrollViewer).Content as Canvas).Children.Remove(sender as Canvas);
this.RemoveContentUIElement(stackIndex, sender as Canvas);
this.DrawMultiBubble(
((this.itemPages[stackIndex].Content as ScrollViewer).Content as Canvas),
stackIndex,
listIndex,
this.appointmentStackList[stackIndex][listIndex].Count(),
@@ -211,6 +204,16 @@ namespace CampusAppWP8.Pages.TimeTable
page.NavigationService.Navigate(url);
}
private void AddContentUIElement(int index, UIElement elem)
{
(((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children[1] as Canvas).Children.Add(elem);
}
private void RemoveContentUIElement(int index, UIElement elem)
{
(((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children[1] as Canvas).Children.Remove(elem);
}
private void SetupItemPage(int index, DateTime date)
{
List<AppointmentModel> tempList = new List<AppointmentModel>();
@@ -318,8 +321,8 @@ namespace CampusAppWP8.Pages.TimeTable
}
this.DrawMultiBubble(
((this.itemPages[index].Content as ScrollViewer).Content as Canvas),
index, i,
index,
i,
this.appointmentStackList[index][i].Count(),
this.appointmentStackList[index][i][0].GetPosRight,
this.appointmentStackList[index][i][0].GetYOffset);
@@ -329,29 +332,37 @@ namespace CampusAppWP8.Pages.TimeTable
private void SetupItemPageBackground(PivotItem item)
{
ScrollViewer sv = null;
Canvas ca = null;
bool alreadyInit = false;
Canvas caContainer = null;
Canvas caContent = null;
Canvas caBackground = null;
if ((item.Content != null) && (item.Content.GetType().Equals(typeof(ScrollViewer)) == true)
&& ((item.Content as ScrollViewer).Content != null) && ((item.Content as ScrollViewer).Content.GetType().Equals(typeof(Canvas)) == true))
{
sv = item.Content as ScrollViewer;
ca = sv.Content as Canvas;
caContainer = sv.Content as Canvas;
sv.ScrollToVerticalOffset(0);
ca.Children.Clear();
alreadyInit = true;
caContent = caContainer.Children[1] as Canvas;
caContent.Children.Clear();
this.EventAutoScroll(sv, null);
}
else
{
sv = new ScrollViewer();
ca = new Canvas();
}
caContainer = new Canvas();
caContainer.Height = DAY_TABLE_CELL_HEIGHT * 24;
caContainer.Tag = "caContainer";
caContent = new Canvas();
caContent.Tag = "caContent";
caBackground = new Canvas();
caBackground.Tag = "caBackground";
this.DrawDayViewBackground(ca);
this.DrawDayViewBackground(caBackground);
if (alreadyInit == false)
{
sv.Content = ca;
caContainer.Children.Add(caBackground);
caContainer.Children.Add(caContent);
sv.Content = caContainer;
sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
item.Content = sv;
}
@@ -364,11 +375,12 @@ namespace CampusAppWP8.Pages.TimeTable
model.Canvas.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX - zIndex);
model.Canvas.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2 + (zIndex * DAY_TABLE_ZINDEX_SHIFT), model.GetYOffset, 0, 0);
model.SetWidth(this.itemPages[index].ActualWidth - (modelCount * DAY_TABLE_ZINDEX_SHIFT) - 6.0);
((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Add(model.Canvas);
this.AddContentUIElement(index, model.Canvas);
}
private void DrawMultiBubble(Canvas dayView, int stackIndex, int listIndex, int number, double xOffset, double yOffset)
private void DrawMultiBubble(int stackIndex, int listIndex, int number, double xOffset, double yOffset)
{
Canvas can = new Canvas();
Rectangle rect = new Rectangle();
@@ -398,7 +410,7 @@ namespace CampusAppWP8.Pages.TimeTable
can.SetValue(Canvas.TopProperty, yOffset);
can.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX + 1);
dayView.Children.Add(can);
this.AddContentUIElement(stackIndex, can);
}
private void DrawDayViewBackground(Canvas dayView)

View File

@@ -1,16 +1,23 @@
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;
//-----------------------------------------------------------------------------
// <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 };