DayView done
This commit is contained in:
@@ -142,6 +142,7 @@
|
||||
<Compile Include="Pages\TimeTable\AppointmentEdit.xaml.cs">
|
||||
<DependentUpon>AppointmentEdit.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\TimeTable\DayViewPageItem.cs" />
|
||||
<Compile Include="Pages\TimeTable\TimeTable.cs" />
|
||||
<Compile Include="Pages\TimeTable\TimeTableDay.xaml.cs">
|
||||
<DependentUpon>TimeTableDay.xaml</DependentUpon>
|
||||
@@ -153,6 +154,7 @@
|
||||
<DependentUpon>TimeTableWeek.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\TimeTable\WeekViewPageItem.cs" />
|
||||
<Compile Include="Utility\DoubleNaNConverter.cs" />
|
||||
<Compile Include="Utility\ICalObject.cs" />
|
||||
<Compile Include="Utility\ICSClasses.cs" />
|
||||
<Compile Include="Utility\ICSManager.cs" />
|
||||
|
||||
73
CampusAppWP8/CampusAppWP8/Pages/TimeTable/DayViewPageItem.cs
Normal file
73
CampusAppWP8/CampusAppWP8/Pages/TimeTable/DayViewPageItem.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Utility.Lui.Templates;
|
||||
|
||||
public class DayViewPageItem : INotifyPropertyChanged
|
||||
{
|
||||
private DateTime day;
|
||||
private WeekView weekView = null;
|
||||
private ObservableCollection<AppointmentModel> appointmentList = null;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public DayViewPageItem(DateTime day)
|
||||
{
|
||||
this.day = day;
|
||||
this.appointmentList = new ObservableCollection<AppointmentModel>();
|
||||
}
|
||||
|
||||
public DateTime Day
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.day;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.day = value;
|
||||
this.NotifyPropertyChanged("Day");
|
||||
}
|
||||
}
|
||||
|
||||
public WeekView View
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.weekView;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.weekView = value;
|
||||
this.NotifyPropertyChanged("View");
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<AppointmentModel> AppointmentList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.appointmentList;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.appointmentList = value;
|
||||
this.NotifyPropertyChanged("AppointmentList");
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyPropertyChanged(string info)
|
||||
{
|
||||
if (this.PropertyChanged != null)
|
||||
{
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(info));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
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:templ="clr-namespace:CampusAppWP8.Utility.Lui.Templates"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
@@ -16,11 +17,26 @@
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<phone:Pivot x:Name="ThePivot" Title="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Day, Mode=OneWay, StringFormat='ddd dd.MM.yy'}"/>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<templ:WeekView
|
||||
x:Name="TheWeekView"
|
||||
Margin="0,-36,0,0"
|
||||
DateFrom="{Binding Path=Day, Mode=OneWay}"
|
||||
Appointments="{Binding Path=AppointmentList, Mode=OneWay}"
|
||||
Days="1"
|
||||
HeadVisible="False"/>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0"/>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -34,14 +35,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
private static readonly int PIVOT_ITEM_PAGES = 5;
|
||||
private static readonly int PIVOT_ITEM_PAGES_HALF_DOWN = 2;
|
||||
|
||||
private struct PageItem
|
||||
{
|
||||
public Canvas Content { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public List<List<AppointmentModel>> Stacks { get; set; }
|
||||
}
|
||||
|
||||
private PageItem[] itemPages = new PageItem[PIVOT_ITEM_PAGES];
|
||||
private ObservableCollection<DayViewPageItem> itemList = new ObservableCollection<DayViewPageItem>();
|
||||
|
||||
private int lastSelectedIndex = 0;
|
||||
|
||||
@@ -53,12 +47,13 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
|
||||
{
|
||||
this.itemPages[i].Stacks = new List<List<AppointmentModel>>();
|
||||
this.CreatePage(i, firstDay.AddDays(i));
|
||||
DayViewPageItem newItem = new DayViewPageItem(firstDay);
|
||||
|
||||
this.itemList.Add(newItem);
|
||||
|
||||
firstDay = firstDay.AddDays(1);
|
||||
}
|
||||
|
||||
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
|
||||
this.ThePivot.SelectionChanged += new SelectionChangedEventHandler(this.EventPivotSelectionChanged);
|
||||
|
||||
ApplicationBarIconButton weekBtn = new ApplicationBarIconButton();
|
||||
@@ -96,8 +91,11 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ThePivot.ItemsSource = this.itemList;
|
||||
this.lastSelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
|
||||
this.CheckAppointments();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +110,6 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
3<->4: 1
|
||||
4<->0: 2
|
||||
*/
|
||||
|
||||
int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex;
|
||||
|
||||
if(delta < -1) delta = 1;
|
||||
@@ -124,25 +121,24 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.itemPages[indexToChange].Date = this.itemPages[this.ThePivot.SelectedIndex].Date.AddDays(delta * PIVOT_ITEM_PAGES_HALF_DOWN);
|
||||
}
|
||||
|
||||
this.SetupPage(indexToChange);
|
||||
this.itemList[indexToChange].Day = this.itemList[this.ThePivot.SelectedIndex].Day.AddDays(delta * PIVOT_ITEM_PAGES_HALF_DOWN);
|
||||
this.itemList[indexToChange].AppointmentList.Clear();
|
||||
|
||||
this.CheckAppointments(indexToChange);
|
||||
|
||||
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
|
||||
}
|
||||
|
||||
private void OnAppointmentClick(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
private void OnAppointmentClick(AppointmentModel model)
|
||||
{
|
||||
int index = TimeTable.Feed.Model.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
|
||||
int index = TimeTable.Feed.Model.Appointments.IndexOf(model);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
|
||||
string urlString = "/Pages/TimeTable/Appointment.xaml?" + Constants.Param_Appointment_Index + "=" + index;
|
||||
string urlString = Constants.PathTimeTable_Appointment + "?" + Constants.Param_Appointment_Index + "=" + index;
|
||||
|
||||
Uri url = new Uri(urlString, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
@@ -152,6 +148,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
private void EventOnMultiBubbleClick(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
/*
|
||||
int indexVal = (int)(sender as Canvas).Tag;
|
||||
int index = indexVal >> 12;
|
||||
int listIndex = indexVal & 0x00000FFF;
|
||||
@@ -184,14 +181,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
this.itemPages[index].Stacks[listIndex].Count(),
|
||||
tempCan.Width + tempCan.Margin.Left,
|
||||
tempCan.Margin.Top);
|
||||
}
|
||||
|
||||
private void EventAutoScroll(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if ((sender as ScrollViewer).VerticalOffset == 0.0)
|
||||
{
|
||||
(sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.Setting_AutoScrollToHour);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void OnClickWeek(object sender, EventArgs e)
|
||||
@@ -203,6 +193,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
private void OnClickToDay(object sender, EventArgs e)
|
||||
{
|
||||
/*
|
||||
DateTime firstDay = DateTime.Now.Date.AddDays(PIVOT_ITEM_PAGES_HALF_DOWN * -1);
|
||||
this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN;
|
||||
|
||||
@@ -212,6 +203,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
this.SetupPage(i);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void OnClickProperties(object sender, EventArgs e)
|
||||
@@ -232,6 +224,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
|
||||
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
/*
|
||||
AppointmentModel tempModel = null;
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
@@ -253,236 +246,42 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void AddContentUIElement(int index, UIElement elem)
|
||||
private void CheckAppointments(int index = -1)
|
||||
{
|
||||
this.itemPages[index].Content.Children.Add(elem);
|
||||
}
|
||||
|
||||
private void RemoveContentUIElement(int index, UIElement elem)
|
||||
{
|
||||
this.itemPages[index].Content.Children.Remove(elem);
|
||||
}
|
||||
|
||||
private void RemoveContentUIElement(int index, AppointmentModel model)
|
||||
{
|
||||
Canvas tempCan = this.GetModelCanvasFromContent(index, model);
|
||||
|
||||
if (tempCan != null)
|
||||
if (index < 0)
|
||||
{
|
||||
this.RemoveContentUIElement(index, tempCan);
|
||||
}
|
||||
}
|
||||
|
||||
private Canvas GetModelCanvasFromContent(int index, AppointmentModel model)
|
||||
{
|
||||
Canvas retValue = null;
|
||||
|
||||
foreach (Canvas tempCan in this.itemPages[index].Content.Children)
|
||||
{
|
||||
if (tempCan.Tag.GetType().Equals(typeof(AppointmentModel)))
|
||||
for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
|
||||
{
|
||||
if ((tempCan.Tag as AppointmentModel).Equals(model))
|
||||
AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
|
||||
|
||||
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
|
||||
{
|
||||
retValue = tempCan;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private void SetupPage(int index)
|
||||
{
|
||||
// Header
|
||||
|
||||
(this.ThePivot.Items[index] as PivotItem).Header = string.Format("{0:ddd dd.MM.yy}", this.itemPages[index].Date);
|
||||
|
||||
// Items
|
||||
|
||||
List<AppointmentModel> tempList = new List<AppointmentModel>();
|
||||
|
||||
this.itemPages[index].Stacks.Clear();
|
||||
this.itemPages[index].Content.Children.Clear();
|
||||
|
||||
for (int i = 0; i < TimeTable.Feed.Model.Appointments.Count(); i++)
|
||||
{
|
||||
int appointmentIndex = -1;
|
||||
|
||||
if ((appointmentIndex = TimeTable.Feed.Model.Appointments[i].IsDate(this.itemPages[index].Date)) > -1)
|
||||
{
|
||||
tempList.Add(TimeTable.Feed.Model.Appointments[i]);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------
|
||||
for (int i = 0; i < tempList.Count(); i++)
|
||||
{
|
||||
int[] intersectIndex = tempList[i].IntersectArray(tempList.ToArray());
|
||||
|
||||
if (intersectIndex.Count() == 0)
|
||||
{
|
||||
this.DrawAppointmentModel(tempList[i], index);
|
||||
}
|
||||
else if (intersectIndex.Count() == 1)
|
||||
{
|
||||
int addIndex = -1;
|
||||
|
||||
for (int k = 0; k < this.itemPages[index].Stacks.Count(); k++)
|
||||
{
|
||||
if(this.itemPages[index].Stacks[k].IndexOf(tempList[intersectIndex[0]]) > -1)
|
||||
if (temp.IsDate(this.itemList[i].Day) == 0)
|
||||
{
|
||||
addIndex = k;
|
||||
temp.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[i].AppointmentList.Add(temp);
|
||||
}
|
||||
}
|
||||
|
||||
if (addIndex >= 0)
|
||||
{
|
||||
this.itemPages[index].Stacks[addIndex].Add(tempList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
newList.Add(tempList[i]);
|
||||
this.itemPages[index].Stacks.Add(newList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<List<AppointmentModel>> intersectLists = new List<List<AppointmentModel>>();
|
||||
|
||||
for (int k = 0; k < intersectIndex.Count(); k++)
|
||||
{
|
||||
for (int m = 0; m < this.itemPages[index].Stacks.Count(); m++)
|
||||
{
|
||||
if (this.itemPages[index].Stacks[m].IndexOf(tempList[intersectIndex[k]]) > -1)
|
||||
{
|
||||
if(intersectLists.IndexOf(this.itemPages[index].Stacks[m]) < 0)
|
||||
{
|
||||
intersectLists.Add(this.itemPages[index].Stacks[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(intersectLists.Count() == 0)
|
||||
{
|
||||
List<AppointmentModel> newList = new List<AppointmentModel>();
|
||||
newList.Add(tempList[i]);
|
||||
this.itemPages[index].Stacks.Add(newList);
|
||||
}
|
||||
else if(intersectLists.Count() == 1)
|
||||
{
|
||||
intersectLists[0].Add(tempList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int k = 1; k < intersectLists.Count(); k++)
|
||||
{
|
||||
intersectLists[0].AddRange(intersectLists[k].ToArray());
|
||||
this.itemPages[index].Stacks.Remove(intersectLists[k]);
|
||||
}
|
||||
|
||||
intersectLists[0].Add(tempList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.itemPages[index].Stacks.Count(); i++)
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < this.itemPages[index].Stacks[i].Count(); k++)
|
||||
for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
|
||||
{
|
||||
if (k > 0)
|
||||
AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
|
||||
|
||||
if (temp.IsDate(this.itemList[index].Day) == 0)
|
||||
{
|
||||
this.DrawAppointmentModel(this.itemPages[index].Stacks[i][k], index, 0.5, k, this.itemPages[index].Stacks[i].Count() - 1 - k);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DrawAppointmentModel(this.itemPages[index].Stacks[i][k], index, 1.0, k, this.itemPages[index].Stacks[i].Count() - 1 - k);
|
||||
temp.OnClick += this.OnAppointmentClick;
|
||||
this.itemList[index].AppointmentList.Add(temp);
|
||||
}
|
||||
}
|
||||
|
||||
Canvas tempCan = this.GetModelCanvasFromContent(index, this.itemPages[index].Stacks[i][0]);
|
||||
|
||||
this.DrawMultiBubble(
|
||||
index,
|
||||
i,
|
||||
this.itemPages[index].Stacks[i].Count(),
|
||||
tempCan.Width + tempCan.Margin.Left,
|
||||
tempCan.Margin.Top);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCanvasSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (e.NewSize.Width.Equals(e.PreviousSize.Width) == false)
|
||||
{
|
||||
Canvas tempContainer = (sender as Canvas);
|
||||
Canvas tempBG = (tempContainer.Children[0] as Canvas);
|
||||
Canvas tempContent = (tempContainer.Children[1] as Canvas);
|
||||
tempBG.Width = e.NewSize.Width;
|
||||
tempBG.Height = e.NewSize.Height;
|
||||
tempContent.Width = e.NewSize.Width;
|
||||
tempContent.Height = e.NewSize.Height;
|
||||
|
||||
PivotItem pvItem = ((tempContainer.Parent as ScrollViewer).Parent as PivotItem);
|
||||
int index = this.ThePivot.Items.IndexOf(pvItem);
|
||||
|
||||
this.DrawBackground(tempBG);
|
||||
|
||||
this.SetupPage(index);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreatePage(int index, DateTime date)
|
||||
{
|
||||
this.itemPages[index].Content = new Canvas();
|
||||
this.itemPages[index].Content.Height = DAY_TABLE_CELL_HEIGHT * 24;
|
||||
this.itemPages[index].Date = date;
|
||||
|
||||
ScrollViewer sv = new ScrollViewer();
|
||||
sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
|
||||
Canvas container = new Canvas();
|
||||
container.Height = DAY_TABLE_CELL_HEIGHT * 24;
|
||||
Canvas canBG = new Canvas();
|
||||
canBG.Height = DAY_TABLE_CELL_HEIGHT * 24;
|
||||
PivotItem pvItem = new PivotItem();
|
||||
|
||||
container.Children.Add(canBG);
|
||||
container.Children.Add(this.itemPages[index].Content);
|
||||
container.SizeChanged += new SizeChangedEventHandler(this.OnCanvasSizeChanged);
|
||||
sv.Content = container;
|
||||
pvItem.Content = sv;
|
||||
|
||||
this.ThePivot.Items.Add(pvItem);
|
||||
}
|
||||
|
||||
private void DrawAppointmentCanvas(Canvas modelCan, int index, double opacity = 1.0, int zIndex = 0, int modelCount = 0)
|
||||
{
|
||||
modelCan.Opacity = opacity;
|
||||
modelCan.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX - zIndex);
|
||||
modelCan.Margin = new Thickness(
|
||||
(DAY_TABLE_HEAD_WIDTH + 2 + (zIndex * DAY_TABLE_ZINDEX_SHIFT)),
|
||||
modelCan.Margin.Top,
|
||||
0,
|
||||
0);
|
||||
this.AddContentUIElement(index, modelCan);
|
||||
}
|
||||
|
||||
private void DrawAppointmentModel(AppointmentModel model, int index, double opacity = 1.0, int zIndex = 0, int modelCount = 0)
|
||||
{
|
||||
/* TODO
|
||||
Canvas modelCan = model.GetCanvas(
|
||||
((this.itemPages[index].Content.Width - DAY_TABLE_HEAD_WIDTH) - 2 - 2 - (modelCount * DAY_TABLE_ZINDEX_SHIFT)),
|
||||
DAY_TABLE_CELL_HEIGHT,
|
||||
this.itemPages[index].Date.Date);
|
||||
|
||||
modelCan.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(this.OnAppointmentClick);
|
||||
|
||||
this.DrawAppointmentCanvas(modelCan, index, opacity, zIndex, modelCount);
|
||||
*/
|
||||
}
|
||||
|
||||
private void DrawMultiBubble(int stackIndex, int listIndex, int number, double xOffset, double yOffset)
|
||||
{
|
||||
Canvas can = new Canvas();
|
||||
@@ -514,79 +313,7 @@ namespace CampusAppWP8.Pages.TimeTable
|
||||
can.SetValue(Canvas.TopProperty, yOffset);
|
||||
can.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX + 1);
|
||||
|
||||
this.AddContentUIElement(stackIndex, can);
|
||||
}
|
||||
|
||||
private void DrawBackground(Canvas dayView)
|
||||
{
|
||||
Line vertLine = new Line();
|
||||
vertLine.X1 = 0;
|
||||
vertLine.Y1 = 0;
|
||||
vertLine.X2 = 0;
|
||||
vertLine.Y2 = (DAY_TABLE_CELL_HEIGHT * 24);
|
||||
vertLine.Stroke = new SolidColorBrush(Colors.White);
|
||||
vertLine.Stretch = Stretch.Fill;
|
||||
vertLine.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
vertLine.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH, 0, 0, 0);
|
||||
vertLine.StrokeThickness = DAY_TABLE_HEAD_THICKNESS;
|
||||
|
||||
for (int i = 0; i <= 24; i++)
|
||||
{
|
||||
// lines
|
||||
Line hLineHead = new Line();
|
||||
hLineHead.X1 = 0;
|
||||
hLineHead.Y1 = 0;
|
||||
hLineHead.X2 = DAY_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, (DAY_TABLE_CELL_HEIGHT * i), 0, 0);
|
||||
hLineHead.StrokeThickness = DAY_TABLE_HEAD_THICKNESS;
|
||||
|
||||
Line hLineHalf = new Line();
|
||||
hLineHalf.X1 = 0;
|
||||
hLineHalf.Y1 = 0;
|
||||
hLineHalf.X2 = DAY_TABLE_HEAD_HALF;
|
||||
hLineHalf.Y2 = 0;
|
||||
hLineHalf.Stroke = new SolidColorBrush(Colors.Gray);
|
||||
hLineHalf.Stretch = Stretch.Fill;
|
||||
hLineHalf.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
hLineHalf.Margin = new Thickness((DAY_TABLE_HEAD_WIDTH - DAY_TABLE_HEAD_HALF), (DAY_TABLE_CELL_HEIGHT * i) + (DAY_TABLE_CELL_HEIGHT / 2), 0, 0);
|
||||
hLineHalf.StrokeThickness = DAY_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(DAY_TABLE_HEAD_WIDTH, (DAY_TABLE_CELL_HEIGHT * i), 0, 0);
|
||||
hLineInn.StrokeDashArray = new DoubleCollection();
|
||||
hLineInn.StrokeDashArray.Add(2);
|
||||
hLineInn.StrokeDashArray.Add(4);
|
||||
hLineInn.StrokeThickness = DAY_TABLE_INNER_THICKNESS;
|
||||
|
||||
dayView.Children.Add(hLineHead);
|
||||
dayView.Children.Add(hLineInn);
|
||||
|
||||
if (i < 24)
|
||||
{
|
||||
dayView.Children.Add(hLineHalf);
|
||||
|
||||
// text
|
||||
TextBlock timeStamp = new TextBlock();
|
||||
timeStamp.Text = i.ToString("00") + ":00";
|
||||
timeStamp.Margin = new Thickness(0, (DAY_TABLE_CELL_HEIGHT * i) + 2, 0, 0);
|
||||
timeStamp.FontSize = DAY_TABLE_CELL_HEIGHT / 4;
|
||||
|
||||
dayView.Children.Add(timeStamp);
|
||||
}
|
||||
}
|
||||
|
||||
dayView.Children.Add(vertLine);
|
||||
//this.AddContentUIElement(stackIndex, can);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,9 @@
|
||||
DateFrom="{Binding Path=FromDT, Mode=OneWay}"
|
||||
WeekName="{Binding Path=WeekStr, Mode=OneWay}"
|
||||
Appointments="{Binding Path=AppointmentList, Mode=OneWay}"
|
||||
WeekNumber="{Binding Path=WeekNr, Mode=OneWay}"/>
|
||||
WeekNumber="{Binding Path=WeekNr, Mode=OneWay}"
|
||||
Days="5"
|
||||
ToDayColoring="True"/>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
|
||||
22
CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs
Normal file
22
CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
|
||||
public sealed class DoubleNaNConverter : IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
return (value is double && value.Equals(double.NaN) == false) ? value : 0.0;
|
||||
}
|
||||
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
return (value is double && value.Equals(double.NaN) == false) ? value : 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,17 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:weekView="clr-namespace:CampusAppWP8.Utility.Lui.Templates"
|
||||
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui"
|
||||
xmlns:conv="clr-namespace:CampusAppWP8.Utility"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
x:Name="root">
|
||||
|
||||
<UserControl.Resources>
|
||||
<conv:BoolToVisibilityConverter x:Key="VisConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="ContentRoot" Loaded="AutoScroll">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -18,7 +23,7 @@
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid x:Name="Head_Date" Grid.Row="0">
|
||||
<Grid x:Name="Head_Date" Grid.Row="0" Visibility="{Binding HeadVisible, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -37,32 +42,90 @@
|
||||
<TextBlock Grid.Column="5" Text=">" HorizontalAlignment="Center" FontSize="20"/>
|
||||
<TextBlock x:Name="TB_To" Grid.Column="6" Text="{Binding DateTo, ElementName=root, Mode=OneWay, StringFormat='dd.MM.yyyy'}" HorizontalAlignment="Center" FontSize="20"/>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="Head_Days" Grid.Row="1">
|
||||
|
||||
<Grid x:Name="Head_Days" Grid.Row="1" Visibility="{Binding HeadVisible, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="40"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="40" x:Name="Col_H_0"/>
|
||||
<!--Mon-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_1"/>
|
||||
<!--Tue-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_2"/>
|
||||
<!--Wed-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_3"/>
|
||||
<!--Thu-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_4"/>
|
||||
<!--Fri-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_5"/>
|
||||
<!--Sat-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_6"/>
|
||||
<!--Sun-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_H_7"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--__-->
|
||||
<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"/>
|
||||
<!--Mon-->
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_1_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Monday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<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"/>
|
||||
<!--Tue-->
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_2_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Tuesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<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"/>
|
||||
<!--Wed-->
|
||||
<Border
|
||||
Grid.Column="3"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_3_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Wednesday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<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"/>
|
||||
<!--Thu-->
|
||||
<Border
|
||||
Grid.Column="4"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_4_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Thursday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<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"/>
|
||||
<!--Fri-->
|
||||
<Border
|
||||
Grid.Column="5"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_5_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Friday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Sat-->
|
||||
<Border
|
||||
Grid.Column="6"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_6_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Saturday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--Sun-->
|
||||
<Border
|
||||
Grid.Column="7"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Visibility="{Binding Day_7_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Time_Day_Sunday_Short, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -90,6 +153,10 @@
|
||||
<ColumnDefinition Width="*" x:Name="Col_4"/>
|
||||
<!--friday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_5"/>
|
||||
<!--saturday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_6"/>
|
||||
<!--sunday-->
|
||||
<ColumnDefinition Width="*" x:Name="Col_7"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--time line-->
|
||||
@@ -107,25 +174,33 @@
|
||||
</lui:ListBoxFixed>
|
||||
</Border>
|
||||
<!--monday-->
|
||||
<Border x:Name="MonBorder" Grid.Row="0" Grid.Column="1">
|
||||
<Border x:Name="MonBorder" Grid.Row="0" Grid.Column="1" Visibility="{Binding Day_1_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="MonList" BgListElements="24" BgListElementHeight="40"/>
|
||||
</Border>
|
||||
<!--tuesday-->
|
||||
<Border x:Name="TueBorder" Grid.Row="0" Grid.Column="2">
|
||||
<Border x:Name="TueBorder" Grid.Row="0" Grid.Column="2" Visibility="{Binding Day_2_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="TueList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--wednesday-->
|
||||
<Border x:Name="WedBorder" Grid.Row="0" Grid.Column="3">
|
||||
<Border x:Name="WedBorder" Grid.Row="0" Grid.Column="3" Visibility="{Binding Day_3_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="WedList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--thursday-->
|
||||
<Border x:Name="ThuBorder" Grid.Row="0" Grid.Column="4">
|
||||
<Border x:Name="ThuBorder" Grid.Row="0" Grid.Column="4" Visibility="{Binding Day_4_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="ThuList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--friday-->
|
||||
<Border x:Name="FriBorder" Grid.Row="0" Grid.Column="5">
|
||||
<Border x:Name="FriBorder" Grid.Row="0" Grid.Column="5" Visibility="{Binding Day_5_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="FriList" BgListElements="24" BgListElementHeight="40" />
|
||||
</Border>
|
||||
<!--saturday-->
|
||||
<Border x:Name="SatBorder" Grid.Row="0" Grid.Column="6" Visibility="{Binding Day_6_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="SatList" BgListElements="24" BgListElementHeight="40"/>
|
||||
</Border>
|
||||
<!--sunday-->
|
||||
<Border x:Name="SunBorder" Grid.Row="0" Grid.Column="7" Visibility="{Binding Day_7_Visibility, ElementName=root, Converter={StaticResource VisConverter}}">
|
||||
<weekView:WeekViewDay x:Name="SunList" BgListElements="24" BgListElementHeight="40"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
/// <summary> The week number property. </summary>
|
||||
public static readonly DependencyProperty WeekNumberProperty = DependencyProperty.Register("WeekNumber", typeof(int), typeof(WeekView), new PropertyMetadata(-1));
|
||||
|
||||
public static readonly DependencyProperty HeadVisibleProperty = DependencyProperty.Register("HeadVisible", typeof(bool), typeof(WeekView), new PropertyMetadata(true));
|
||||
|
||||
public static readonly DependencyProperty ToDayColoringProperty = DependencyProperty.Register("ToDayColoring", typeof(bool), typeof(WeekView), new PropertyMetadata(false));
|
||||
|
||||
/// <summary> List of borders. </summary>
|
||||
private List<Border> borderList = new List<Border>();
|
||||
/// <summary> List of days. </summary>
|
||||
@@ -68,15 +72,18 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
(o as WeekView).dayList[i].Date = ((DateTime)e.NewValue).AddDays(i);
|
||||
}
|
||||
|
||||
TimeSpan diff = DateTime.Today.Subtract((o as WeekView).DateFrom);
|
||||
if ((o as WeekView).ToDayColoring == true)
|
||||
{
|
||||
TimeSpan diff = DateTime.Today.Subtract((o as WeekView).DateFrom);
|
||||
|
||||
if (diff.TotalDays >= 0 && diff.TotalDays < 5)
|
||||
{
|
||||
(o as WeekView).SetColumnBackground(diff.Days, new SolidColorBrush(Colors.Orange));
|
||||
}
|
||||
else
|
||||
{
|
||||
(o as WeekView).ClearBackground();
|
||||
if (diff.TotalDays >= 0 && diff.TotalDays < 5)
|
||||
{
|
||||
(o as WeekView).SetColumnBackground(diff.Days, new SolidColorBrush(Colors.Orange));
|
||||
}
|
||||
else
|
||||
{
|
||||
(o as WeekView).ClearBackground();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +265,130 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
}
|
||||
}
|
||||
|
||||
public bool HeadVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return (bool)this.GetValue(HeadVisibleProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(HeadVisibleProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ToDayColoring
|
||||
{
|
||||
get
|
||||
{
|
||||
return (bool)this.GetValue(ToDayColoringProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(ToDayColoringProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_1_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 0) && (this.Col_1.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_1.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_1.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 0);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_2_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 1) && (this.Col_2.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_2.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_2.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 1);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_3_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 2) && (this.Col_3.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_3.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_3.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 2);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_4_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 3) && (this.Col_4.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_4.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_4.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 3);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_5_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 4) && (this.Col_5.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_5.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_5.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 4);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_6_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 5) && (this.Col_6.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_6.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_6.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 5);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Day_7_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.Days <= 6) && (this.Col_7.Width.IsAuto == false))
|
||||
{
|
||||
this.Col_7.Width = new GridLength(0, GridUnitType.Auto);
|
||||
this.Col_H_7.Width = new GridLength(0, GridUnitType.Auto);
|
||||
}
|
||||
|
||||
return (this.Days > 6);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Sets column background. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="column"> The column. </param>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:utility="clr-namespace:CampusAppWP8.Utility"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
@@ -10,7 +11,11 @@
|
||||
x:Name="root"
|
||||
>
|
||||
|
||||
<Grid x:Name="TheGrid">
|
||||
<UserControl.Resources>
|
||||
<utility:DoubleNaNConverter x:Key="NaNConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="TheGrid" Width="{Binding Path=Width, ElementName=root, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
@@ -27,13 +32,13 @@
|
||||
x:Name="BGCanvas"
|
||||
Canvas.ZIndex="1"
|
||||
Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=ActualWidth, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=Width, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}"
|
||||
/>
|
||||
<Canvas
|
||||
x:Name="UserCanvas"
|
||||
Canvas.ZIndex="2"
|
||||
Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=ActualWidth, ElementName=MainCanvas, Mode=OneWay}"
|
||||
Width="{Binding Path=Width, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}"
|
||||
/>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Data;
|
||||
using CampusAppWP8.Model.TimeTable;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary> A week view day. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
@@ -51,6 +52,13 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
this.Appointments = new ObservableCollection<AppointmentModel>();
|
||||
|
||||
this.InitializeComponent();
|
||||
|
||||
this.TheGrid.SizeChanged += new SizeChangedEventHandler(this.TheGridSizeChanged);
|
||||
}
|
||||
|
||||
private void TheGridSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
this.MainCanvas.Width = e.NewSize.Width;
|
||||
}
|
||||
|
||||
/// <summary> Raises the dependency property changed event. </summary>
|
||||
@@ -112,6 +120,8 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary> Gets or sets the Date/Time of the date. </summary>
|
||||
/// <value> The date. </value>
|
||||
public DateTime Date
|
||||
@@ -374,8 +384,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
|
||||
newCan.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(model.OnCanvasClick);
|
||||
|
||||
Binding widthBind = new Binding("ActualWidth");
|
||||
widthBind.ElementName = "MainCanvas";
|
||||
Binding widthBind = new Binding("Width");
|
||||
widthBind.ElementName = "UserCanvas";
|
||||
widthBind.Converter = new DoubleNaNConverter();
|
||||
widthBind.Mode = BindingMode.OneWay;
|
||||
newCan.SetBinding(WidthProperty, widthBind);
|
||||
|
||||
@@ -387,6 +398,8 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
this.UserCanvas.Children.Add(newCan);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary> Un draw application. </summary>
|
||||
/// <remarks> Fiedler, 06.11.2013. </remarks>
|
||||
/// <param name="model"> The model. </param>
|
||||
@@ -408,6 +421,13 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
protected override void OnDoubleTap(System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
base.OnDoubleTap(e);
|
||||
}
|
||||
*/
|
||||
|
||||
/// <summary> Draw lines. </summary>
|
||||
/// <remarks> Fiedler, 22.10.2013. </remarks>
|
||||
private void DrawLines()
|
||||
@@ -418,8 +438,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
|
||||
this.BGCanvas.Children.Clear();
|
||||
|
||||
Binding colLineBind = new Binding();
|
||||
colLineBind.Path = new PropertyPath("ActualWidth");
|
||||
colLineBind.ElementName = "MainCanvas";
|
||||
colLineBind.Path = new PropertyPath("Width");
|
||||
colLineBind.ElementName = "BGCanvas";
|
||||
colLineBind.Converter = new DoubleNaNConverter();
|
||||
colLineBind.Mode = BindingMode.OneWay;
|
||||
|
||||
for (int i = 1; i < this.BgListElements; i++)
|
||||
|
||||
Reference in New Issue
Block a user