daily commit

This commit is contained in:
Christian Fiedler
2013-11-04 19:14:32 +01:00
parent f1cf9cdefb
commit c225d3b9be
16 changed files with 347 additions and 138 deletions

View File

@@ -102,6 +102,7 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Feed\TimeTable\AppointmentFeed.cs" />
<Compile Include="File\Departments\DepartmentFavoriteFile.cs" />
<Compile Include="Const.cs" />
<Compile Include="Feed\Exams\ExamFeed.cs" />

View File

@@ -0,0 +1,111 @@
namespace CampusAppWP8.Feed.TimeTable
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using CampusAppWP8.Model;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Model.TimeTable;
using CampusAppWPortalLib8.Model;
public class AppointmentFeed : XmlModel<AppointmentListModel>
{
public AppointmentFeed(bool autoLoad = true)
: base(ModelType.File, Constants.FileAppointments_Name)
{
this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
if (autoLoad == true)
{
this.LoadData();
}
}
private bool CheckIsModelUpToDate(AppointmentListModel model)
{
bool retValue = true;
if (model == null)
{
retValue = false;
}
return retValue;
}
private bool CheckIsFileUpToDateOnLoad(AppointmentListModel model, FileInfo info)
{
bool retValue = true;
return retValue;
}
private bool CheckIsFileUpToDateOnSave(AppointmentListModel model, FileInfo info)
{
bool retValue = true;
if ((info == null)
|| (info.Exists == false)
|| (info.Length == 0))
{
retValue = false;
}
if (model != null && model.HasChanged(true))
{
retValue = false;
}
return retValue;
}
protected override bool DeserializeModel(byte[] modelData)
{
if (this.Model == null)
{
this.Model = new AppointmentListModel();
}
string temp = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
string[] appStr = Regex.Split(temp, "</appointment>");
for (int i = 0; i < appStr.Length; i++)
{
if (appStr.Length > 0)
{
appStr[i] = appStr[i].Replace("<appointment>", string.Empty);
AppointmentModel newAppModel = new AppointmentModel(appStr[i]);
this.Model.Appointments.Add(newAppModel);
}
}
return true;
}
protected override byte[] SerializeModel()
{
List<byte> retValue = new List<byte>();
if (this.Model != null)
{
for (int i = 0; i < this.Model.Appointments.Count; i++)
{
retValue.AddRange(Encoding.UTF8.GetBytes("<appointment>"));
retValue.AddRange(ICSManager.ExportToICSByte(this.Model.Appointments[i].CalendarObj));
retValue.AddRange(Encoding.UTF8.GetBytes("</appointment>"));
}
}
return retValue.ToArray();
}
}
}

View File

@@ -24,17 +24,17 @@ namespace CampusAppWP8.Model.TimeTable
/// <summary>
/// Model for appointments.
/// </summary>
[XmlRoot("root")]
public class AppointmentListModel
{
private ObservableCollection<AppointmentModel> appointmentList;
private int hasChangedIndex = -1;
private bool hasChanged = false;
/// <summary>Initializes a new instance of the <see cref="AppointmentModel" /> class. </summary>
public AppointmentListModel()
{
this.appointmentList = new ObservableCollection<AppointmentModel>();
this.appointmentList.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnCollectionChanged);
this.appointmentList.CollectionChanged += this.OnCollectionChanged;
}
// for testing
@@ -50,7 +50,6 @@ namespace CampusAppWP8.Model.TimeTable
}
}
public ObservableCollection<AppointmentModel> Appointments
{
get
@@ -60,7 +59,17 @@ namespace CampusAppWP8.Model.TimeTable
set
{
if(this.appointmentList != null)
{
this.appointmentList.CollectionChanged -= this.OnCollectionChanged;
}
this.appointmentList = value;
if(this.appointmentList != null)
{
this.appointmentList.CollectionChanged += this.OnCollectionChanged;
}
}
}
@@ -74,12 +83,28 @@ namespace CampusAppWP8.Model.TimeTable
}
}
public bool HasChanged(bool reset = false)
{
bool retValue = false;
retValue = this.hasChanged;
if(reset == true)
{
this.hasChanged = false;
}
return retValue;
}
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
this.hasChangedIndex = e.NewStartingIndex;
}
this.hasChanged = true;
}
}
}

