diff --git a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
index 70dec60c..eb0ae0cd 100644
--- a/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/TimeTable/AppointmentModel.cs
@@ -25,13 +25,14 @@ namespace CampusAppWP8.Model.TimeTable
[XmlRoot("root")]
public class AppointmentModel
{
- public static readonly double DAY_HOUR_SPACING = 50;
+ private static double DAY_HOUR_SPACING = 50;
/// The Visual object.
private Rectangle rect = null;
private Canvas canvas = null;
private double offsetY = 0;
private double height = 0;
+ private double width = 100;
private ICalObject icalObj = null;
@@ -44,6 +45,7 @@ namespace CampusAppWP8.Model.TimeTable
this.rect = new Rectangle();
this.canvas = new Canvas();
this.canvas.DoubleTap += new EventHandler(this.OnCanvasClick);
+ this.canvas.SizeChanged += new SizeChangedEventHandler(this.OnCanvasSizeChanged);
}
public AppointmentModel(string icsData) : this()
@@ -51,9 +53,22 @@ namespace CampusAppWP8.Model.TimeTable
this.icalObj = ICSManager.ImportFromICS(icsData);
this.CalcYOffset();
+ this.CalcHeight();
this.CalcRect();
}
+ public static double HourSpacing
+ {
+ get
+ {
+ return DAY_HOUR_SPACING;
+ }
+ set
+ {
+ DAY_HOUR_SPACING = value;
+ }
+ }
+
public double GetYOffset
{
get
@@ -70,9 +85,16 @@ namespace CampusAppWP8.Model.TimeTable
}
}
- public Canvas GetCanvas()
+ public Canvas Canvas
{
- return this.canvas;
+ get
+ {
+ return this.canvas;
+ }
+ set
+ {
+ this.canvas = value;
+ }
}
public int IsDate(DateTime date, int daySpan = 0)
@@ -142,13 +164,26 @@ namespace CampusAppWP8.Model.TimeTable
return retValue;
}
+ public int[] IntersectArray(AppointmentModel[] modelList)
+ {
+ List retValue = new List();
+
+ for (int i = 0; i < modelList.Length; i++)
+ {
+ if (this.Equals(modelList[i]) == false && this.Intersect(modelList[i]) == true)
+ {
+ retValue.Add(i);
+ }
+ }
+
+ return retValue.ToArray();
+ }
+
private void CalcRect()
{
- this.CalcHeight();
+ this.canvas.Children.Clear();
- this.rect.Width = 200;
- this.rect.MinHeight = this.height;
- this.rect.MaxHeight = 600;
+ this.rect.Width = this.width;
this.rect.Height = this.height;
this.rect.StrokeThickness = 1;
@@ -166,7 +201,7 @@ namespace CampusAppWP8.Model.TimeTable
TextBlock txtTitle = new TextBlock();
txtTitle.Text = title.Value;
- txtTitle.FontSize = 12;
+ txtTitle.FontSize = DAY_HOUR_SPACING / 3;
txtTitle.FontWeight = FontWeights.Bold;
txtTitle.TextWrapping = TextWrapping.Wrap;
txtTitle.Width = this.rect.Width - 4.0;
@@ -233,6 +268,12 @@ namespace CampusAppWP8.Model.TimeTable
}
}
+ public void SetWidth(double maxWidth)
+ {
+ this.width = maxWidth - this.canvas.Margin.Left;
+ this.CalcRect();
+ }
+
private ICalObject GetVEventObj()
{
ICalObject retValue = this.icalObj.GetProperty(ICSTag.VEVENT) as ICalObject;
@@ -253,6 +294,11 @@ namespace CampusAppWP8.Model.TimeTable
}
}
+ private void OnCanvasSizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ //this.CalcRect();
+ }
+
// ------------------------------------------------------
public string Title
{
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
index 20bd4e27..9687ef9a 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTable.cs
@@ -33,6 +33,7 @@ namespace CampusAppWP8.Pages.TimeTable
});
public static int AutoScrollToHour = 7;
+ public static int VisualScale = 0; //0 - small, 1 - medium, 2 - large
public TimeTable()
{
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
index 49987eec..915b95d1 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs
@@ -18,9 +18,9 @@ namespace CampusAppWP8.Pages.TimeTable
public partial class TimeTableDay : PhoneApplicationPage
{
- private readonly double DAY_TABLE_HEAD_WIDTH = 48;
- private readonly double DAY_TABLE_HEAD_HALF = 8;
- private readonly double DAY_TABLE_CELL_HEIGHT = AppointmentModel.DAY_HOUR_SPACING;
+ private readonly double DAY_TABLE_HEAD_WIDTH = 48;// * (1 + (TimeTable.VisualScale / 4));
+ private readonly double DAY_TABLE_HEAD_HALF = 8;// * (1 + (TimeTable.VisualScale / 4));
+ private readonly double DAY_TABLE_CELL_HEIGHT = 72;// * (1 + (TimeTable.VisualScale / 2));
private readonly double DAY_TABLE_HEAD_THICKNESS = 2;
private readonly double DAY_TABLE_INNER_THICKNESS = 1;
private readonly double DAY_TABLE_ZINDEX_SHIFT = 10;
@@ -36,12 +36,13 @@ namespace CampusAppWP8.Pages.TimeTable
private int lastSelectedIndex = 0;
private List>[] appointmentStackList = new List>[PIVOT_ITEM_PAGES];
-
-
+
public TimeTableDay()
{
this.InitializeComponent();
+ AppointmentModel.HourSpacing = DAY_TABLE_CELL_HEIGHT;
+
for (int i = 0; i < PIVOT_ITEM_PAGES; i++)
{
this.appointmentStackList[i] = new List>();
@@ -151,15 +152,44 @@ namespace CampusAppWP8.Pages.TimeTable
private void EventOnMultiBubbleClick(object sender, System.Windows.Input.GestureEventArgs e)
{
- double width_s_1 = (this.itemPages[this.lastSelectedIndex].Content as ScrollViewer).ActualWidth;
- double width_s_2 = (this.itemPages[this.lastSelectedIndex].Content as ScrollViewer).Width;
- double width_c_1 = ((this.itemPages[this.lastSelectedIndex].Content as ScrollViewer).Content as Canvas).ActualWidth;
- double width_c_2 = ((this.itemPages[this.lastSelectedIndex].Content as ScrollViewer).Content as Canvas).Width;
+ int indexVal = (int)(sender as Canvas).Tag;
+ int stackIndex = indexVal >> 12;
+ int listIndex = indexVal & 0x00000FFF;
+
+ AppointmentModel tempModel = this.appointmentStackList[stackIndex][listIndex].First();
+ this.appointmentStackList[stackIndex][listIndex].Remove(tempModel);
+ this.appointmentStackList[stackIndex][listIndex].Add(tempModel);
+
+ 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);
+
+ if (i > 0)
+ {
+ this.DrawAppointmentModel(this.appointmentStackList[stackIndex][listIndex][i], stackIndex, 0.5, i, this.appointmentStackList[stackIndex][listIndex].Count() - 1 - i);
+ }
+ else
+ {
+ this.DrawAppointmentModel(this.appointmentStackList[stackIndex][listIndex][i], stackIndex, 1.0, i, this.appointmentStackList[stackIndex][listIndex].Count() - 1 - i);
+ }
+ }
+
+ ((this.itemPages[stackIndex].Content as ScrollViewer).Content as Canvas).Children.Remove(sender as Canvas);
+ this.DrawMultiBubble(
+ ((this.itemPages[stackIndex].Content as ScrollViewer).Content as Canvas),
+ stackIndex,
+ listIndex,
+ this.appointmentStackList[stackIndex][listIndex].Count(),
+ this.appointmentStackList[stackIndex][listIndex][0].GetPosRight,
+ this.appointmentStackList[stackIndex][listIndex][0].GetYOffset);
}
private void EventAutoScroll(object sender, RoutedEventArgs e)
{
- (sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
+ if ((sender as ScrollViewer).VerticalOffset == 0.0)
+ {
+ (sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
+ }
}
private void OnClickToDay(object sender, EventArgs e)
@@ -185,13 +215,10 @@ namespace CampusAppWP8.Pages.TimeTable
{
List tempList = new List();
+ this.appointmentStackList[index].Clear();
+
this.itemPages[index].Header = string.Format("{0:ddd dd.MM.yy}", date);
- 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++)
@@ -206,21 +233,25 @@ namespace CampusAppWP8.Pages.TimeTable
// -------------------------------------------------------------
for (int i = 0; i < tempList.Count(); i++)
{
- int intersectIndex = tempList[i].Intersect(tempList.ToArray());
+ int[] intersectIndex = tempList[i].IntersectArray(tempList.ToArray());
- if (intersectIndex > -1)
+ if (intersectIndex.Count() == 0)
+ {
+ this.DrawAppointmentModel(tempList[i], index);
+ }
+ else if (intersectIndex.Count() == 1)
{
int addIndex = -1;
- for(int k = 0; k < this.appointmentStackList[index].Count(); k++)
+ for (int k = 0; k < this.appointmentStackList[index].Count(); k++)
{
- if (this.appointmentStackList[index][k].IndexOf(tempList[intersectIndex]) >= 0)
+ if (this.appointmentStackList[index][k].IndexOf(tempList[intersectIndex[0]]) >= 0)
{
addIndex = k;
}
}
- if(addIndex >= 0)
+ if (addIndex >= 0)
{
this.appointmentStackList[index][addIndex].Add(tempList[i]);
}
@@ -233,7 +264,42 @@ namespace CampusAppWP8.Pages.TimeTable
}
else
{
- this.DrawAppointmentModel(tempList[i], index);
+ List> intersectLists = new List>();
+
+ for (int k = 0; k < intersectIndex.Count(); k++)
+ {
+ for (int m = 0; m < this.appointmentStackList[index].Count(); m++)
+ {
+ if (this.appointmentStackList[index][m].IndexOf(tempList[intersectIndex[k]]) > -1)
+ {
+ if(intersectLists.IndexOf(this.appointmentStackList[index][m]) < 0)
+ {
+ intersectLists.Add(this.appointmentStackList[index][m]);
+ }
+ }
+ }
+ }
+
+ if(intersectLists.Count() == 0)
+ {
+ List newList = new List();
+ newList.Add(tempList[i]);
+ this.appointmentStackList[index].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.appointmentStackList[index].Remove(intersectLists[k]);
+ }
+
+ intersectLists[0].Add(tempList[i]);
+ }
}
}
@@ -243,46 +309,65 @@ namespace CampusAppWP8.Pages.TimeTable
{
if (k > 0)
{
- this.DrawAppointmentModel(this.appointmentStackList[index][i][k], index, 0.5, k);
+ this.DrawAppointmentModel(this.appointmentStackList[index][i][k], index, 0.5, k, this.appointmentStackList[index][i].Count() - 1 - k);
}
else
{
- this.DrawAppointmentModel(this.appointmentStackList[index][i][k], index);
+ this.DrawAppointmentModel(this.appointmentStackList[index][i][k], index, 1.0, k, this.appointmentStackList[index][i].Count() - 1 - k);
}
}
-/*
+
this.DrawMultiBubble(
((this.itemPages[index].Content as ScrollViewer).Content as Canvas),
- index,
+ index, i,
this.appointmentStackList[index][i].Count(),
this.appointmentStackList[index][i][0].GetPosRight,
this.appointmentStackList[index][i][0].GetYOffset);
-*/
}
}
private void SetupItemPageBackground(PivotItem item)
{
- ScrollViewer sv = new ScrollViewer();
- Canvas ca = new Canvas();
+ ScrollViewer sv = null;
+ Canvas ca = null;
+ bool alreadyInit = false;
+
+ 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;
+ sv.ScrollToVerticalOffset(0);
+ ca.Children.Clear();
+ alreadyInit = true;
+ }
+ else
+ {
+ sv = new ScrollViewer();
+ ca = new Canvas();
+ }
+
this.DrawDayViewBackground(ca);
-
- sv.Content = ca;
- sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
- item.Content = sv;
+
+ if (alreadyInit == false)
+ {
+ sv.Content = ca;
+ sv.Loaded += new RoutedEventHandler(this.EventAutoScroll);
+ item.Content = sv;
+ }
}
- private void DrawAppointmentModel(AppointmentModel model, int index, double opacity = 1.0, int zIndex = 0)
+ private void DrawAppointmentModel(AppointmentModel model, int index, double opacity = 1.0, int zIndex = 0, int modelCount = 0)
{
model.OnClick += new AppointmentModel.OnAppointmentClick(this.EventOnAppointmentClick);
- Canvas temp = model.GetCanvas();
- temp.Opacity = opacity;
- temp.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX - zIndex);
- temp.Margin = new Thickness(DAY_TABLE_HEAD_WIDTH + 2 + (zIndex * DAY_TABLE_ZINDEX_SHIFT), model.GetYOffset, 0, 0);
- ((this.itemPages[index].Content as ScrollViewer).Content as Canvas).Children.Add(temp);
+ model.Canvas.Opacity = opacity;
+ 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);
}
- private void DrawMultiBubble(Canvas dayView, int stackIndex, int number, double xOffset, double yOffset)
+ private void DrawMultiBubble(Canvas dayView, int stackIndex, int listIndex, int number, double xOffset, double yOffset)
{
Canvas can = new Canvas();
@@ -293,7 +378,7 @@ namespace CampusAppWP8.Pages.TimeTable
rect.RadiusY = DAY_TABLE_CELL_HEIGHT / 4;
rect.StrokeThickness = 1;
rect.Stroke = new SolidColorBrush(Colors.DarkGray);
- rect.Fill = new SolidColorBrush(Colors.Blue);
+ rect.Fill = new SolidColorBrush(Colors.Black);
TextBlock block = new TextBlock();
block.Height = DAY_TABLE_CELL_HEIGHT / 2;
@@ -308,7 +393,7 @@ namespace CampusAppWP8.Pages.TimeTable
can.Children.Add(rect);
can.Children.Add(block);
can.Tap += new EventHandler(this.EventOnMultiBubbleClick);
- can.Tag = stackIndex;
+ can.Tag = (stackIndex << 12) | (listIndex & 0x00000FFF);
can.SetValue(Canvas.LeftProperty, xOffset - rect.Width);
can.SetValue(Canvas.TopProperty, yOffset);
can.SetValue(Canvas.ZIndexProperty, DAY_TABLE_ZINDEX_MAX + 1);
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml
index 2948828c..02482620 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml
@@ -29,28 +29,22 @@
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
index 2c8030bb..e7d04980 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableProperties.xaml.cs
@@ -7,15 +7,19 @@ using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
+using CampusAppWP8.Resources;
namespace CampusAppWP8.Pages.TimeTable
{
public partial class TimeTableProperties : PhoneApplicationPage
{
+ public string[] VisualScaleText = new string[] { AppResources.Small, AppResources.Medium, AppResources.Large };
+
public TimeTableProperties()
{
this.InitializeComponent();
+ // AutoScroll
string[] tempAutoScroll = new string[25];
for (int i = 0; i < 24; i++)
@@ -25,6 +29,10 @@ namespace CampusAppWP8.Pages.TimeTable
this.AutoScroll.ItemsSource = tempAutoScroll;
this.AutoScroll.SelectedIndex = TimeTable.AutoScrollToHour;
+
+ // VisualSize
+ this.VisualScale.ItemsSource = VisualScaleText;
+ this.VisualScale.SelectedIndex = TimeTable.VisualScale;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
@@ -32,6 +40,7 @@ namespace CampusAppWP8.Pages.TimeTable
base.OnNavigatedFrom(e);
TimeTable.AutoScrollToHour = this.AutoScroll.SelectedIndex;
+ TimeTable.VisualScale = this.VisualScale.SelectedIndex;
}
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index 4552b3ef..c6e2f938 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -348,6 +348,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die groß ähnelt.
+ ///
+ public static string Large {
+ get {
+ return ResourceManager.GetString("Large", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
///
@@ -483,6 +492,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Autoscrollauswahl ähnelt.
+ ///
+ public static string ListPickerHeaderAutoScroll {
+ get {
+ return ResourceManager.GetString("ListPickerHeaderAutoScroll", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Campusauswahl ähnelt.
///
@@ -528,6 +546,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Anzeigegrößenauswahl ähnelt.
+ ///
+ public static string ListPickerHeaderVisualScale {
+ get {
+ return ResourceManager.GetString("ListPickerHeaderVisualScale", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Webmail ähnelt.
///
@@ -537,6 +564,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die mittel ähnelt.
+ ///
+ public static string Medium {
+ get {
+ return ResourceManager.GetString("Medium", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die 84 ähnelt.
///
@@ -996,6 +1032,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die klein ähnelt.
+ ///
+ public static string Small {
+ get {
+ return ResourceManager.GetString("Small", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
///
@@ -1095,6 +1140,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Anzeige Größe ähnelt.
+ ///
+ public static string VisualScale {
+ get {
+ return ResourceManager.GetString("VisualScale", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Willkommen zur BTU-CampusApp WP8 ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 7d66714a..ea1bb039 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -467,4 +467,22 @@
Einstellungen
+
+ groß
+
+
+ Autoscrollauswahl
+
+
+ Anzeigegrößenauswahl
+
+
+ mittel
+
+
+ klein
+
+
+ Anzeige Größe
+
\ No newline at end of file