daily commit
This commit is contained in:
@@ -206,8 +206,8 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
|
||||
return retValue;
|
||||
}
|
||||
/*
|
||||
private void OnCanvasClick(object sender, EventArgs e)
|
||||
|
||||
public void OnCanvasClick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.OnClick != null)
|
||||
{
|
||||
@@ -215,11 +215,6 @@ namespace CampusAppWP8.Model.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCanvasSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
// ------------------------------------------------------
|
||||
public string Title
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<phone:PhoneApplicationPage
|
||||
<page:PortraitLandscapePage
|
||||
x:Class="CampusAppWP8.Pages.TimeTable.AppointmentEdit"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -7,6 +7,7 @@
|
||||
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"
|
||||
xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
@@ -166,8 +167,8 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<page:PortraitLandscapePage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
</page:PortraitLandscapePage.ApplicationBar>
|
||||
</page:PortraitLandscapePage>
|
||||
@@ -20,8 +20,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Utility.ICSProperties;
|
||||
using CampusAppWP8.Utility.Lui.Page;
|
||||
|
||||
public partial class AppointmentEdit : PhoneApplicationPage
|
||||
public partial class AppointmentEdit : PortraitLandscapePage
|
||||
{
|
||||
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" };
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
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:20131022T113500Z\r\nDTEND;VALUE=DATE-TIME:20131022T212000Z\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: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:20131023T113500Z\r\nDTEND;VALUE=DATE-TIME:20131023T212000Z\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 welche einen etwas längeren titel enthält\r\nDESCRIPTION:Beschreibung des Termines\r\nCLASS:PUBLIC\r\nDTSTART:20131023T110000Z\r\nDTEND:20131024T113000Z\r\nDTSTAMP:20131003T125900Z\r\nPRIORITY:3\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:20131025T150000Z\r\nDTEND:20131025T170000Z\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"),
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<!--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" LoadingPivotItem="ThePivot_LoadedPivotItem">
|
||||
<phone:Pivot x:Name="ThePivot" SelectionChanged="OnPivotSelectionChanged">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="header" Visibility="Collapsed"/>
|
||||
|
||||
@@ -28,16 +28,11 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
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 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 int lastSelectedIndex = 0;
|
||||
|
||||
private ObservableCollection<WeekViewPageItem> itemList = new ObservableCollection<WeekViewPageItem>();
|
||||
@@ -230,9 +225,9 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAppointmentClick(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
private void OnAppointmentClick(AppointmentModel model)
|
||||
{
|
||||
int index = TimeTable.AppointmentsModel.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
|
||||
int index = TimeTable.AppointmentsModel.Appointments.IndexOf(model);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
@@ -315,19 +310,26 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
tempModel = e.NewItems[0] as AppointmentModel;
|
||||
|
||||
for (int i = 0; i < PIVOT_PAGES; i++)
|
||||
{
|
||||
if (tempModel.IsDate(this.itemList[i].FromDT, 4) >= 0)
|
||||
{
|
||||
tempModel.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Add(tempModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
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.itemList[i].FromDT, 4) > -1)
|
||||
if (this.itemList[i].AppointmentList.IndexOf(tempModel) >= 0)
|
||||
{
|
||||
this.SetupPage(i);
|
||||
tempModel.OnClick -= this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Remove(tempModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -341,6 +343,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
if (m.IsDate(this.itemList[i].FromDT, 4) >= 0)
|
||||
{
|
||||
m.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Add(m);
|
||||
}
|
||||
}
|
||||
@@ -620,27 +623,6 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
*/
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -683,10 +665,5 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
// this.itemPages[index].Content.Children.Add(can);
|
||||
}
|
||||
|
||||
private void ThePivot_LoadedPivotItem(object sender, PivotItemEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@
|
||||
SizeChanged="TheMainCanvas_SizeChanged">
|
||||
|
||||
<Rectangle x:Name="TheRect"
|
||||
Stroke="Gray"
|
||||
Stroke="{StaticResource PhoneForegroundBrush}"
|
||||
StrokeThickness="1"
|
||||
Fill="LightBlue"
|
||||
Fill="{StaticResource PhoneAccentBrush}"
|
||||
RadiusX="5"
|
||||
RadiusY="5"
|
||||
/>
|
||||
@@ -23,6 +23,7 @@
|
||||
FontSize="14"
|
||||
Padding="3"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="White"
|
||||
/>
|
||||
</Canvas>
|
||||
</UserControl>
|
||||
@@ -25,6 +25,7 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
{
|
||||
private static readonly double HOURS_SPACING = 40;
|
||||
private static readonly double INDEX_SPACING = 10;
|
||||
private static readonly int TOP_Z_INDEX = 10;
|
||||
|
||||
private static readonly SolidColorBrush[] PRIO_COLORS = new SolidColorBrush[]
|
||||
{
|
||||
@@ -55,7 +56,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
{
|
||||
this.appPtr = model;
|
||||
|
||||
this.Height = model.GetTotalHours(day) * HOURS_SPACING;
|
||||
double totalHours = model.GetTotalHours(day);
|
||||
|
||||
this.Height = ((totalHours < 0.25) ? 0.25 : totalHours) * HOURS_SPACING;
|
||||
this.SetText(model.Title);
|
||||
this.SetValue(Canvas.TopProperty, (day.Date.Equals(model.Start.Date)) ? (model.Start.TimeOfDay.TotalHours * HOURS_SPACING) : 0);
|
||||
|
||||
@@ -81,10 +84,16 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
this.Margin = new Thickness(
|
||||
(INDEX_SPACING * index),
|
||||
0,
|
||||
(INDEX_SPACING * count),
|
||||
(INDEX_SPACING * (count - 1)),
|
||||
0);
|
||||
|
||||
if (index > 0)
|
||||
|
||||
this.SetValue(Canvas.ZIndexProperty, ((TOP_Z_INDEX - index) < 0) ? 0 : (TOP_Z_INDEX - index));
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
this.Opacity = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Opacity = 0.5;
|
||||
}
|
||||
@@ -111,7 +120,19 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
|
||||
private void SetText(string text)
|
||||
{
|
||||
this.TheText.Text = text;
|
||||
if (this.Height < (HOURS_SPACING * 0.5))
|
||||
{
|
||||
this.TheText.Text = "...";
|
||||
this.TheText.Margin = new Thickness(
|
||||
0,
|
||||
this.Height - (HOURS_SPACING * 0.5),
|
||||
0,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.TheText.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetBGColorByPriority(int prio)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
x:Name="root">
|
||||
|
||||
<Grid x:Name="ContentRoot">
|
||||
<Grid x:Name="ContentRoot" Loaded="AutoScroll">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -48,20 +48,20 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Line Grid.Column="0" X1="0" Y1="0" X2="1" Y2="0" VerticalAlignment="Bottom" Stroke="White" Stretch="Fill" StrokeThickness="2" HorizontalAlignment="Left" Margin="-1,0,-1,0"/>
|
||||
<Border Grid.Column="1" BorderThickness="2" BorderBrush="White" Background="DarkGoldenrod">
|
||||
<Line Grid.Column="0" X1="0" Y1="0" X2="1" Y2="0" VerticalAlignment="Bottom" Stroke="{StaticResource PhoneForegroundBrush}" Stretch="Fill" StrokeThickness="2" HorizontalAlignment="Left" Margin="-1,0,-1,0"/>
|
||||
<Border Grid.Column="1" BorderThickness="2" BorderBrush="{StaticResource PhoneForegroundBrush}" Background="{StaticResource PhoneAccentBrush}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Monday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Column="2" BorderThickness="2" BorderBrush="White" Background="DarkGoldenrod">
|
||||
<Border Grid.Column="2" BorderThickness="2" BorderBrush="{StaticResource PhoneForegroundBrush}" Background="{StaticResource PhoneAccentBrush}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Tuesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Column="3" BorderThickness="2" BorderBrush="White" Background="DarkGoldenrod">
|
||||
<Border Grid.Column="3" BorderThickness="2" BorderBrush="{StaticResource PhoneForegroundBrush}" Background="{StaticResource PhoneAccentBrush}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Wednesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Column="4" BorderThickness="2" BorderBrush="White" Background="DarkGoldenrod">
|
||||
<Border Grid.Column="4" BorderThickness="2" BorderBrush="{StaticResource PhoneForegroundBrush}" Background="{StaticResource PhoneAccentBrush}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Thursday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<Border Grid.Column="5" BorderThickness="2" BorderBrush="White" Background="DarkGoldenrod">
|
||||
<Border Grid.Column="5" BorderThickness="2" BorderBrush="{StaticResource PhoneForegroundBrush}" Background="{StaticResource PhoneAccentBrush}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Friday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -70,7 +70,7 @@
|
||||
<Grid x:Name="TheGrid" Background="Transparent" Height="960">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="BorderBrush" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="2"/>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
@@ -94,13 +94,13 @@
|
||||
|
||||
<!--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 x:Name="TimeList" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
|
||||
<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"/>
|
||||
<Line X1="29" Y1="19" X2="39" Y2="19" StrokeThickness="2" Stroke="{StaticResource PhoneForegroundBrush}"/>
|
||||
<Line X1="0" Y1="0" X2="39" Y2="0" StrokeThickness="2" Stroke="{StaticResource PhoneForegroundBrush}"/>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
</lui:ListBoxFixed.ItemTemplate>
|
||||
|
||||
@@ -78,9 +78,19 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
|
||||
private void OnAppointmentListChanged(object s, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
for(int i = 0; i < e.NewItems.Count; i++)
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
this.SeperateAppointments(e.NewItems[i] as AppointmentModel);
|
||||
for (int i = 0; i < e.NewItems.Count; i++)
|
||||
{
|
||||
this.SeperateAppointments(e.NewItems[i] as AppointmentModel, e.Action);
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
for (int i = 0; i < e.OldItems.Count; i++)
|
||||
{
|
||||
this.SeperateAppointments(e.OldItems[i] as AppointmentModel, e.Action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,17 +98,24 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
{
|
||||
foreach (AppointmentModel m in list)
|
||||
{
|
||||
this.SeperateAppointments(m);
|
||||
this.SeperateAppointments(m, NotifyCollectionChangedAction.Add);
|
||||
}
|
||||
}
|
||||
|
||||
private void SeperateAppointments(AppointmentModel model)
|
||||
private void SeperateAppointments(AppointmentModel model, NotifyCollectionChangedAction action)
|
||||
{
|
||||
for(int i = 0; i < this.Days; i++)
|
||||
{
|
||||
if (model.IsDate(this.DateFrom.AddDays(i)) == 0)
|
||||
{
|
||||
this.dayList[i].Appointments.Add(model);
|
||||
if (action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
this.dayList[i].Appointments.Add(model);
|
||||
}
|
||||
else if (action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
this.dayList[i].Appointments.Remove(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,5 +229,10 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
|
||||
this.TimeList.ItemsSource = this.timeStrings;
|
||||
}
|
||||
|
||||
private void AutoScroll(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.TheScrollView.ScrollToVerticalOffset((40 * 7) + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,12 +62,15 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
{
|
||||
for (int i = 0; i < e.NewItems.Count; i++)
|
||||
{
|
||||
this.CheckForStack(e.NewItems[i] as AppointmentModel);
|
||||
this.CheckStackAdd(e.NewItems[i] as AppointmentModel);
|
||||
}
|
||||
}
|
||||
else if (e.Action == NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
for (int i = 0; i < e.OldItems.Count; i++)
|
||||
{
|
||||
this.CheckStackRemove(e.OldItems[i] as AppointmentModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,32 +140,190 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckForStack(AppointmentModel model)
|
||||
private void CheckStackAdd(AppointmentModel model)
|
||||
{
|
||||
int[] intersect = model.IntersectArray(this.Appointments.ToArray<AppointmentModel>());
|
||||
|
||||
if (intersect.Count() == 0)
|
||||
{
|
||||
this.DrawApp(model);
|
||||
this.DrawApp(model, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<int> intersecStack = new List<int>();
|
||||
|
||||
for (int i = 0; i < intersect.Count(); i++)
|
||||
{
|
||||
for (int s = 0; s < this.stacks.Count; s++)
|
||||
{
|
||||
if (this.stacks[s].IndexOf(this.Appointments[i]) >= 0)
|
||||
{
|
||||
intersecStack.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (intersecStack.Count == 0)
|
||||
{
|
||||
List<AppointmentModel> newStack = new List<AppointmentModel>();
|
||||
|
||||
for (int k = 0; k < intersect.Count(); k++)
|
||||
{
|
||||
newStack.Add(this.Appointments[intersect[k]]);
|
||||
}
|
||||
|
||||
newStack.Add(model);
|
||||
this.stacks.Add(newStack);
|
||||
|
||||
this.DrawStack(model, newStack);
|
||||
}
|
||||
else if (intersecStack.Count == 1)
|
||||
{
|
||||
this.stacks[intersecStack[0]].Add(model);
|
||||
this.DrawStack(model, this.stacks[intersecStack[0]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<AppointmentModel> newStack = new List<AppointmentModel>();
|
||||
List<List<AppointmentModel>> tempStackList = new List<List<AppointmentModel>>();
|
||||
|
||||
for (int k = 0; k < intersecStack.Count; k++)
|
||||
{
|
||||
tempStackList.Add(this.stacks[intersecStack[k]]);
|
||||
newStack.AddRange(this.stacks[intersecStack[k]]);
|
||||
}
|
||||
|
||||
newStack.Add(model);
|
||||
|
||||
for (int k = 0; k < tempStackList.Count; k++)
|
||||
{
|
||||
this.stacks.Remove(tempStackList[k]);
|
||||
}
|
||||
|
||||
this.stacks.Add(newStack);
|
||||
|
||||
this.DrawStack(model, newStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckStackRemove(AppointmentModel model)
|
||||
{
|
||||
int stackIndex = -1;
|
||||
|
||||
for (int i = 0; i < this.stacks.Count; i++)
|
||||
{
|
||||
if (this.stacks[i].IndexOf(model) >= 0)
|
||||
{
|
||||
stackIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackIndex >= 0)
|
||||
{
|
||||
this.stacks[stackIndex].Remove(model);
|
||||
|
||||
this.DrawStack(null, this.stacks[stackIndex]);
|
||||
|
||||
if (this.stacks[stackIndex].Count <= 1)
|
||||
{
|
||||
this.stacks.RemoveAt(stackIndex);
|
||||
}
|
||||
}
|
||||
|
||||
int removeIndex = -1;
|
||||
|
||||
for (int i = 0; i < this.UserCanvas.Children.Count; i++)
|
||||
{
|
||||
if ((this.UserCanvas.Children[i] as AppointmentCanvas).Is(model))
|
||||
{
|
||||
removeIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (removeIndex >= 0)
|
||||
{
|
||||
this.UserCanvas.Children.RemoveAt(removeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawStack(AppointmentModel newModel, List<AppointmentModel> stack)
|
||||
{
|
||||
for (int i = 0; i < stack.Count; i++)
|
||||
{
|
||||
if (stack[i].Equals(newModel))
|
||||
{
|
||||
this.DrawApp(newModel, stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ManipulateAppCanvas(stack[i], i, stack.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ManipulateAppCanvas(AppointmentModel model, int stackIndex)
|
||||
{
|
||||
if (stackIndex < this.stacks.Count)
|
||||
{
|
||||
this.ManipulateAppCanvas(model, this.stacks[stackIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
private void ManipulateAppCanvas(AppointmentModel model, List<AppointmentModel> list)
|
||||
{
|
||||
int index = list.IndexOf(model);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
this.ManipulateAppCanvas(model, index, list.Count);
|
||||
}
|
||||
}
|
||||
|
||||
private void ManipulateAppCanvas(AppointmentModel model, int index, int count)
|
||||
{
|
||||
AppointmentCanvas can = null;
|
||||
|
||||
for (int i = 0; i < this.UserCanvas.Children.Count; i++)
|
||||
{
|
||||
if ((this.UserCanvas.Children[i] as AppointmentCanvas).Is(model))
|
||||
{
|
||||
can = this.UserCanvas.Children[i] as AppointmentCanvas;
|
||||
}
|
||||
}
|
||||
|
||||
if (can != null)
|
||||
{
|
||||
can.SetListPosition(index, count);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawApp(AppointmentModel model, int stackIndex = -1)
|
||||
{
|
||||
if (stackIndex >= 0)
|
||||
{
|
||||
this.DrawApp(model, this.stacks[stackIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DrawApp(model, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawApp(AppointmentModel model, List<AppointmentModel> stack = null)
|
||||
{
|
||||
AppointmentCanvas newCan = new AppointmentCanvas(model, this.Date);
|
||||
|
||||
newCan.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(model.OnCanvasClick);
|
||||
|
||||
Binding widthBind = new Binding("ActualWidth");
|
||||
widthBind.ElementName = "MainCanvas";
|
||||
widthBind.Mode = BindingMode.OneWay;
|
||||
newCan.SetBinding(WidthProperty, widthBind);
|
||||
|
||||
if (stackIndex >= 0)
|
||||
if (stack != null)
|
||||
{
|
||||
newCan.SetListPosition(this.stacks[stackIndex]);
|
||||
newCan.SetListPosition(stack);
|
||||
}
|
||||
|
||||
this.UserCanvas.Children.Add(newCan);
|
||||
|
||||
Reference in New Issue
Block a user