View File

@@ -22,7 +22,6 @@ namespace CampusAppWP8.Model.TimeTable
/// <summary>
/// Model for appointments.
/// </summary>
[XmlRoot("root")]
public class AppointmentModel
{
private ICalObject icalObj = null;
@@ -52,6 +51,19 @@ namespace CampusAppWP8.Model.TimeTable
this.icalObj = ICSManager.ImportFromICS(icsData);
}
public ICalObject CalendarObj
{
get
{
return this.icalObj;
}
set
{
this.icalObj = value;
}
}
public int IsDate(DateTime date, int daySpan = 0)
{
int retValue = -1;

View File

@@ -48,7 +48,7 @@ namespace CampusAppWP8.Pages.TimeTable
if (e.NavigationMode == NavigationMode.Back)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
this.DataContext = this.appModel;
}
else
@@ -61,10 +61,10 @@ namespace CampusAppWP8.Pages.TimeTable
int appointmentIndex = int.Parse(appointmentIndexStr);
// if the index is in the range of the array
if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
if ((appointmentIndex >= 0) && (appointmentIndex < TimeTable.Feed.Model.Appointments.Count()))
{
this.appModel = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
this.DataContext = TimeTable.AppointmentsModel.Appointments[appointmentIndex];
this.appModel = TimeTable.Feed.Model.Appointments[appointmentIndex];
this.DataContext = TimeTable.Feed.Model.Appointments[appointmentIndex];
}
else
{
@@ -93,9 +93,9 @@ namespace CampusAppWP8.Pages.TimeTable
{
if (this.appModel != null)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = "/Pages/TimeTable/AppointmentEdit.xaml?" + Constants.Param_Appointment_Index + "=" + TimeTable.AppointmentsModel.Appointments.IndexOf(this.appModel);
string urlString = "/Pages/TimeTable/AppointmentEdit.xaml?" + Constants.Param_Appointment_Index + "=" + TimeTable.Feed.Model.Appointments.IndexOf(this.appModel);
Uri url = new Uri(urlString, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
@@ -105,7 +105,7 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnClickDelete(object sender, EventArgs e)
{
TimeTable.AppointmentsModel.Appointments.Remove(this.appModel);
TimeTable.Feed.Model.Appointments.Remove(this.appModel);
this.NavigationService.GoBack();
}
}

View File

@@ -68,11 +68,11 @@ namespace CampusAppWP8.Pages.TimeTable
this.appointmentIndex = int.Parse(appointmentIndexStr);
// if the index is in the range of the array
if ((this.appointmentIndex >= 0) && (this.appointmentIndex < TimeTable.AppointmentsModel.Appointments.Count()))
if ((this.appointmentIndex >= 0) && (this.appointmentIndex < TimeTable.Feed.Model.Appointments.Count()))
{
this.HeadLine.Text = AppResources.Edit;
//this.DataContext = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
AppointmentModel tempModel = TimeTable.AppointmentsModel.Appointments[this.appointmentIndex];
AppointmentModel tempModel = TimeTable.Feed.Model.Appointments[this.appointmentIndex];
this.InTitle.Text = tempModel.Title;
this.InLocation.Text = tempModel.Location;
@@ -230,10 +230,10 @@ namespace CampusAppWP8.Pages.TimeTable
if (this.appointmentIndex >= 0)
{
TimeTable.AppointmentsModel.Appointments.RemoveAt(this.appointmentIndex);
TimeTable.Feed.Model.Appointments.RemoveAt(this.appointmentIndex);
}
TimeTable.AppointmentsModel.Appointments.Add(newItem);
TimeTable.Feed.Model.Appointments.Add(newItem);
Page page = App.RootFrame.Content as Page;
page.NavigationService.GoBack();

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages.TimeTable
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
@@ -19,6 +20,7 @@ namespace CampusAppWP8.Pages.TimeTable
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Feed.TimeTable;
public partial class TimeTable : PhoneApplicationPage
{
@@ -32,21 +34,57 @@ namespace CampusAppWP8.Pages.TimeTable
new AppointmentModel("BEGIN:VCALENDAR\r\nPRODID:-//bobbin v0.1//NONSGML iCal Writer//EN\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nDTSTART:20130914T120000Z\r\nDTEND:20130914T140000Z\r\nDTSTAMP:20091130T213238Z\r\nUID:1285935469767a7c7c1a9b3f0df8003a@yoursever.com\r\nCREATED:20091130T213238Z\r\nDESCRIPTION:Example event 1\r\nLAST-MODIFIED:20091130T213238Z\r\nSEQUENCE:0\r\nSTATUS:CONFIRMED\r\nSUMMARY:Example event 1\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR")
});
public static int AutoScrollToHour = 7;
public static int VisualScale = 0; //0 - small, 1 - medium, 2 - large
public static int Setting_AutoScrollToHour = 7;
public static int Setting_VisualScale = 0; //0 - small, 1 - medium, 2 - large UNUSED ATM
public static double Setting_Hour_Spacing = 40;
public static double Setting_View_Height = Setting_Hour_Spacing * 24;
public static int Setting_Max_Z_Index = 10;
public static double Setting_Z_Spacing = 10;
public static SolidColorBrush[] Setting_Priority_Colors = new SolidColorBrush[]
{
new SolidColorBrush(Colors.Green),
new SolidColorBrush(Colors.Orange),
new SolidColorBrush(Colors.Blue),
new SolidColorBrush(Colors.Brown),
new SolidColorBrush(Colors.Cyan),
new SolidColorBrush(Colors.DarkGray),
new SolidColorBrush(Colors.Magenta),
new SolidColorBrush(Colors.Purple),
new SolidColorBrush(Colors.Yellow),
new SolidColorBrush(Colors.Red)
};
public TimeTable()
{
//this.InitializeComponent();
TimeTable.appList = new AppointmentListModel();
}
private static AppointmentFeed feed = null;
public static AppointmentListModel AppointmentsModel
public static AppointmentFeed Feed
{
get
{
return TimeTable.appList;
if (TimeTable.feed == null)
{
throw new NullReferenceException();
}
return TimeTable.feed;
}
}
public static void InitFeed()
{
if(TimeTable.feed == null)
{
TimeTable.feed = new AppointmentFeed(false);
TimeTable.feed.OnFailedFile += new CampusAppWPortalLib8.Model.AbstractMainModel<AppointmentListModel>.OnFailed(TimeTable.OnLoadFailed);
TimeTable.feed.LoadData();
}
}
private static void OnLoadFailed()
{
if (TimeTable.feed.Model == null)
{
TimeTable.feed.Model = new AppointmentListModel();
}
}
}

View File

@@ -92,7 +92,7 @@ namespace CampusAppWP8.Pages.TimeTable
if (e.NavigationMode == NavigationMode.Back)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
}
else
{
@@ -136,11 +136,11 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnAppointmentClick(object sender, System.Windows.Input.GestureEventArgs e)
{
int index = TimeTable.AppointmentsModel.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
int index = TimeTable.Feed.Model.Appointments.IndexOf((sender as Canvas).Tag as AppointmentModel);
if (index >= 0)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = "/Pages/TimeTable/Appointment.xaml?" + Constants.Param_Appointment_Index + "=" + index;
@@ -190,7 +190,7 @@ namespace CampusAppWP8.Pages.TimeTable
{
if ((sender as ScrollViewer).VerticalOffset == 0.0)
{
(sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
(sender as ScrollViewer).ScrollToVerticalOffset(DAY_TABLE_CELL_HEIGHT * TimeTable.Setting_AutoScrollToHour);
}
}
@@ -223,7 +223,7 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnClickAdd(object sender, EventArgs e)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
Uri url = new Uri("/Pages/TimeTable/AppointmentEdit.xaml", UriKind.Relative);
Page page = App.RootFrame.Content as Page;
@@ -306,13 +306,13 @@ namespace CampusAppWP8.Pages.TimeTable
this.itemPages[index].Stacks.Clear();
this.itemPages[index].Content.Children.Clear();
for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
for (int i = 0; i < TimeTable.Feed.Model.Appointments.Count(); i++)
{
int appointmentIndex = -1;
if ((appointmentIndex = TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemPages[index].Date)) > -1)
if ((appointmentIndex = TimeTable.Feed.Model.Appointments[i].IsDate(this.itemPages[index].Date)) > -1)
{
tempList.Add(TimeTable.AppointmentsModel.Appointments[i]);
tempList.Add(TimeTable.Feed.Model.Appointments[i]);
}
}
// -------------------------------------------------------------

View File

@@ -35,19 +35,19 @@ namespace CampusAppWP8.Pages.TimeTable
}
this.AutoScroll.ItemsSource = tempAutoScroll;
this.AutoScroll.SelectedIndex = TimeTable.AutoScrollToHour;
this.AutoScroll.SelectedIndex = TimeTable.Setting_AutoScrollToHour;
// VisualSize
this.VisualScale.ItemsSource = VisualScaleText;
this.VisualScale.SelectedIndex = TimeTable.VisualScale;
this.VisualScale.SelectedIndex = TimeTable.Setting_VisualScale;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
TimeTable.AutoScrollToHour = this.AutoScroll.SelectedIndex;
TimeTable.VisualScale = this.VisualScale.SelectedIndex;
TimeTable.Setting_AutoScrollToHour = this.AutoScroll.SelectedIndex;
TimeTable.Setting_VisualScale = this.VisualScale.SelectedIndex;
}
}
}

View File

@@ -41,6 +41,8 @@ namespace CampusAppWP8.Pages.TimeTable
{
this.InitializeComponent();
TimeTable.InitFeed();
DateTime firstDay = this.GetFirstDayOfWeek(DateTime.Now).AddDays(-7 * PIVOT_PAGES_HALF_DOWN);
for (int i = 0; i < PIVOT_PAGES; i++)
@@ -86,7 +88,7 @@ namespace CampusAppWP8.Pages.TimeTable
if (e.NavigationMode == NavigationMode.Back)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged -= this.OnListChanged;
TimeTable.Feed.Model.Appointments.CollectionChanged -= this.OnListChanged;
}
else
{
@@ -98,6 +100,13 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
TimeTable.Feed.SaveData();
}
private DateTime GetFirstDayOfWeek(DateTime dayInWeek)
{
DateTime retValue = dayInWeek.Date;
@@ -146,7 +155,7 @@ namespace CampusAppWP8.Pages.TimeTable
page.NavigationService.Navigate(url);
*/
// this.itemPages[this.ThePivot.SelectedIndex].weekView.SetColumnBackground(0, new SolidColorBrush(Colors.Red));
(this.ThePivot.SelectedItem as WeekViewPageItem).AppointmentList.Add(TimeTable.AppointmentsModel.Appointments[1]);
(this.ThePivot.SelectedItem as WeekViewPageItem).AppointmentList.Add(TimeTable.Feed.Model.Appointments[1]);
}
private void OnClickToday(object sender, EventArgs e)
@@ -179,7 +188,7 @@ namespace CampusAppWP8.Pages.TimeTable
private void OnClickCreate(object sender, EventArgs e)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
Uri url = new Uri(Constants.PathTimeTable_AppointmentEdit, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
@@ -216,7 +225,7 @@ namespace CampusAppWP8.Pages.TimeTable
this.lastSelectedIndex = this.ThePivot.SelectedIndex;
}
/*
private void OnAutoScroll(object sender, RoutedEventArgs e)
{
if ((sender as ScrollViewer).VerticalOffset == 0.0)
@@ -224,14 +233,14 @@ namespace CampusAppWP8.Pages.TimeTable
(sender as ScrollViewer).ScrollToVerticalOffset(WEEK_TABLE_CELL_HEIGHT * TimeTable.AutoScrollToHour);
}
}
*/
private void OnAppointmentClick(AppointmentModel model)
{
int index = TimeTable.AppointmentsModel.Appointments.IndexOf(model);
int index = TimeTable.Feed.Model.Appointments.IndexOf(model);
if (index >= 0)
{
TimeTable.AppointmentsModel.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
string urlString = Constants.PathTimeTable_Appointment + "?" + Constants.Param_Appointment_Index + "=" + index;
@@ -319,6 +328,8 @@ namespace CampusAppWP8.Pages.TimeTable
this.itemList[i].AppointmentList.Add(tempModel);
}
}
TimeTable.Feed.SaveData(true);
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
@@ -337,14 +348,29 @@ namespace CampusAppWP8.Pages.TimeTable
private void CheckAppointments()
{
foreach (AppointmentModel m in TimeTable.AppointmentsModel.Appointments)
if (TimeTable.Feed == null)
{
throw new NullReferenceException("feed == null");
}
else if (TimeTable.Feed.Model == null)
{
throw new NullReferenceException("model == null");
}
else if (TimeTable.Feed.Model.Appointments == null)
{
throw new NullReferenceException("Appointments == null");
}
for (int m = 0; m < TimeTable.Feed.Model.Appointments.Count; m++)
{
AppointmentModel temp = TimeTable.Feed.Model.Appointments[m];
for (int i = 0; i < PIVOT_PAGES; i++)
{
if (m.IsDate(this.itemList[i].FromDT, 4) >= 0)
if (temp.IsDate(this.itemList[i].FromDT, 4) >= 0)
{
m.OnClick += this.OnAppointmentClick;
this.itemList[i].AppointmentList.Add(m);
temp.OnClick += this.OnAppointmentClick;
this.itemList[i].AppointmentList.Add(temp);
}
}
}
@@ -379,7 +405,7 @@ namespace CampusAppWP8.Pages.TimeTable
tempList[i] = new List<AppointmentModel>();
}
*/
for (int i = 0; i < TimeTable.AppointmentsModel.Appointments.Count(); i++)
for (int i = 0; i < TimeTable.Feed.Model.Appointments.Count(); i++)
{
/*
for (int k = 0; k < 5; k++)
@@ -390,9 +416,9 @@ namespace CampusAppWP8.Pages.TimeTable
}
}
*/
if (TimeTable.AppointmentsModel.Appointments[i].IsDate(this.itemList[index].FromDT.Date, 4) > -1)
if (TimeTable.Feed.Model.Appointments[i].IsDate(this.itemList[index].FromDT.Date, 4) > -1)
{
tempList.Add(TimeTable.AppointmentsModel.Appointments[i]);
tempList.Add(TimeTable.Feed.Model.Appointments[i]);
}
}
// -------------------------------------------------------

View File

@@ -594,4 +594,7 @@
<data name="GeoWatch_CurrentPositionPoint" xml:space="preserve">
<value>CurrentPositionPoint</value>
</data>
<data name="FileAppointments_Name" xml:space="preserve">
<value>Appointments.xaml</value>
</data>
</root>

View File

@@ -249,6 +249,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Appointments.xaml ähnelt.
/// </summary>
public static string FileAppointments_Name {
get {
return ResourceManager.GetString("FileAppointments_Name", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
/// </summary>

View File

@@ -18,29 +18,12 @@ namespace CampusAppWP8.Utility.Lui.Templates
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Pages.TimeTable;
using System.Windows.Data;
using System.Windows.Media;
public partial class AppointmentCanvas : UserControl
{
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[]
{
new SolidColorBrush(Colors.Green),
new SolidColorBrush(Colors.Orange),
new SolidColorBrush(Colors.Blue),
new SolidColorBrush(Colors.Brown),
new SolidColorBrush(Colors.Cyan),
new SolidColorBrush(Colors.DarkGray),
new SolidColorBrush(Colors.Magenta),
new SolidColorBrush(Colors.Purple),
new SolidColorBrush(Colors.Yellow),
new SolidColorBrush(Colors.Red)
};
private AppointmentModel appPtr = null;
public AppointmentCanvas() : base()
@@ -58,9 +41,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
double totalHours = model.GetTotalHours(day);
this.Height = ((totalHours < 0.25) ? 0.25 : totalHours) * HOURS_SPACING;
this.Height = ((totalHours < 0.25) ? 0.25 : totalHours) * TimeTable.Setting_Hour_Spacing;
this.SetText(model.Title);
this.SetValue(Canvas.TopProperty, (day.Date.Equals(model.Start.Date)) ? (model.Start.TimeOfDay.TotalHours * HOURS_SPACING) : 0);
this.SetValue(Canvas.TopProperty, (day.Date.Equals(model.Start.Date)) ? (model.Start.TimeOfDay.TotalHours * TimeTable.Setting_Hour_Spacing) : 0);
object tempProp = null;
@@ -82,12 +65,12 @@ namespace CampusAppWP8.Utility.Lui.Templates
public void SetListPosition(int index, int count)
{
this.Margin = new Thickness(
(INDEX_SPACING * index),
(TimeTable.Setting_Z_Spacing * index),
0,
(INDEX_SPACING * (count - 1)),
(TimeTable.Setting_Z_Spacing * (count - 1)),
0);
this.SetValue(Canvas.ZIndexProperty, ((TOP_Z_INDEX - index) < 0) ? 0 : (TOP_Z_INDEX - index));
this.SetValue(Canvas.ZIndexProperty, ((TimeTable.Setting_Max_Z_Index - index) < 0) ? 0 : (TimeTable.Setting_Max_Z_Index - index));
if (index == 0)
{
@@ -120,12 +103,12 @@ namespace CampusAppWP8.Utility.Lui.Templates
private void SetText(string text)
{
if (this.Height < (HOURS_SPACING * 0.5))
if (this.Height < (TimeTable.Setting_Hour_Spacing * 0.5))
{
this.TheText.Text = "...";
this.TheText.Margin = new Thickness(
0,
this.Height - (HOURS_SPACING * 0.5),
this.Height - (TimeTable.Setting_Hour_Spacing * 0.5),
0,
0);
}
@@ -137,9 +120,9 @@ namespace CampusAppWP8.Utility.Lui.Templates
private void SetBGColorByPriority(int prio)
{
if (prio < PRIO_COLORS.Count() && prio >= 0)
if (prio < TimeTable.Setting_Priority_Colors.Count() && prio >= 0)
{
this.TheRect.Fill = PRIO_COLORS[prio];
this.TheRect.Fill = TimeTable.Setting_Priority_Colors[prio];
}
}
}

View File

@@ -67,66 +67,66 @@
</Grid>
<ScrollViewer x:Name="TheScrollView" Grid.Row="2">
<Grid x:Name="TheGrid" Background="Transparent" Height="960">
<Grid.Resources>
<Style TargetType="Border">
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!--left time line-->
<ColumnDefinition Width="40" x:Name="Col_0"/>
<!--monday-->
<ColumnDefinition Width="*" x:Name="Col_1"/>
<!--tuesday-->
<ColumnDefinition Width="*" x:Name="Col_2"/>
<!--wednesday-->
<ColumnDefinition Width="*" x:Name="Col_3"/>
<!--thursday-->
<ColumnDefinition Width="*" x:Name="Col_4"/>
<!--friday-->
<ColumnDefinition Width="*" x:Name="Col_5"/>
</Grid.ColumnDefinitions>
<Grid x:Name="TheGrid" Background="Transparent" Height="{Binding Path=TimeTable.Setting_View_Height}">
<Grid.Resources>
<Style TargetType="Border">
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!--left time line-->
<ColumnDefinition Width="40" x:Name="Col_0"/>
<!--monday-->
<ColumnDefinition Width="*" x:Name="Col_1"/>
<!--tuesday-->
<ColumnDefinition Width="*" x:Name="Col_2"/>
<!--wednesday-->
<ColumnDefinition Width="*" x:Name="Col_3"/>
<!--thursday-->
<ColumnDefinition Width="*" x:Name="Col_4"/>
<!--friday-->
<ColumnDefinition Width="*" x:Name="Col_5"/>
</Grid.ColumnDefinitions>
<!--time line-->
<Border x:Name="TimeBorder" Grid.Row="0" Grid.Column="0">
<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="{StaticResource PhoneForegroundBrush}"/>
<Line X1="0" Y1="0" X2="39" Y2="0" StrokeThickness="2" Stroke="{StaticResource PhoneForegroundBrush}"/>
</Canvas>
</DataTemplate>
</lui:ListBoxFixed.ItemTemplate>
</lui:ListBoxFixed>
</Border>
<!--monday-->
<Border x:Name="MonBorder" Grid.Row="0" Grid.Column="1">
<weekView:WeekViewDay x:Name="MonList" BgListElements="24" BgListElementHeight="40"/>
</Border>
<!--tuesday-->
<Border x:Name="TueBorder" Grid.Row="0" Grid.Column="2">
<weekView:WeekViewDay x:Name="TueList" BgListElements="24" BgListElementHeight="40" />
</Border>
<!--wednesday-->
<Border x:Name="WedBorder" Grid.Row="0" Grid.Column="3">
<weekView:WeekViewDay x:Name="WedList" BgListElements="24" BgListElementHeight="40" />
</Border>
<!--thursday-->
<Border x:Name="ThuBorder" Grid.Row="0" Grid.Column="4">
<weekView:WeekViewDay x:Name="ThuList" BgListElements="24" BgListElementHeight="40" />
</Border>
<!--friday-->
<Border x:Name="FriBorder" Grid.Row="0" Grid.Column="5">
<weekView:WeekViewDay x:Name="FriList" BgListElements="24" BgListElementHeight="40" />
</Border>
</Grid>
<!--time line-->
<Border x:Name="TimeBorder" Grid.Row="0" Grid.Column="0">
<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="{StaticResource PhoneForegroundBrush}"/>
<Line X1="0" Y1="0" X2="39" Y2="0" StrokeThickness="2" Stroke="{StaticResource PhoneForegroundBrush}"/>
</Canvas>
</DataTemplate>
</lui:ListBoxFixed.ItemTemplate>
</lui:ListBoxFixed>
</Border>
<!--monday-->
<Border x:Name="MonBorder" Grid.Row="0" Grid.Column="1">
<weekView:WeekViewDay x:Name="MonList" BgListElements="24" BgListElementHeight="40"/>
</Border>
<!--tuesday-->
<Border x:Name="TueBorder" Grid.Row="0" Grid.Column="2">
<weekView:WeekViewDay x:Name="TueList" BgListElements="24" BgListElementHeight="40" />
</Border>
<!--wednesday-->
<Border x:Name="WedBorder" Grid.Row="0" Grid.Column="3">
<weekView:WeekViewDay x:Name="WedList" BgListElements="24" BgListElementHeight="40" />
</Border>
<!--thursday-->
<Border x:Name="ThuBorder" Grid.Row="0" Grid.Column="4">
<weekView:WeekViewDay x:Name="ThuList" BgListElements="24" BgListElementHeight="40" />
</Border>
<!--friday-->
<Border x:Name="FriBorder" Grid.Row="0" Grid.Column="5">
<weekView:WeekViewDay x:Name="FriList" BgListElements="24" BgListElementHeight="40" />
</Border>
</Grid>
</ScrollViewer>
</Grid>
</UserControl>

View File

@@ -20,6 +20,7 @@ namespace CampusAppWP8.Utility.Lui.Templates
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Pages.TimeTable;
public partial class WeekView : UserControl
@@ -232,7 +233,7 @@ namespace CampusAppWP8.Utility.Lui.Templates
private void AutoScroll(object sender, RoutedEventArgs e)
{
this.TheScrollView.ScrollToVerticalOffset((40 * 7) + 2);
this.TheScrollView.ScrollToVerticalOffset((TimeTable.Setting_Hour_Spacing * 7) + 2);
}
}
}

View File

@@ -106,7 +106,7 @@ namespace CampusAppWPortalLib8.Model.Departments
foreach (FacultyModel temp in this.Faculties)
{
if ((temp.HasChanged() == true) && (retValue == false))
if (temp.HasChanged() == true)
{
retValue = true;
}