diff --git a/CampusAppWP8/CampusAppWP8.sln b/CampusAppWP8/CampusAppWP8.sln new file mode 100644 index 00000000..6413a5ed --- /dev/null +++ b/CampusAppWP8/CampusAppWP8.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppWP8", "CampusAppWP8\CampusAppWP8.csproj", "{120B88CC-F3F0-4C5A-A3FD-C26E835338CC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.ActiveCfg = Debug|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.Build.0 = Debug|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|ARM.Deploy.0 = Debug|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x86.ActiveCfg = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x86.Build.0 = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Debug|x86.Deploy.0 = Debug|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Any CPU.Build.0 = Release|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|Any CPU.Deploy.0 = Release|Any CPU + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.ActiveCfg = Release|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.Build.0 = Release|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|ARM.Deploy.0 = Release|ARM + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x86.ActiveCfg = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x86.Build.0 = Release|x86 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs new file mode 100644 index 00000000..885c86fc --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 13.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Lecture +{ + using System; + using CampusAppWP8.Model.Lecture; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// + /// Class for the feed of the Lecture + /// + /// + /// need the XmlAPI + /// + public class LectureApi : XmlApi + { + /// + /// Initializes a new instance of the class. + /// + public LectureApi() + : base(new Uri(Constants.UrlLecture_ApiBaseAddr)) + { + this.ValidRootName = Constants.LectureXmlValidRootName; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/App.xaml b/CampusAppWP8/CampusAppWP8/App.xaml new file mode 100644 index 00000000..5358a12e --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/App.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs new file mode 100644 index 00000000..e0f3e904 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -0,0 +1,292 @@ +using System; +using System.Diagnostics; +using System.Resources; +using System.Windows; +using System.Windows.Markup; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using CampusAppWP8.Resources; +using System.IO.IsolatedStorage; + + +namespace CampusAppWP8 +{ + public partial class App : Application + { + + + /// + /// Bietet einen einfachen Zugriff auf den Stammframe der Phone-Anwendung. + /// + /// Der Stammframe der Phone-Anwendung. + public static PhoneApplicationFrame RootFrame { get; private set; } + + /// + /// Konstruktor für das Application-Objekt. + /// + public App() + { + // Globaler Handler für nicht abgefangene Ausnahmen. + UnhandledException += Application_UnhandledException; + + // Standard-XAML-Initialisierung + InitializeComponent(); + + // Phone-spezifische Initialisierung + InitializePhoneApplication(); + + // Initialisierung der Sprachanzeige + InitializeLanguage(); + + // Während des Debuggens Profilerstellungsinformationen zur Grafikleistung anzeigen. + if (Debugger.IsAttached) + { + // Zähler für die aktuelle Bildrate anzeigen + Application.Current.Host.Settings.EnableFrameRateCounter = true; + + // Bereiche der Anwendung hervorheben, die mit jedem Bild neu gezeichnet werden. + //Application.Current.Host.Settings.EnableRedrawRegions = true; + + // Nicht produktiven Visualisierungsmodus für die Analyse aktivieren, + // in dem Bereiche einer Seite angezeigt werden, die mit einer Farbüberlagerung an die GPU übergeben wurden. + //Application.Current.Host.Settings.EnableCacheVisualization = true; + + // Verhindert, dass der Bildschirm im Debugger ausgeschaltet wird, indem + // die Leerlauferkennung der Anwendung deaktiviert wird. + // Vorsicht: Nur im Debugmodus verwenden. Eine Anwendung mit deaktivierter Benutzerleerlauferkennung wird weiterhin ausgeführt + // und verbraucht auch dann Akkuenergie, wenn der Benutzer das Handy nicht verwendet. + PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; + } + } + + /// + /// Method save any object to the IsolatedStorage + /// + /// key of the object + /// value of the object, if value == null => remove key + public static void SaveToIsolatedStorage(string key, T value) + { + IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings; + isolatedStore.Remove(key); + if (value != null) + { + isolatedStore.Add(key, value); + } + + isolatedStore.Save(); + } + + /// + /// Method load any object to the IsolatedStorage + /// + /// key of the object + public static T LoadFromIsolatedStorage(string key) + { + IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings; + + if(isolatedStore.Contains(key)) { + object value = isolatedStore[key]; + return (T)value; + } + return default(T); + } + + /// + /// Method save any object to the IsolatedStorage + /// + /// key of the object + /// value of the object, if value == null => remove key + public static void SaveToAppState(string key, T value) + { + IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings; + isolatedStore.Remove(key); + if (value != null) + { + isolatedStore.Add(key, value); + } + + isolatedStore.Save(); + } + + /// + /// Method load any object to the IsolatedStorage + /// + /// key of the object + public static T LoadFromAppState(string key) + { + IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings; + + if (isolatedStore.Contains(key)) + { + object value = isolatedStore[key]; + return (T)value; + } + return default(T); + } + // Code, der beim Starten der Anwendung ausgeführt werden soll (z. B. über "Start") + // Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt + private void Application_Launching(object sender, LaunchingEventArgs e) + { + } + + // Code, der ausgeführt werden soll, wenn die Anwendung aktiviert wird (in den Vordergrund gebracht wird) + // Dieser Code wird beim ersten Starten der Anwendung nicht ausgeführt + private void Application_Activated(object sender, ActivatedEventArgs e) + { + + } + + // Code, der ausgeführt werden soll, wenn die Anwendung deaktiviert wird (in den Hintergrund gebracht wird) + // Dieser Code wird beim Schließen der Anwendung nicht ausgeführt + private void Application_Deactivated(object sender, DeactivatedEventArgs e) + { + } + + // Code, der beim Schließen der Anwendung ausgeführt wird (z. B. wenn der Benutzer auf "Zurück" klickt) + // Dieser Code wird beim Deaktivieren der Anwendung nicht ausgeführt + private void Application_Closing(object sender, ClosingEventArgs e) + { + // Sicherstellen, dass der erforderliche Anwendungszustand hier beibehalten wird + } + + // Code, der bei einem Navigationsfehler ausgeführt wird + private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) + { + if (Debugger.IsAttached) + { + // Navigationsfehler. Unterbrechen und Debugger öffnen + Debugger.Break(); + } + } + + // Code, der bei nicht behandelten Ausnahmen ausgeführt wird + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + if (Debugger.IsAttached) + { + // Eine nicht behandelte Ausnahme ist aufgetreten. Unterbrechen und Debugger öffnen + Debugger.Break(); + } + } + + #region Initialisierung der Phone-Anwendung + + // Doppelte Initialisierung vermeiden + private bool phoneApplicationInitialized = false; + + // Fügen Sie keinen zusätzlichen Code zu dieser Methode hinzu + private void InitializePhoneApplication() + { + if (phoneApplicationInitialized) + return; + + // Frame erstellen, aber noch nicht als RootVisual festlegen. Dadurch kann der Begrüßungsbildschirm + // aktiv bleiben, bis die Anwendung bereit für das Rendern ist. + RootFrame = new PhoneApplicationFrame(); + RootFrame.Navigated += CompleteInitializePhoneApplication; + + // Navigationsfehler behandeln + RootFrame.NavigationFailed += RootFrame_NavigationFailed; + + // Behandeln Sie Rücksetzanforderungen zum Löschen des Backstack + RootFrame.Navigated += CheckForResetNavigation; + + // Sicherstellen, dass keine erneute Initialisierung erfolgt + phoneApplicationInitialized = true; + } + + // Fügen Sie keinen zusätzlichen Code zu dieser Methode hinzu + private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) + { + // Visuelle Stammkomponente festlegen, sodass die Anwendung gerendert werden kann + if (RootVisual != RootFrame) + RootVisual = RootFrame; + + // Dieser Handler wird nicht mehr benötigt und kann entfernt werden + RootFrame.Navigated -= CompleteInitializePhoneApplication; + } + + private void CheckForResetNavigation(object sender, NavigationEventArgs e) + { + // Wenn die App eine 'Reset'-Navigation empfangen hat, müssen wir prüfen + // bei der nächsten Navigation, um festzustellen, ob der Seitenstapel zurückgesetzt werden muss + if (e.NavigationMode == NavigationMode.Reset) + RootFrame.Navigated += ClearBackStackAfterReset; + } + + private void ClearBackStackAfterReset(object sender, NavigationEventArgs e) + { + // Heben Sie die Registrierung des Ereignisses auf, damit es nicht erneut aufgerufen wird. + RootFrame.Navigated -= ClearBackStackAfterReset; + + // Löschen Sie den Stapel nur bei den Navigationen "neu" (vorwärts) und "Aktualisieren" + if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh) + return; + + // Löschen Sie zur Sicherstellung der UI-Konsistenz den gesamten Seitenstapel + while (RootFrame.RemoveBackEntry() != null) + { + ; // unternehmen Sie nichts + } + } + + #endregion + + // Initialisieren Sie die Schriftart und Flussrichtung der App wie in den lokalisierten Ressourcenzeichenfolgen angegeben. + // + // Um sicherzustellen, dass die Schriftart der Anwendung mit den unterstützten Sprachen abgestimmt ist und dass + // FlowDirection der einzelnen Sprachen der herkömmlichen Richtung folgt, müssen ResourceLanguage + // und ResourceFlowDirection in jeder RESX-Datei initialisiert werden, damit sie den Werten + // der Kultur dieser Datei entsprechen. Zum Beispiel: + // + // AppResources.es-ES.resx + // Der Wert von ResourceLanguage muss "es-ES" sein. + // Der Wert von ResourceFlowDirection muss "LeftToRight" sein. + // + // AppResources.ar-SA.resx + // Der Wert von ResourceLanguage muss "ar-SA" sein. + // Der Wert von ResourceFlowDirection muss "RightToLeft" sein. + // + // Weitere Informationen über die Lokalisierung von Windows Phone-Apps finden Sie unter http://go.microsoft.com/fwlink/?LinkId=262072. + // + private void InitializeLanguage() + { + try + { + // Legen Sie die Schriftart so fest, dass sie der Anzeigesprache entspricht, die + // in der ResourceLanguage-Ressourcenzeichenfolge der einzelnen unterstützten Sprachen definiert ist. + // + // Greifen Sie auf die Schriftart der neutralen Sprache zurück, wenn die + // Anzeigesprache des Telefons nicht unterstützt wird. + // + // Wenn ein Compilerfehler auftritt, fehlt ResourceLanguage in + // der Ressourcendatei. + RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage); + + // Legen Sie FlowDirection aller Elemente im Stammframe fest und zwar auf Grundlage + // der ResourceFlowDirection-Ressourcenzeichenfolge der einzelnen + // unterstützten Sprachen. + // + // Wenn ein Compilerfehler auftritt, fehlt ResourceFlowDirection in + // der Ressourcendatei. + FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection); + RootFrame.FlowDirection = flow; + } + catch + { + // Tritt hier eine Ausnahme auf, liegt das wahrscheinlich entweder an + // ResourceLangauge ist nicht richtig auf eine unterstützte Sprache eingestellt + // Code oder ResourceFlowDirection ist auf einen anderen Wert als LeftToRight festgelegt + // oder RightToLeft. + + if (Debugger.IsAttached) + { + Debugger.Break(); + } + + throw; + } + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Assets/AlignmentGrid.png b/CampusAppWP8/CampusAppWP8/Assets/AlignmentGrid.png new file mode 100644 index 00000000..f7d2e978 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/AlignmentGrid.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/ApplicationIcon.png b/CampusAppWP8/CampusAppWP8/Assets/ApplicationIcon.png new file mode 100644 index 00000000..7d95d4e0 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/ApplicationIcon.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/add_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/add_159.png new file mode 100644 index 00000000..056c5667 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/add_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/btulogo_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/btulogo_159.png new file mode 100644 index 00000000..c220e77b Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/btulogo_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/campus_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/campus_159.png new file mode 100644 index 00000000..08bd5f68 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/campus_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/delete_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/delete_159.png new file mode 100644 index 00000000..bbcb20e5 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/delete_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/departments_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/departments_159.png new file mode 100644 index 00000000..917436d2 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/departments_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/favorite_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/favorite_159.png new file mode 100644 index 00000000..44fd7dc7 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/favorite_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/homework_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/homework_159.png new file mode 100644 index 00000000..313bb5da Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/homework_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/info_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/info_159.png new file mode 100644 index 00000000..94231862 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/info_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/lectures_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/lectures_159.png new file mode 100644 index 00000000..8a68bdb3 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/lectures_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/link_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/link_159.png new file mode 100644 index 00000000..cbb96cc9 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/link_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/mensa_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/mensa_159.png new file mode 100644 index 00000000..3a6abae2 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/mensa_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/news_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/news_159.png new file mode 100644 index 00000000..1d68bde3 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/news_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/openhours_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/openhours_159.png new file mode 100644 index 00000000..09933ea1 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/openhours_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/phone_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/phone_159.png new file mode 100644 index 00000000..f469f816 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/phone_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/schedule_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/schedule_159.png new file mode 100644 index 00000000..17fa2a85 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/schedule_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/search_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/search_159.png new file mode 100644 index 00000000..3b859d6d Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/search_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/student_council_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/student_council_159.png new file mode 100644 index 00000000..26ab3658 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/student_council_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/webmail_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/webmail_159.png new file mode 100644 index 00000000..77f3af27 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/webmail_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/add_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/add_159.png new file mode 100644 index 00000000..0fb90eb3 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/add_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/btulogo_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/btulogo_159.png new file mode 100644 index 00000000..f98729b1 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/btulogo_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/campus_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/campus_159.png new file mode 100644 index 00000000..e7fa38b8 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/campus_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/delete_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/delete_159.png new file mode 100644 index 00000000..dbd61253 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/delete_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/departments_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/departments_159.png new file mode 100644 index 00000000..61c8ad78 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/departments_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/favorite_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/favorite_159.png new file mode 100644 index 00000000..6b90fc4c Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/favorite_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/homework_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/homework_159.png new file mode 100644 index 00000000..708f6cba Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/homework_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/info_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/info_159.png new file mode 100644 index 00000000..1ad39f71 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/info_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/lectures_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/lectures_159.png new file mode 100644 index 00000000..997dc2e1 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/lectures_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/link_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/link_159.png new file mode 100644 index 00000000..c61292b9 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/link_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/mensa_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/mensa_159.png new file mode 100644 index 00000000..e1f15575 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/mensa_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/news_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/news_159.png new file mode 100644 index 00000000..ea0f843a Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/news_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/openhours_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/openhours_159.png new file mode 100644 index 00000000..caddfb56 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/openhours_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/phone_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/phone_159.png new file mode 100644 index 00000000..731f36f8 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/phone_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/schedule_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/schedule_159.png new file mode 100644 index 00000000..090331f5 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/schedule_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/search_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/search_159.png new file mode 100644 index 00000000..2b8797ca Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/search_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/student_council_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/student_council_159.png new file mode 100644 index 00000000..47ed68d2 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/student_council_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/webmail_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/webmail_159.png new file mode 100644 index 00000000..e7404836 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/webmail_159.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileLarge.png b/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileLarge.png new file mode 100644 index 00000000..e0c59ac0 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileLarge.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileMedium.png b/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileMedium.png new file mode 100644 index 00000000..e93b89d6 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileMedium.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileSmall.png b/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileSmall.png new file mode 100644 index 00000000..550b1b5e Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Tiles/FlipCycleTileSmall.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Tiles/IconicTileMediumLarge.png b/CampusAppWP8/CampusAppWP8/Assets/Tiles/IconicTileMediumLarge.png new file mode 100644 index 00000000..686e6b53 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Tiles/IconicTileMediumLarge.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/Tiles/IconicTileSmall.png b/CampusAppWP8/CampusAppWP8/Assets/Tiles/IconicTileSmall.png new file mode 100644 index 00000000..d4b5ede1 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Tiles/IconicTileSmall.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/psd/holo_optionsbuttons.psd b/CampusAppWP8/CampusAppWP8/Assets/psd/holo_optionsbuttons.psd new file mode 100644 index 00000000..53796ff0 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/psd/holo_optionsbuttons.psd differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/psd/iconbutton_effects2.psd b/CampusAppWP8/CampusAppWP8/Assets/psd/iconbutton_effects2.psd new file mode 100644 index 00000000..4b15310c Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/psd/iconbutton_effects2.psd differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/testmap.png b/CampusAppWP8/CampusAppWP8/Assets/testmap.png new file mode 100644 index 00000000..a2cdfad3 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/testmap.png differ diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj new file mode 100644 index 00000000..85541caa --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -0,0 +1,426 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {120B88CC-F3F0-4C5A-A3FD-C26E835338CC} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + CampusAppWP8 + CampusAppWP8 + WindowsPhone + v8.0 + $(TargetFrameworkVersion) + true + + + true + true + CampusAppWP8_$(Configuration)_$(Platform).xap + Properties\AppManifest.xml + CampusAppWP8.App + true + 11.0 + true + 5.0.40218.0 + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\x86\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\x86\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\ARM\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\ARM\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + App.xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CampusMapPage.xaml + + + + + DepartmentFavoritePage.xaml + + + DepartmentIndexPage.xaml + + + DepartmentInfoPage.xaml + + + DepartmentPage.xaml + + + + EventIndexPage.xaml + + + EventPage.xaml + + + LecturePage.xaml + + + + ModulWebPage.xaml + + + + ResultDetailPage.xaml + + + ResultPage.xaml + + + LinkPage.xaml + + + MensaPage.xaml + + + + NewsIndexPage.xaml + + + NewsPage.xaml + + + + OpeninghoursPage.xaml + + + StartPage.xaml + + + StudentCouncilPage.xaml + + + WebmailPage.xaml + + + + True + True + AppResources.resx + + + True + True + Constants.resx + + + True + True + Icons.resx + + + + + + + + + + + + + + + Code + + + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + + + + + + Designer + + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + PublicResXFileCodeGenerator + AppResources.Designer.cs + Designer + + + PublicResXFileCodeGenerator + Constants.Designer.cs + Designer + + + PublicResXFileCodeGenerator + Icons.Designer.cs + Designer + + + + + + ..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Const.cs b/CampusAppWP8/CampusAppWP8/Const.cs new file mode 100644 index 00000000..57cfe428 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Const.cs @@ -0,0 +1,33 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8 +{ + using CampusAppWP8.Resources; + + /// + /// Access to Constants.rex + /// + public class Const + { + /// + /// Resource object. + /// + private static Constants constantResources = new Constants(); + + /// + /// Gets the resource object. + /// + public Constants Constants + { + get + { + return constantResources; + } + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs new file mode 100644 index 00000000..bdd59d24 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs @@ -0,0 +1,93 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 01.07.2013 +//----------------------------------------------------------------------using System; +namespace CampusAppWP8.Feed.Departments +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Departments; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// + /// Feed object to handle favorite department feeds. + /// + public class DepartmentFavoriteFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + /// automatic loading of the data + public DepartmentFavoriteFeed(bool autoLoad = true) + : base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + + if (autoLoad == true) + { + this.LoadData(); + } + } + + // Constructor + #endregion + + #region Method + + #region Protected + + /// + /// Method implement CheckIsModelUpToDate()-Method . + /// + /// model object + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(DepartmentModel model) + { + bool retValue = true; + + if ((model == null) + || (model.Faculties == null) + || (model.Faculties.Count != 1)) + { + retValue = false; + } + + return retValue; + } + + /// + /// Method implement CheckIsFileUpToDate()-Method . + /// + /// model object + /// file info object + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(DepartmentModel model, FileInfo info) + { + bool retValue = false; + + if (this.Model == null) + { + retValue = true; + } + else + { + retValue = (model.HasChanged() == false) ? true : false; + } + + return retValue; + } + + // Protected + #endregion + + // Method + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs new file mode 100644 index 00000000..e967ec95 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs @@ -0,0 +1,104 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Departments +{ + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Departments; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// + /// Feed class for the department information. + /// + public class DepartmentFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + /// automatic loading of the data + public DepartmentFeed(bool autoLoad = true) + : base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + + if (autoLoad == true) + { + this.LoadData(); + } + } + + // Constructor + #endregion + + #region Method + + #region Protected + + /// + /// Method implement CheckIsModelUpToDate()-Method . + /// + /// model object + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(DepartmentModel model) + { + bool retValue = true; + + if (model == null) + { + retValue = false; + } + else + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0); + } + + return retValue; + } + + /// + /// Method implement CheckIsFileUpToDate()-Method . + /// + /// model object + /// file info object + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(DepartmentModel model, FileInfo info) + { + bool retValue = true; + + if (model == null) + { + // at loading + if (info.Exists == true) + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0); + } + } + else + { + // at saving + if ((info.Exists == false) + || (info.Length == 0)) + { + retValue = false; + } + } + + return retValue; + } + + // Protedted + #endregion + + // Method + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs new file mode 100644 index 00000000..099c8571 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs @@ -0,0 +1,89 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Events +{ + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.RSS; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// + /// Event Feed. + /// + public class EventFeed : XmlModel + { + /// + /// Initializes a new instance of the class. + /// + /// automatic loading of the data + public EventFeed(bool autoLoad = true) + : base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + + if (autoLoad == true) + { + this.LoadData(); + } + } + + /// + /// Method implement CheckIsModelUpToDate()-Method + /// + /// model object + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(RSSViewModel model) + { + bool retValue = true; + + if (model == null) + { + retValue = false; + } + else + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 1.0); + } + + return retValue; + } + + /// + /// Method implement CheckIsFileUpToDate()-Method + /// + /// model object + /// file info object + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info) + { + bool retValue = true; + + if (model == null) + { + // at loading + if (info.Exists == true) + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0); + } + } + else + { + // at saving + if ((info.Exists == false) + || (info.Length == 0)) + { + retValue = false; + } + } + + return retValue; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs new file mode 100644 index 00000000..76f9d279 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Link +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Link; + using CampusAppWP8.Resources; + + /// + /// This Class is for ClubLinkFeeds + /// + public class ClubLinkFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public ClubLinkFeed() + : base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(LinkListModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Check if the model or file is up-to-date. + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + DateTime temp = lastModified.AddDays(1); + + int diff = temp.CompareTo(DateTime.Now); + + if (diff < 0) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs new file mode 100644 index 00000000..35c1db36 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Link +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Link; + using CampusAppWP8.Resources; + + /// + /// This Class is for CommonLinkFeeds + /// + public class CommonLinkFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public CommonLinkFeed() + : base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(LinkListModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Check if the model or file is up-to-date. + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + DateTime temp = lastModified.AddDays(1); + + int diff = temp.CompareTo(DateTime.Now); + + if (diff < 0) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs new file mode 100644 index 00000000..265d1aca --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs @@ -0,0 +1,88 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 03.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Mensa +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Mensa; + using CampusAppWP8.Resources; + + /// + /// This Class is for MensaFeeds + /// + public class MensaFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public MensaFeed() + : base(ModelType.FileAndFeed, Constants.FileMensa_Shedule, Constants.UrlMensa_Week) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(MenuWeekModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(MenuWeekModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the last modification was later as the NewMenuWeekDay + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + int diff = lastModified.CompareTo(MenuWeekModel.CalcFirstWeekDay()); + + if (diff < 0) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs new file mode 100644 index 00000000..d6cd0411 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs @@ -0,0 +1,89 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Feed.News +{ + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.RSS; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// + /// News Feed. + /// + public class NewsFeed : XmlModel + { + /// + /// Initializes a new instance of the class. + /// + /// automatic loading of the data + public NewsFeed(bool autoLoad = true) + : base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + + if (autoLoad == true) + { + this.LoadData(); + } + } + + /// + /// Method implement CheckIsModelUpToDate()-Method + /// + /// model object + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(RSSViewModel model) + { + bool retValue = true; + + if (model == null) + { + retValue = false; + } + else + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 1.0); + } + + return retValue; + } + + /// + /// Method implement CheckIsFileUpToDate()-Method + /// + /// model object + /// info object of the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info) + { + bool retValue = true; + + if (model == null) + { + // at loading + if (info.Exists == true) + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0); + } + } + else + { + // at saving + if ((info.Exists == false) + || (info.Length == 0)) + { + retValue = false; + } + } + + return retValue; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs new file mode 100644 index 00000000..d1b0fb71 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs @@ -0,0 +1,81 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Openinghours +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Openinghours; + using CampusAppWP8.Resources; + + /// + /// This Class is for MesaFeeds + /// + public class OpeninghoursFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public OpeninghoursFeed() + : base(ModelType.FileAndFeed, Constants.FileOpeningHours_OpeningHours, Constants.UrlOpeningHours_OpeningHours) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(OpeninghoursModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(OpeninghoursModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Check if the model or file is up-to-date. + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs new file mode 100644 index 00000000..a2520fc3 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.StudentCouncil +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.StudentCouncil; + using CampusAppWP8.Resources; + + /// + /// This Class is for StudentCouncilFeed + /// + public class StudentCouncilFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public StudentCouncilFeed() + : base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(StudentCouncilListModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(StudentCouncilListModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Check if the model or file is up-to-date. + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + DateTime temp = lastModified.AddDays(1); + + int diff = temp.CompareTo(DateTime.Now); + + if (diff < 0) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/LocalizedStrings.cs b/CampusAppWP8/CampusAppWP8/LocalizedStrings.cs new file mode 100644 index 00000000..e2063778 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/LocalizedStrings.cs @@ -0,0 +1,14 @@ +using CampusAppWP8.Resources; + +namespace CampusAppWP8 +{ + /// + /// Bietet Zugriff auf Zeichenfolgenressourcen. + /// + public class LocalizedStrings + { + private static AppResources _localizedResources = new AppResources(); + + public AppResources LocalizedResources { get { return _localizedResources; } } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs new file mode 100644 index 00000000..11d1b322 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs @@ -0,0 +1,177 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Campusmap +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + + /// + /// This Class manage the properties of a Map + /// + public class MapModel + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public MapModel() + { + } + + #endregion + + #region Property + + /// + /// Gets or sets the ImageSource of the map + /// + public string ImageSource { get; set; } + + /// + /// Gets or sets the ImageWidth of the map + /// + public double ImageWidth { get; set; } + + /// + /// Gets or sets the ImageHeight of the map + /// + public double ImageHeight { get; set; } + + /// + /// Gets or sets the ImageOffsetX of the map + /// + public double MapImageOffsetX { get; set; } + + /// + /// Gets or sets the ImageOffsetY of the map + /// + public double MapImageOffsetY { get; set; } + + /// + /// Gets or sets the GeoOffsetX of the map + /// + public double GeoOffsetX { get; set; } + + /// + /// Gets or sets the GeoOffsetY of the map + /// + public double GeoOffsetY { get; set; } + + /// + /// Gets or sets the Scale (to pixel) of the map + /// + public double Scale { get; set; } + + /// + /// Gets or sets the reference point + /// + public Point RefPoint { get; set; } + + #endregion + + #region Methods + + /// + /// Method calculate the coordinates of ScrollToOffsets point + /// + /// input point + /// point (in pixel) + public Point GetScrollPoint(Point point) + { + return this.GetScrollPoint(point.X, point.Y); + } + + /// + /// Method calculate the coordinates of ScrollToOffsets point + /// + /// the input-point will be shown in the center + /// x - coordinate + /// y - coordinate + /// point (in pixel) + public Point GetScrollPoint(double x, double y) + { + x = this.RefPoint.X + this.MapImageOffsetX + x; + y = this.RefPoint.Y + this.MapImageOffsetY - y; + return new Point(x, y); + } + + /// + /// Method create in image, which can show at a certain position + /// + /// the x- coordinate + /// the y-coordinate + /// image of the pin + public Image AddPin(double x, double y) + { + Point position = new Point(x, y); + return this.AddPin(position); + } + + /// + /// Method create in image, which can show at a certain position depend of the + /// + /// the x-coordinate + /// the y-coordinate + /// image of the pin + public Image AddPinFromRefPoint(double x, double y) + { + Point position = new Point(this.RefPoint.X + x, this.RefPoint.Y - y); + return this.AddPin(position); + } + + /// + /// Method create in image, which can show at a certain position depend of the + /// + /// input point + /// image of the pin + public Image AddPinFromRefPoint(Point position) + { + return this.AddPinFromRefPoint(position.X, position.Y); + } + + /// + /// Method create in image, which can show at a certain position + /// + /// input point + /// image of the pin + public Image AddPin(Point position) + { + MapPinModel pin = new MapPinModel() { Position = position }; + Image pinImg = new Image() { Source = new BitmapImage(new Uri(pin.ImageSource, UriKind.Relative)), Width = pin.ImageWidth }; + Canvas.SetTop(pinImg, pin.Position.Y); + Canvas.SetLeft(pinImg, pin.Position.X); + return pinImg; + } + + /// + /// Convert a coordinates to coordinates which address pixels + /// + /// the x-coordinate + /// the y-coordinate + /// Point in pixel-size + public Point ConverToPixelPoint(double x, double y) + { + return new Point { X = this.Scale * x, Y = this.Scale * y }; + } + + /// + /// Convert a coordinates to coordinates which address pixels + /// + /// not scaled point + /// Point in pixel-size + public Point ConverToPixelPoint(Point point) + { + return this.ConverToPixelPoint(point.X, point.Y); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapPinModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapPinModel.cs new file mode 100644 index 00000000..8e9b131a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapPinModel.cs @@ -0,0 +1,106 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Campusmap +{ + using System.Windows; + + /// + /// This Class manage the properties of a MapPin + /// + public class MapPinModel + { + #region Member + + /// + /// Variable of the actual position of the pin + /// + private Point position; + + #endregion + #region Constructor + /// + /// Initializes a new instance of the class. + /// + public MapPinModel() + { + this.ImageSource = "/Assets/icons/search_159_light.png"; + this.ImageWidth = 60; + this.ImageHeight = 60; + this.PinImageOffsetX = -24; + this.PinImageOffsetY = -24; + } + + #endregion + + #region Property + + /// + /// Gets or sets the ImageSource of the pin + /// + public string ImageSource { get; set; } + + /// + /// Gets or sets the ImageWidth of the pin + /// + public double ImageWidth { get; set; } + + /// + /// Gets or sets the ImageHeight of the pin + /// + public double ImageHeight { get; set; } + + /// + /// Gets or sets the ImageOffsetX of the pin + /// + public double PinImageOffsetX { get; set; } + + /// + /// Gets or sets the ImageOffsetY of the pin + /// + public double PinImageOffsetY { get; set; } + + /// + /// Gets or sets position of the pin + /// + public Point Position + { + get + { + return this.position; + } + + set + { + // null assert + if (value == null) + { + return; + } + + if (this.position == null) + { + this.position = value; + return; + } + + // check the x-value + if (value.X + this.PinImageOffsetX != this.position.X) + { + this.position.X = value.X + this.PinImageOffsetX; + } + + // check the y-value + if (value.Y + this.PinImageOffsetY != this.position.Y) + { + this.position.Y = value.Y + this.PinImageOffsetY; + } + } + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs new file mode 100644 index 00000000..2cbaecea --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs @@ -0,0 +1,128 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Departments +{ + using System.Globalization; + using System.Xml.Serialization; + + /// + /// Class to hold information about a professorship chair. + /// + public class ChairModel + { + /// + /// German name of the chair. + /// + private string nameDE = string.Empty; + + /// + /// Link to the chair page. + /// + private string url = string.Empty; + + /// + /// English name of the chair. + /// + private string nameEN = string.Empty; + + /// + /// Initializes a new instance of the class. + /// + public ChairModel() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// name of the chair + public ChairModel(string name) + { + this.nameDE = name; + this.nameEN = name; + } + + /// + /// Gets or sets the german name of the chair. + /// + [XmlAttribute("name_de")] + public string NameDE + { + get + { + return this.nameDE; + } + + set + { + if (value != this.nameDE) + { + this.nameDE = value; + } + } + } + + /// + /// Gets or sets the english name of the chair. + /// + [XmlAttribute("name_en")] + public string NameEN + { + get + { + return this.nameEN; + } + + set + { + if (value != this.nameEN) + { + this.nameEN = value; + } + } + } + + /// + /// Gets or sets the url of the chair homepage. + /// + [XmlAttribute("url")] + public string Url + { + get + { + return this.url; + } + + set + { + if (value != this.url) + { + this.url = value; + } + } + } + + /// + /// Gets the localized name of the chair. + /// + public string Name + { + get + { + if (CultureInfo.CurrentUICulture.Name.StartsWith("de")) + { + return this.NameDE; + } + else + { + return this.NameEN; + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs new file mode 100644 index 00000000..5b7db58d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs @@ -0,0 +1,91 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Departments +{ + using System; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// View model for department page. + /// + [XmlRoot("root")] + public class DepartmentModel + { + /// + /// Object to store the time when the instance was created. + /// + private DateTime createTime; + + /// + /// List of faculties. + /// + private ObservableCollection faculties; + + /// + /// Initializes a new instance of the class. + /// + public DepartmentModel() + { + this.Faculties = new ObservableCollection(); + this.createTime = DateTime.Now; + } + + /// + /// Gets or sets the faculty list. + /// + [XmlArray("professorships")] + [XmlArrayItem("faculty")] + public ObservableCollection Faculties + { + get + { + return this.faculties; + } + + set + { + if (value != this.faculties) + { + this.faculties = value; + } + } + } + + /// + /// Gets the creation time. + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + + /// + /// Check if the content of the faculty lists hast changed since the + /// last call of this function. + /// + /// true, if changes happend since last request, otherwise false + public bool HasChanged() + { + bool retValue = false; + + foreach (FacultyModel temp in this.Faculties) + { + if ((temp.HasChanged() == true) && (retValue == false)) + { + retValue = true; + } + } + + return retValue; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs new file mode 100644 index 00000000..1c3419ef --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs @@ -0,0 +1,238 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Departments +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + using CampusAppWP8.Resources; + + /// + /// Model for holding the faculty information. + /// + public class FacultyModel + { + /// + /// Object to hold the information of the chair containing to this + /// faculty. + /// + private ObservableCollection chairs; + + /// + /// Name of the faculty. + /// + private string name = string.Empty; + + /// + /// For checking of change. + /// + private bool hasChanged = false; + + /// + /// Initializes a new instance of the class. + /// + public FacultyModel() + { + this.chairs = new ObservableCollection(); + } + + /// + /// Initializes a new instance of the class. + /// + /// name of the faculty + public FacultyModel(string name) + { + this.name = name; + this.chairs = new ObservableCollection(); + } + + /// + /// Gets or sets the list of the chairs containing to this faculty. + /// + [XmlElement("chair")] + public ObservableCollection Chairs + { + get + { + return this.chairs; + } + + set + { + if (value != this.chairs) + { + this.chairs = value; + } + } + } + + /// + /// Gets the name of the faculty. + /// + public string Name + { + get + { + return AppResources.Faculty + " " + this.name; + } + } + + /// + /// Gets or sets the id of the faculty. + /// + [XmlAttribute("id")] + public string Id + { + get + { + return this.name; + } + + set + { + this.name = value; + } + } + + /// + /// Remove a chair model from the lost. + /// + /// name of the chair + /// true, if succeeded + public bool RemoveChair(string chairName) + { + bool retValue = false; + + ChairModel tempChair = null; + + foreach (ChairModel temp in this.Chairs) + { + if (temp.Name.Equals(chairName) == true) + { + tempChair = temp; + } + } + + if (tempChair != null) + { + retValue = this.Chairs.Remove(tempChair); + this.hasChanged = true; + } + + return retValue; + } + + /// + /// Add a chair to the list, if it does not already exist. + /// + /// chair model to add + /// true, is succeeded + public bool AddChair(ChairModel chairModel) + { + bool retValue = false; + + if ((chairModel != null) + && (this.Chairs.Contains(chairModel) == false)) + { + bool isIn = false; + + foreach (ChairModel temp in this.Chairs) + { + if ((temp.NameDE.Equals(chairModel.NameDE) == true) + || (temp.NameEN.Equals(chairModel.NameEN) == true)) + { + isIn = true; + } + } + + if (isIn == false) + { + this.Chairs.Add(chairModel); + this.hasChanged = true; + retValue = true; + } + } + + return retValue; + } + + /// + /// Create a chair model and add it to the list, if it does not already + /// exist. + /// + /// german name of the chair + /// english name of the chair + /// url of the chair home page + /// true, if succeeded + public bool AddChair(string nameDE, string nameEN, string url) + { + bool retValue = false; + + bool isIn = false; + + foreach (ChairModel temp in this.Chairs) + { + if ((temp.NameDE.Equals(nameDE) == true) + || (temp.NameEN.Equals(nameEN) == true)) + { + isIn = true; + } + } + + if (isIn == false) + { + ChairModel newModel = new ChairModel(); + newModel.NameDE = nameDE; + newModel.NameEN = nameEN; + newModel.Url = url; + + this.Chairs.Add(newModel); + this.hasChanged = true; + retValue = true; + } + + return retValue; + } + + /// + /// Return the chair model of the chair with the specified name. + /// + /// name of the chair + /// chair model, if succeeded, otherwise null + public ChairModel GetChairModel(string name) + { + ChairModel retValue = null; + + foreach (ChairModel temp in this.Chairs) + { + if (temp.Name.Equals(name) == true) + { + retValue = temp; + } + } + + return retValue; + } + + /// + /// Return true if there were changes in the chair list, otherwise false. + /// + /// when true, the hasChanged flag will be reseted + /// true, when changed, otherwise false + public bool HasChanged(bool reset = true) + { + bool retValue = this.hasChanged; + + if (reset == true) + { + this.hasChanged = false; + } + + return retValue; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs new file mode 100644 index 00000000..dc24d2e9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs @@ -0,0 +1,50 @@ +using CampusAppWP8.Model; +using System.Collections.ObjectModel; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.events_news +{ + /// + /// Channel Model, which contains the rss feed item list. + /// + public class RSSChannelModel : BaseModel + { + /// + /// RssFeed information item list. + /// + [XmlElement("item")] + public ObservableCollection item { get; set; } + + /// + /// Default constructor. + /// + public RSSChannelModel() + { + this.item = new ObservableCollection(); + } + + /// + /// Set/Get the rss feed item list. + /// + public ObservableCollection Item + { + get + { + return this.item; + } + set + { + if (value != this.item) + { + this.item = value; + int i = 0; + foreach (RSSModel rssItem in this.item) + { + rssItem.Index = i++; + } + NotifyPropertyChanged("item"); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs new file mode 100644 index 00000000..20833cfd --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs @@ -0,0 +1,209 @@ +using CampusAppWP8.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.events_news +{ + /// + /// Contains the rss feed informations. + /// + public class RSSModel : BaseModel + { + /// + /// Title of the fees + /// + private string title; + /// + /// Description text of the feed. + /// + private string text; + /// + /// Timestamp (publication date) of the event or news. + /// + private DateTime timestamp; + /// + /// Url of the feed. + /// + private string link; + + /// + /// Set/Get the title of the feed. + /// + [XmlElement("title")] + public string Title + { + get { return this.title; } + set + { + if (this.title != value) + { + this.title = value; + NotifyPropertyChanged("rss"); + } + } + } + + /// + /// Set/Get the text of the feed. + /// + [XmlElement("description")] + public string Text + { + get { return this.text; } + set + { + if (this.text != HTMLUnicodeToString(value)) + { + this.text = HTMLUnicodeToString(value); + NotifyPropertyChanged("rss"); + } + } + } + + /// + /// Set/Get the timestamp of the feed as string. + /// + [XmlElement("pubDate")] + public string Timestamp + { + get { return this.timestamp.ToString("R"); } + set + { + if (this.timestamp != DateTime.Parse(value)) + { + this.timestamp = DateTime.Parse(value); + NotifyPropertyChanged("rss"); + } + } + } + + /// + /// Set/Get the timestamp of the feed as DateTime object. + /// + public DateTime DTTimestamp + { + get { return this.timestamp; } + set { this.timestamp = value; } + } + + /// + /// Return the date of the timestamp as string. + /// example: Mon, 25.06.2013. + /// + public string Date + { + get { return String.Format("{0:ddd, dd.MM.yyyy}", this.timestamp); } + } + + /// + /// Return the time of the timestamp as string. + /// example: 12:56 Uhr. + /// + public string Time + { + get { return String.Format("{0:h:mm} Uhr", this.timestamp); } + } + + /// + /// Gets or sets the ListIndex + /// + public int Index { get; set; } + + /// + /// Set/Get the link/url of the feed. + /// + [XmlElement("link")] + public string Link + { + get { return this.link; } + set + { + if (this.link != value) + { + this.link = value; + NotifyPropertyChanged("rss"); + } + } + } + + /// + /// Remove or transform html-unicode specific tags into ascii. + /// + /// html string + /// ascii string + private string HTMLUnicodeToString(string htmluni) + { + StringBuilder retValue = new StringBuilder(); + + for(int i = 0; i < htmluni.Length; i++) + { + switch (htmluni[i]) + { + // beginning tag of the unicode + case '&': + { + int startOff = i + 2; + // sear closing tag of the unicode + int endOff = htmluni.IndexOf(';', startOff); + // get and parse value inbetween + string sub = htmluni.Substring(startOff, endOff - startOff); + int cVal = int.Parse(sub); + + switch (cVal) + { + // if the unicode value is 128 (€) + case 128: + retValue.Append('€'); + break; + + default: + retValue.Append((char)cVal); + break; + } + + // set the current index to the end of the unicode tag + i = endOff; + } + break; + case '<': + { + // ignoring <..> html tags + i = htmluni.IndexOf('>', i); + } + break; + case '\t': + // removing tabs + break; + + default: + { + // adding other characters to the return string + retValue.Append(htmluni[i]); + } + break; + } + } + + return retValue.ToString(); + } + + /// + /// Comparing function for Datetime-Timestamps. + /// (currently unused) + /// + /// first item + /// secound item + /// + public static int CompareTimeStamp(RSSModel item1, RSSModel item2) + { + if (item1.DTTimestamp > item2.DTTimestamp) + return -1; + else + return 0; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureActivity.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureActivity.cs new file mode 100644 index 00000000..8f5b171e --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureActivity.cs @@ -0,0 +1,221 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 13.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + using CampusAppWP8.Utility; + + /// + /// Model for a Activity + /// + public class LectureActivity + { + #region Members + + /// + /// List of lecturer + /// + private ObservableCollection lecturer; + + /// + /// a formatted string for the names of the lecturers + /// + private string lecturerString; + + /// + /// a formatted string for the names of the courses + /// + private string courseString; + + /// + /// a formatted string for the topic of the lecture + /// + private string topic; + + #endregion + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LectureActivity() + { + } + + #endregion + + #region Proberty + + /// + /// Gets or sets the type of the activity + /// + [XmlElement("art")] + public string Type { get; set; } + + /// + /// Gets or sets the id of the activity + /// + [XmlAttribute("id")] + public int Id { get; set; } + + /// + /// Gets or sets semester of the activity + /// + [XmlElement("semester")] + public int Semester { get; set; } + + /// + /// Gets or sets the contact hour + /// + [XmlElement("sws")] + public string SWS { get; set; } + + /// + /// Gets or sets LectureModule + /// + [XmlElement("modul")] + public LectureModule Modul { get; set; } + + /// + /// Gets or sets LectureTitel + /// + [XmlElement("titel")] + public string Title { get; set; } + + /// + /// Gets or sets the lecturers + /// + [XmlElement("lehrperson")] + public ObservableCollection Lecturer + { + get + { + return this.lecturer; + } + + set + { + if (value != this.lecturer) + { + this.lecturer = value; + } + } + } + + /// + /// Gets or sets the formatted string of the lecturers + /// + public string LecturerString + { + get + { + return this.lecturerString; + } + + set + { + if (value != this.lecturerString) + { + this.lecturerString = value; + } + } + } + + /// + /// Gets or sets formatted string of the courses + /// + public string CourseString + { + get + { + return this.courseString; + } + + set + { + if (value != this.courseString) + { + this.courseString = value; + } + } + } + + /// + /// Gets or sets the courses + /// + [XmlElement("studiengang")] + public ObservableCollection Course { get; set; } + + /// + /// Gets or sets the dates of the activity + /// + [XmlElement("termin")] + public ObservableCollection Dates { get; set; } + + /// + /// Gets or sets the Department + /// + [XmlElement("zugeordnete_einrichtung")] + public string Department { get; set; } + + /// + /// Gets or sets the topic of the Lecture + /// + [XmlElement("lehrinhalt")] + public string Topic + { + get + { + return this.topic; + } + + set + { + if (value != this.topic) + { + this.topic = StringManager.StripHTML(value); + } + } + } + + #endregion + + #region Methods + + /// + /// Method create a formatted string of the LecturerList + /// + public void CreateLectureString() + { + string result = string.Empty; + foreach (LectureLecturer tmpLecturer in this.Lecturer) + { + result += StringManager.AddNewLine(tmpLecturer.ToString()); + } + + this.LecturerString = StringManager.RemvoveNewLine(result); + } + + /// + /// Method create a formatted string of the CourseList + /// + public void CreateCourseString() + { + string result = string.Empty; + foreach (LectureCourse course in this.Course) + { + result += StringManager.AddNewLine(course.Title); + } + + this.CourseString = StringManager.RemvoveNewLine(result); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureCourse.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureCourse.cs new file mode 100644 index 00000000..03d40bf4 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureCourse.cs @@ -0,0 +1,29 @@ +// +// Company copyright tag. +// +// stubbfel +// 10.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System.Xml.Serialization; + + /// + /// Model for a course + /// + public class LectureCourse + { + /// + /// Initializes a new instance of the class. + /// + public LectureCourse() + { + } + + /// + /// Gets or sets the title of the course + /// + [XmlElement("bezeichnung")] + public string Title { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureDate.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureDate.cs new file mode 100644 index 00000000..b84ef789 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureDate.cs @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 10.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System.Xml.Serialization; + + /// + /// Model for the date of an activity + /// + public class LectureDate + { + /// + /// Initializes a new instance of the class. + /// + public LectureDate() + { + } + + /// + /// Gets or sets WeekDay + /// + [XmlElement("wochentag")] + public string WeekDay { get; set; } + + /// + /// Gets or sets From + /// + [XmlElement("von")] + public string From { get; set; } + + /// + /// Gets or sets To + /// + [XmlElement("bis")] + public string To { get; set; } + + /// + /// Gets or sets Interval + /// + [XmlElement("rhythmus")] + public string Interval { get; set; } + + /// + /// Gets or sets Room + /// + [XmlElement("raum")] + public string Room { get; set; } + + /// + /// Gets or sets StartDate + /// + [XmlElement("anfangsdatum")] + public string StartDate { get; set; } + + /// + /// Gets or sets EndDate + /// + [XmlElement("enddatum")] + public string EndDate { get; set; } + + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureLecturer.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureLecturer.cs new file mode 100644 index 00000000..1e2d92e5 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureLecturer.cs @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 10.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System.Xml.Serialization; + + /// + /// Model for a lecturer + /// + public class LectureLecturer + { + /// + /// Initializes a new instance of the class. + /// + public LectureLecturer() + { + } + + /// + /// Gets or sets the FirstName of a lecturer + /// + [XmlElement("vorname")] + public string FirstName { get; set; } + + /// + /// Gets or sets the LastName of a lecturer + /// + [XmlElement("name")] + public string LastName { get; set; } + + /// + /// Gets or sets the title of a lecturer + /// + [XmlElement("titel")] + public string Title { get; set; } + + /// + /// Gets or sets the Responsibility of a lecturer + /// + [XmlAttribute("zustaendigkeit")] + public string Responsibility { get; set; } + + /// + /// Method overrides the base ToString() and create an formatted string of the lecturer + /// + /// returns a string like: [Title] FirstName LastName [(Responsibility)] + public override string ToString() + { + string result = string.Empty; + + if (!this.Title.Equals(string.Empty)) + { + result += this.Title + " "; + } + + result += this.FirstName + " "; + result += this.LastName + " "; + + if (!this.Responsibility.Equals(string.Empty)) + { + result += "(" + this.Responsibility + ") "; + } + + return result; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs new file mode 100644 index 00000000..39ede37a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 10.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// + /// Model for a List of LectureActivity + /// + [XmlRoot("lsf_auszug")] + public class LectureList + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LectureList() + { + } + + #endregion + + #region Proberty + + /// + /// Gets or sets List of the activities + /// + [XmlArray("veranstaltungsliste")] + [XmlArrayItem("veranstaltung")] + public ObservableCollection Activities { get; set; } + + #endregion + + #region Methods + + /// + /// Method return a certain activity + /// + /// id of the activity + /// the activity (FirstOrDefault) + public LectureActivity GetActivity(int id) + { + LectureActivity activity = this.Activities.Where(p => p.Id == id).FirstOrDefault(); + return activity; + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModule.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModule.cs new file mode 100644 index 00000000..1a190438 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModule.cs @@ -0,0 +1,98 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 10.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System; + using System.Xml.Serialization; + using CampusAppWP8.Resources; + + /// + /// Model for the module of an lecture + /// + public class LectureModule + { + #region Members + + /// + /// Number of the module (like an id) + /// + private int number; + + /// + /// Url to the website of the module + /// + private Uri url; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LectureModule() + { + } + + #endregion + + #region Property + + /// + /// Gets or sets the title of the module + /// + [XmlElement("titel")] + public string Title { get; set; } + + /// + /// Gets or sets the number of the module and create the URL + /// + [XmlElement("nummer")] + public int Number + { + get + { + return this.number; + } + + set + { + if (value != this.number) + { + this.number = value; + this.CreateUrl(); + } + } + } + + /// + /// Gets the URL of the module + /// + public Uri Url + { + get + { + return this.url; + } + } + + #endregion + + #region Methods + + /// + /// Method create the url of the module + /// + private void CreateUrl() + { + this.url = new Uri(Constants.UrlLecture_ModulBaseAddr + this.number.ToString()); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs new file mode 100644 index 00000000..c0446795 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -0,0 +1,251 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 18.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System.Collections.Generic; + using System.Linq; + using System.Runtime.Serialization; + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Resources; + + /// + /// Model for the LecturePage + /// + [DataContract] + public class LecturePageModel + { + #region Members + + /// + /// List for the courses of the BTU + /// + /// + /// need to be extend to full list + /// + private List courseList; + + /// + /// List of the degrees + /// + private List degreeList; + + /// + /// List of the semester + /// + private List semesterList; + + /// + /// List for the number of semester + /// + private List numberList; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LecturePageModel() + { + } + #endregion + + #region Proberty + + /// + /// Gets or sets the selected course index + /// + [DataMember] + public int SelectCourseIndex { get; set; } + + /// + /// Gets or sets the selected degree index + /// + [DataMember] + public int SelectDegreeIndex { get; set; } + + /// + /// Gets or sets the selected semester-index + /// + [DataMember] + public int SelectSemesterIndex { get; set; } + + /// + /// Gets or sets the selected from-index + /// + [DataMember] + public int SelectFromIndex { get; set; } + + /// + /// Gets or sets the selected to-index + /// + [DataMember] + public int SelectToIndex { get; set; } + + /// + /// Gets List for the courses of the BTU + /// + public List CourseList + { + get + { + return this.courseList; + } + } + + /// + /// Gets List of the degrees + /// + public List DegreeList + { + get + { + return this.degreeList; + } + } + + /// + /// Gets List of the semester + /// + public List SemesterList + { + get + { + return this.semesterList; + } + } + + /// + /// Gets List for the number of semester + /// + public List NumberList + { + get + { + return this.numberList; + } + } + #endregion + + #region Methods + + #region public + + /// + /// Load all ListPickerLists + /// + public void LoadLists() + { + this.LoadCourseList(); + this.LoadDegreeList(); + this.LoadNumberList(); + this.LoadSemesterList(); + } + + #endregion + + #region private + + /// + /// Load the NumberList + /// + private void LoadNumberList() + { + this.numberList = new List(); + this.numberList.Add(new ListPickerItemModel() { Text = "1", Value = "1" }); + this.numberList.Add(new ListPickerItemModel() { Text = "2", Value = "2" }); + this.numberList.Add(new ListPickerItemModel() { Text = "3", Value = "3" }); + this.numberList.Add(new ListPickerItemModel() { Text = "4", Value = "4" }); + this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "5" }); + this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "6" }); + this.numberList.Add(new ListPickerItemModel() { Text = "7", Value = "7" }); + this.numberList.Add(new ListPickerItemModel() { Text = "8", Value = "8" }); + this.numberList.Add(new ListPickerItemModel() { Text = "9", Value = "9" }); + this.numberList.Add(new ListPickerItemModel() { Text = "10", Value = "10" }); + + } + + /// + /// Load the SemesterList + /// + private void LoadSemesterList() + { + this.semesterList = new List(); + this.semesterList.Add(new ListPickerItemModel() { Text = "SoSe 13", Value = "20131" }); + this.semesterList.Add(new ListPickerItemModel() { Text = "WiSe 13/14", Value = "20132" }); + this.semesterList.Add(new ListPickerItemModel() { Text = "SoSe 14", Value = "20131" }); + } + + /// + /// Load the DegreeList + /// + private void LoadDegreeList() + { + this.degreeList = new List(); + this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Bachelor, Value = "82" }); + this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Master, Value = "88" }); + this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Diploma, Value = "11" }); + } + + /// + /// Load the DegreeList + /// + private void LoadCourseList() + { + this.courseList = new List(); + this.courseList.Add(new ListPickerItemModel() { Text = "Architektur", Value = "013" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Bauingenieurwesen", Value = "017" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Betriebswirtschaftslehre", Value = "021" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsrecht für Technologieunternehmen", Value = "042" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Elektrotechnik", Value = "048" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Informatik ", Value = "079" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Maschinenbau", Value = "104" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Mathematik", Value = "105" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Physik ", Value = "128" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsingenieurwesen", Value = "179" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftswissenschaften ", Value = "184" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Biomedizinische Gerätetechnik ", Value = "215" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik", Value = "226" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsmathematik ", Value = "276" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Kultur und Technik ", Value = "711" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Physik der Halbleiter-Technologie", Value = "744" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Angewandte Mathematik ", Value = "749" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Technologie- und Innovationsmanagement", Value = "764" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Stadt- und Regionalplanung", Value = "766" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Informations- und Medientechnik ", Value = "767" }); + this.courseList.Add(new ListPickerItemModel() { Text = "World Heritage Studies", Value = "768" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen und Verfahrenstechnik", Value = "770" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Environmental and Resource Management", Value = "771" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Landnutzung und Wasserbewirtschaftung", Value = "772" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Bauen und Erhalten", Value = "773" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen", Value = "774" }); + this.courseList.Add(new ListPickerItemModel() { Text = "eBusiness", Value = "794" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Civil Engineering", Value = "798" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Structural Engineering", Value = "799" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Electrical Power Engineering ", Value = "800" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Euro Hydroinformatics and Water Management", Value = "841" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Technologien Biogener Rohstoffe", Value = "842" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Environmental Technologies", Value = "843" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Process Engineering and Plant Design", Value = "844" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Architekturvermittlung", Value = "845" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Nachwachsende Rohstoffe und Erneuerbare Energien", Value = "851" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Energieträger aus Biomasse und Abfällen", Value = "852" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Power Engineering", Value = "853" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik - Prozess- und Anlagentechnik", Value = "857" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Architektur.Studium.Generale", Value = "858" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Verarbeitungstechnologien der Werkstoffe", Value = "860" }); + this.courseList.Add(new ListPickerItemModel() { Text = "Forensic Sciences and Engineering", Value = "871" }); + this.courseList = this.courseList.OrderBy(o => o.Text).ToList(); + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Link/LinkListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Link/LinkListModel.cs new file mode 100644 index 00000000..c512e9ea --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Link/LinkListModel.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Link +{ + using System; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for a list of links. + /// + [XmlRoot("root")] + public class LinkListModel + { + #region Member + + /// + /// Time when the model was created. + /// + private readonly DateTime createTime; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LinkListModel() + { + this.createTime = DateTime.Now; + } + + #endregion + + #region Property + + /// + /// Gets or sets feed information item list. + /// + [XmlArray("data")] + [XmlArrayItem("link")] + public ObservableCollection Links { get; set; } + + /// + /// Gets the creation time of the model. + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Link/LinkModel.cs b/CampusAppWP8/CampusAppWP8/Model/Link/LinkModel.cs new file mode 100644 index 00000000..d25e347d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Link/LinkModel.cs @@ -0,0 +1,173 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Link +{ + using System.Globalization; + using System.Xml.Serialization; + + /// + /// Model for menu + /// + public class LinkModel + { + #region Member + + /// + /// German version of the link title. + /// + private string titleDE; + + /// + /// English version of the link title. + /// + private string titleEN; + + /// + /// German version of the link. + /// + private string linkDE; + + /// + /// English version of the link. + /// + private string linkEN; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LinkModel() + { + } + + #endregion + + #region Property + + /// + /// Gets or sets the german title of the link. + /// + [XmlAttribute("title_de")] + public string Title_DE + { + get + { + return this.titleDE; + } + + set + { + if (value != this.titleDE) + { + this.titleDE = value; + } + } + } + + /// + /// Gets or sets the english title of the link. + /// + [XmlAttribute("title_en")] + public string Title_EN + { + get + { + return this.titleEN; + } + + set + { + this.titleEN = value; + } + } + + /// + /// Gets or sets the german link. + /// + [XmlAttribute("link_de")] + public string Link_DE + { + get + { + return this.linkDE; + } + + set + { + if (value != this.linkDE) + { + this.linkDE = value; + } + } + } + + /// + /// Gets or sets the english link. + /// + [XmlAttribute("link_en")] + public string Link_EN + { + get + { + return this.linkEN; + } + + set + { + if (value != this.linkEN) + { + this.linkEN = value; + } + } + } + + /// + /// Gets the localized title. If the phone is set to german language, + /// the german title will be returned otherwise the english title. + /// + public string Title + { + get + { + if (CultureInfo.CurrentUICulture.Name.StartsWith("de")) + { + return this.titleDE; + } + else + { + return this.titleEN; + } + } + } + + /// + /// Gets the localized link. if the phone is set to german language, + /// the german comment will be returned otherwise the english link. + /// + public string Link + { + get + { + if (CultureInfo.CurrentUICulture.Name.StartsWith("de")) + { + return this.Link_DE; + } + else + { + return this.Link_EN; + } + } + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs new file mode 100644 index 00000000..d2346440 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs @@ -0,0 +1,424 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 05.07.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8 +{ + using System; + using System.IO; + using System.Net; + using System.Text; + using CampusAppWP8.Utility; + + /// + /// Base model io handling class. + /// + /// model type + public abstract class MainModel : IDisposable + { + /// + /// Model io type. + /// + private ModelType modelType; + + /// + /// Model object. + /// + private T model = default(T); + + /// + /// File object. + /// + private CampusAppWP8.Utility.File file = null; + + /// + /// Web object. + /// + private HttpRequest api = null; + + /// + /// Filename of saved data. + /// + private string fileName = string.Empty; + + /// + /// Url of the feed data. + /// + private Uri httpApiUri = null; + + /// + /// Initializes a new instance of the class. + /// + /// Model IO type + /// name of the file + /// url of the feed + public MainModel(ModelType modelType, string fileName, string url) + { + this.modelType = modelType; + + if ((url != null) && (url.Equals(string.Empty) == false)) + { + this.httpApiUri = new Uri(url, UriKind.Absolute); + } + + this.fileName = fileName; + + if ((this.IsFile() == true) + && (fileName.Equals(string.Empty) == false)) + { + this.InitFile(CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync); + } + + if ((this.IsHttpApi() == true) + && (url.Equals(string.Empty) == false)) + { + this.InitHttpApi(); + } + } + + /// + /// Finalizes an instance of the class. + /// + ~MainModel() + { + this.SaveData(); + } + + /// + /// Delegate of the OnLoading callback function. + /// + public delegate void OnLoading(); + + /// + /// Delegate of the OnLoaded callback function. + /// + public delegate void OnLoaded(); + + /// + /// Delegate of the OnSaving callback function. + /// + public delegate void OnSaving(); + + /// + /// Delegate of the OnSaved callback function. + /// + public delegate void OnSaved(); + + /// + /// Delegate of the IsModelUpToDate callback function. + /// + /// data model + /// true, model is up to date + public delegate bool IsModelUpToDate(T model); + + /// + /// Delegate of the IsFileUpToDate callback function. + /// + /// data model + /// info of the file + /// true, is file is up to date + public delegate bool IsFileUpToDate(T model, FileInfo fileInfo); + + /// + /// Callback pointer, called before loading. + /// + public event OnLoading onLoading = null; + + /// + /// Callback pointer, called after loading. + /// + public event OnLoaded onLoaded = null; + + /// + /// Callback pointer, called before saving. + /// + public event OnSaving onSaving = null; + + /// + /// Callback pointer, called after saving. + /// + public event OnSaved onSaved = null; + + /// + /// Callback pointer, for checking if file is up to date. + /// + public event IsFileUpToDate isFileUpToDate = null; + + /// + /// Callback pointer, for checking if model is up to date. + /// + public event IsModelUpToDate isModelUpToDate = null; + + /// + /// Specifies the I/O type of the model. + /// + public enum ModelType + { + /// + /// Invalid/unset state. + /// + INVALID = 0, + + /// + /// File only (01). + /// + File = 1, + + /// + /// Feed only (10). + /// + Feed = 2, + + /// + /// File and feed (11). + /// + FileAndFeed = 3 + } + + /// + /// Gets or sets the Model. + /// + public T Model + { + get + { + return this.model; + } + + set + { + this.model = value; + } + } + + /// + /// Called before finalizing. Can maybe be removed. + /// + public void Dispose() + { + this.SaveData(); + } + + /// + /// Forces a update from web. + /// + public void ForceWebUpdate() + { + if (this.api != null) + { + if (this.onLoading != null) + { + this.onLoading(); + } + + this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete); + } + + } + + /// + /// Load the data if necessary, from web or from file, regarding if + /// the file data is up to date. + /// + public void LoadData() + { + bool loadFromFile = true; + + if (this.onLoading != null) + { + this.onLoading(); + } + + if (((this.isModelUpToDate == null) + || (this.isModelUpToDate(this.model) == false)) + && ((this.file != null) || this.api != null)) + { + if (this.file != null) + { + if ((this.file.Exist() == false) + || (this.file.GetFileInfo().Length == 0)) + { + loadFromFile = false; + } + + if (((this.isFileUpToDate != null) && (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false)) + || (this.isFileUpToDate == null)) + { + loadFromFile = false; + } + } + else + { + loadFromFile = false; + } + + if (this.api == null) + { + loadFromFile = true; + } + + if (loadFromFile == false) + { + this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete); + } + else + { + string data = this.file.ReadFile(); + + if (data != null && !data.Equals(string.Empty)) + { + this.DeserializeModel(Encoding.UTF8.GetBytes(data)); + } + } + } + + if (loadFromFile == true) + { + if (this.onLoaded != null) + { + this.onLoaded(); + } + } + } + + /// + /// Save the model data if necessary. + /// + public void SaveData() + { + if ((this.file != null) + && ((this.isFileUpToDate == null) || (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false))) + { + if (this.onSaving != null) + { + this.onSaving(); + } + + byte[] data = this.SerializeModel(); + this.file.WriteFile(data); + + if (this.onSaved != null) + { + this.onSaved(); + } + } + } + + /// + /// Return the model io type. + /// + /// model io type + public ModelType GetModelType() + { + return this.modelType; + } + + /// + /// Return the model. + /// + /// model object + public T GetModel() + { + return this.model; + } + + /// + /// Abstract declaration of the model deserialize function. + /// + /// model data as byte array + /// true, is succeeded + protected abstract bool DeserializeModel(byte[] modelData); + + /// + /// Abstract declaration of the model serialize function. + /// + /// model data as byte array + protected abstract byte[] SerializeModel(); + + /// + /// Check if the model io type is file. + /// + /// true, if the model io type has file. + protected bool IsFile() + { + bool retValue = false; + + if ((this.modelType & ModelType.File) != 0) + { + retValue = true; + } + + return retValue; + } + + /// + /// Check if the model io type is feed. + /// + /// true if the model io type has feed. + protected bool IsHttpApi() + { + bool retValue = false; + + if ((this.modelType & ModelType.Feed) != 0) + { + retValue = true; + } + + return retValue; + } + + /// + /// Initializes the file object. + /// + /// read io type (Default: sync) + /// write io type (Default: async) + private void InitFile(CampusAppWP8.Utility.File.IOTypeRead readType = CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite writeType = CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync) + { + if ((this.IsFile() == true) + && (this.file == null)) + { + this.file = new CampusAppWP8.Utility.File(this.fileName, readType, writeType); + } + } + + /// + /// Initializes the web object. + /// + private void InitHttpApi() + { + if ((this.IsHttpApi() == true) + && (this.api == null)) + { + this.api = new HttpRequest(); + } + } + + /// + /// Is called after the loading from web is complete. + /// + /// sending object + /// event args + private void OnLoadDataComplete(object sender, DownloadStringCompletedEventArgs e) + { + Exception downloadError = e.Error; + if (downloadError != null) + { + return; + } + + string downloadResult = e.Result; + if (downloadResult != null && !downloadResult.Equals(string.Empty)) + { + this.DeserializeModel(Encoding.UTF8.GetBytes(downloadResult)); + } + + if (this.onLoaded != null) + { + this.onLoaded(); + } + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuModel.cs b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuModel.cs new file mode 100644 index 00000000..06d3aa34 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuModel.cs @@ -0,0 +1,269 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 04.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Mensa +{ + using System; + using System.Xml.Serialization; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// + /// Model for menu + /// + public class MenuModel + { + #region Member + + /// + /// Name for bio dinner + /// + private string bio = AppResources.MensaApp_NotToday; + + /// + /// Name for 1. dinner + /// + private string dinner1 = AppResources.MensaApp_NotToday; + + /// + /// Name for 2. dinner + /// + private string dinner2 = AppResources.MensaApp_NotToday; + + /// + /// Name for 3. dinner + /// + private string dinner3 = AppResources.MensaApp_NotToday; + + /// + /// Name for 4. dinner + /// + private string dinner4 = AppResources.MensaApp_NotToday; + + /// + /// Name for action dinner + /// + private string action = AppResources.MensaApp_NotToday; + + /// + /// Name of the day + /// + private string dayName; + + /// + /// DateTime of the day + /// + private DateTime date; + + /// + /// DateTime of the monday + /// + private DateTime monday; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public MenuModel() + { + this.monday = MenuWeekModel.CalcFirstWeekDay(); + } + + #endregion + + #region Property + + /// + /// Gets or sets the WeekDay + /// + [XmlElement("Wochentag")] + public string Day + { + get + { + return this.dayName; + } + + set + { + this.SetValue(value, ref this.dayName); + this.CalcDateOfDay(); + } + } + + /// + /// Gets or sets of Date + /// + public DateTime Date + { + get + { + return this.date; + } + + set + { + if (value != this.date) + { + this.date = value; + } + } + } + + /// + /// Gets or sets dinner 1 + /// + [XmlElement("Essen1")] + public string Dinner1 + { + get + { + return this.dinner1; + } + + set + { + this.SetValue(value, ref this.dinner1); + } + } + + /// + /// Gets or sets dinner 2 + /// + [XmlElement("Essen2")] + public string Dinner2 + { + get + { + return this.dinner2; + } + + set + { + this.SetValue(value, ref this.dinner2); + } + } + + /// + /// Gets or sets dinner 3 + /// + [XmlElement("Essen3")] + public string Dinner3 + { + get + { + return this.dinner3; + } + + set + { + this.SetValue(value, ref this.dinner3); + } + } + + /// + /// Gets or sets dinner 4 + /// + [XmlElement("Essen4")] + public string Dinner4 + { + get + { + return this.dinner4; + } + + set + { + this.SetValue(value, ref this.dinner4); + } + } + + /// + /// Gets or sets dinner bio + /// + [XmlElement("Bio")] + public string Bio + { + get + { + return this.bio; + } + + set + { + this.SetValue(value, ref this.bio); + } + } + + /// + /// Gets or sets dinner action + /// + [XmlElement("Aktionstag")] + public string Action + { + get + { + return this.action; + } + + set + { + this.SetValue(value, ref this.action); + } + } + + #endregion + + #region Method + + /// + /// Methods sets the property + /// + /// maybe move to base class + /// new property value + /// name of the property + private void SetValue(string value, ref string property) + { + if (value != null && !string.Empty.Equals(value) && !value.Equals(property)) + { + property = StringManager.StripHTML(value); + } + } + + /// + /// Method calculate the DateTime of the MenuDay + /// + private void CalcDateOfDay() + { + switch (this.dayName) + { + case "Montag": + this.date = this.monday; + break; + case "Diensttag": + this.date = this.monday.AddDays(1); + break; + case "Mittwoch": + this.date = this.monday.AddDays(2); + break; + case "Donnerstag": + this.date = this.monday.AddDays(3); + break; + case "Freitag": + this.date = this.monday.AddDays(4); + break; + default: + this.date = this.monday; + break; + } + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs new file mode 100644 index 00000000..4093eae8 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs @@ -0,0 +1,81 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 03.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Mensa +{ + using System; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for menus in one week + /// + [XmlRoot("root")] + public class MenuWeekModel + { + #region Members + /// + /// Time when the model was created + /// + private readonly DateTime createTime; + + /// + /// Initializes a new instance of the class. + /// + public MenuWeekModel() + { + this.createTime = DateTime.Now; + } + + #endregion + + #region Constructor + + /// + /// Gets or sets the menus for the week + /// + [XmlArray("BTU")] + [XmlArrayItem("Tagesmenu")] + public ObservableCollection Menus { get; set; } + + #endregion + + #region Proberty + /// + /// Gets the creation time of the model + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + + #endregion + + #region Methods + + /// + /// Method calculate this day of the week, which its gets new menus + /// + /// Date of NewMenuWeekDay + public static DateTime CalcFirstWeekDay() + { + DateTime now = DateTime.Now; + while (now.DayOfWeek != DayOfWeek.Monday) + { + now = now.Subtract(new TimeSpan(1, 0, 0, 0)); + } + + DateTime monday = new DateTime(now.Year, now.Month, now.Day); + return monday; + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursInstitutionModel.cs b/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursInstitutionModel.cs new file mode 100644 index 00000000..8acc2b0a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursInstitutionModel.cs @@ -0,0 +1,581 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Openinghours +{ + using System.Globalization; + using System.Windows; + using System.Xml.Serialization; + + /// + /// Model for menu + /// + public class OpeninghoursInstitutionModel + { + #region Member + + /// + /// German version of the institution title. + /// + private string titleDE = string.Empty; + + /// + /// English version of the institution title. + /// + private string titleEN = string.Empty; + + /// + /// Opening hours on monday. + /// + private string dayMonday = string.Empty; + + /// + /// Opening hours on tuesday. + /// + private string dayTuesday = string.Empty; + + /// + /// Opening hours on wednesday. + /// + private string dayWednesday = string.Empty; + + /// + /// Opening hours on thursday. + /// + private string dayThursday = string.Empty; + + /// + /// Opening hours on friday. + /// + private string dayFriday = string.Empty; + + /// + /// Opening hours on saturday. + /// + private string daySaturday = string.Empty; + + /// + /// Opening hours on sunday. + /// + private string daySunday = string.Empty; + + /// + /// Email address of the institution. + /// + private string infoEmail = string.Empty; + + /// + /// Phone number of the institution. + /// + private string infoPhone = string.Empty; + + /// + /// Building name where the institution is located. + /// + private string infoBuilding = string.Empty; + + /// + /// Room where the institution is located. + /// + private string infoRoom = string.Empty; + + /// + /// German version of the comment. + /// + private string commentDE = string.Empty; + + /// + /// English version of the comment. + /// + private string commentEN = string.Empty; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public OpeninghoursInstitutionModel() + { + } + + #endregion + + #region Property + + /// + /// Gets or sets the german title of the institution. + /// + [XmlAttribute("title_de")] + public string Title_DE + { + get + { + return this.titleDE; + } + + set + { + this.titleDE = value; + } + } + + /// + /// Gets or sets the english title of the institution. + /// + [XmlAttribute("title_en")] + public string Title_EN + { + get + { + return this.titleEN; + } + + set + { + this.titleEN = value; + } + } + + /// + /// Gets or sets the open hours on monday. + /// + [XmlAttribute("monday")] + public string Monday + { + get + { + return this.dayMonday; + } + + set + { + this.dayMonday = this.FixOpeninghoursString(value); + } + } + + /// + /// Gets or sets the open hours on tuesday. + /// + [XmlAttribute("tuesday")] + public string Tuesday + { + get + { + return this.dayTuesday; + } + + set + { + this.dayTuesday = this.FixOpeninghoursString(value); + } + } + + /// + /// Gets or sets the open hours on wednesday. + /// + [XmlAttribute("wednesday")] + public string Wednesday + { + get + { + return this.dayWednesday; + } + + set + { + this.dayWednesday = this.FixOpeninghoursString(value); + } + } + + /// + /// Gets or sets the open hours on thursday. + /// + [XmlAttribute("thursday")] + public string Thursday + { + get + { + return this.dayThursday; + } + + set + { + this.dayThursday = this.FixOpeninghoursString(value); + } + } + + /// + /// Gets or sets the open hours on friday. + /// + [XmlAttribute("friday")] + public string Friday + { + get + { + return this.dayFriday; + } + + set + { + this.dayFriday = this.FixOpeninghoursString(value); + } + } + + /// + /// Gets or sets the open hours on saturday. + /// + [XmlAttribute("saturday")] + public string Saturday + { + get + { + return this.daySaturday; + } + + set + { + this.daySaturday = this.FixOpeninghoursString(value); + } + } + + /// + /// Gets or sets the open hours on sunday. + /// + [XmlAttribute("sunday")] + public string Sunday + { + get + { + return this.daySunday; + } + + set + { + this.daySunday = this.FixOpeninghoursString(value); + } + } + + /// + /// Gets or sets the email address of the institution. + /// + [XmlAttribute("email")] + public string EMail + { + get + { + return this.infoEmail; + } + + set + { + this.infoEmail = value; + } + } + + /// + /// Gets or sets the phone number of the institution. + /// + [XmlAttribute("phone")] + public string Phone + { + get + { + return this.infoPhone; + } + + set + { + this.infoPhone = value; + } + } + + /// + /// Gets or sets the building where the institution is located. + /// + [XmlAttribute("location_building")] + public string Building + { + get + { + return this.infoBuilding; + } + + set + { + this.infoBuilding = value; + } + } + + /// + /// Gets or sets the room where the institution is located. + /// + [XmlAttribute("location_room")] + public string Room + { + get + { + return this.infoRoom; + } + + set + { + this.infoRoom = value; + } + } + + /// + /// Gets or sets the german comment. + /// + [XmlAttribute("comment_de")] + public string Comment_DE + { + get + { + return this.commentDE; + } + + set + { + this.commentDE = value; + } + } + + /// + /// Gets or sets the english comment. + /// + [XmlAttribute("comment_en")] + public string Comment_EN + { + get + { + return this.commentEN; + } + + set + { + this.commentEN = value; + } + } + + /// + /// Gets the localized title. If the phone is set to german language, + /// the german title will be returned otherwise the english title. + /// + public string Title + { + get + { + if (CultureInfo.CurrentUICulture.Name.StartsWith("de")) + { + return this.titleDE; + } + else + { + return this.titleEN; + } + } + } + + /// + /// Gets the localized comment. if the phone is set to german language, + /// the german comment will be returned otherwise the english comment. + /// + public string Comment + { + get + { + if (CultureInfo.CurrentUICulture.Name.StartsWith("de")) + { + return this.commentDE; + } + else + { + return this.commentEN; + } + } + } + + /// + /// Gets a string containing the email address and the institution + /// title separated by ':'. + /// + public string EMailTitle + { + get + { + return this.EMail + ":" + this.Title; + } + } + + /// + /// Gets a string containing the phone number and the institution + /// title separated by ':'. + /// + public string PhoneTitle + { + get + { + return this.Phone + ":" + this.Title; + } + } + + /// + /// Gets the visibility state of the monday TextBlock. + /// + public Visibility VisibleMonday + { + get + { + return ((this.dayMonday == string.Empty) || (this.dayMonday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the tuesday TextBlock. + /// + public Visibility VisibleTuesday + { + get + { + return ((this.dayTuesday == string.Empty) || (this.dayTuesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the wednesday TextBlock. + /// + public Visibility VisibleWednesday + { + get + { + return ((this.dayWednesday == string.Empty) || (this.dayWednesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the thursday TextBlock. + /// + public Visibility VisibleThursday + { + get + { + return ((this.dayThursday == string.Empty) || (this.dayThursday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the friday TextBlock. + /// + public Visibility VisibleFriday + { + get + { + return ((this.dayFriday == string.Empty) || (this.dayFriday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the saturday TextBlock. + /// + public Visibility VisibleSaturday + { + get + { + return ((this.daySaturday == string.Empty) || (this.daySaturday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the sunday TextBlock. + /// + public Visibility VisibleSunday + { + get + { + return ((this.daySunday == string.Empty) || (this.daySunday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the comment. + /// + public Visibility VisibleComment + { + get + { + return ((this.Comment == string.Empty) || (this.Comment.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the email address. + /// + public Visibility VisibleEMail + { + get + { + return ((this.infoEmail == string.Empty) || (this.infoEmail.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the phone number. + /// + public Visibility VisiblePhone + { + get + { + return ((this.infoPhone == string.Empty) || (this.infoPhone.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the room. + /// + public Visibility VisibleRoom + { + get + { + return ((this.infoRoom == string.Empty) || (this.infoRoom.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility state of the building. + /// + public Visibility VisibleBuilding + { + get + { + return ((this.infoBuilding == string.Empty) || (this.infoBuilding.Length == 0)) ? Visibility.Collapsed : Visibility.Visible; + } + } + + #endregion + + #region Method + + /// + /// Removes unwanted chars in a string. + /// + /// input string + /// fixed string + private string FixOpeninghoursString(string str) + { + string retValue = string.Empty; + + retValue = str.Replace(" | ", "\n"); + + return retValue; + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursModel.cs b/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursModel.cs new file mode 100644 index 00000000..77d3a16a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursModel.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Openinghours +{ + using System; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for opening hours. + /// + [XmlRoot("root")] + public class OpeninghoursModel + { + #region Member + + /// + /// Time when the model was created. + /// + private readonly DateTime createTime; + + /// + /// Gets or sets feed information item list. + /// + [XmlArray("data")] + [XmlArrayItem("institution")] + public ObservableCollection institutions { get; set; } + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public OpeninghoursModel() + { + this.createTime = DateTime.Now; + } + + #endregion + + #region Property + + /// + /// Gets the creation time of the model. + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + + /// + /// Gets the Institutions. + /// + public ObservableCollection Institutions + { + get + { + return this.institutions; + } + } + + #endregion + + #region Method + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/RSS/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSChannelModel.cs new file mode 100644 index 00000000..52c1d499 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSChannelModel.cs @@ -0,0 +1,56 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Model.RSS +{ + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Channel Model, which contains the RSS feed item list. + /// + public class RSSChannelModel + { + /// + /// RSS feed information item list. + /// + private ObservableCollection item; + + /// + /// Initializes a new instance of the class. + /// + public RSSChannelModel() + { + this.item = new ObservableCollection(); + } + + /// + /// Gets or sets the RSS feed item list. + /// + [XmlElement("item")] + public ObservableCollection Item + { + get + { + return this.item; + } + + set + { + if (value != this.item) + { + this.item = value; + int i = 0; + foreach (RSSModel rssItem in this.item) + { + rssItem.Index = i++; + } + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/RSS/RSSModel.cs b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSModel.cs new file mode 100644 index 00000000..725cd074 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSModel.cs @@ -0,0 +1,256 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Model.RSS +{ + using System; + using System.Text; + using System.Xml.Serialization; + + /// + /// Contains the RSS feed information. + /// + public class RSSModel + { + /// + /// Index of this object. + /// + private int index = -1; + + /// + /// Title of the fees + /// + private string title; + + /// + /// Description text of the feed. + /// + private string text; + + /// + /// Timestamp (publication date) of the event or news. + /// + private DateTime timestamp; + + /// + /// Url of the feed. + /// + private string link; + + /// + /// Gets or sets the title of the feed. + /// + [XmlElement("title")] + public string Title + { + get + { + return this.title; + } + + set + { + if (this.title != value) + { + this.title = value; + } + } + } + + /// + /// Gets or sets the text of the feed. + /// + [XmlElement("description")] + public string Text + { + get + { + return this.text; + } + + set + { + if (this.text != this.HTMLUnicodeToString(value)) + { + this.text = this.HTMLUnicodeToString(value); + } + } + } + + /// + /// Gets or sets the timestamp of the feed as string. + /// + [XmlElement("pubDate")] + public string Timestamp + { + get + { + return this.timestamp.ToString("R"); + } + + set + { + if (this.timestamp != DateTime.Parse(value)) + { + this.timestamp = DateTime.Parse(value); + } + } + } + + /// + /// Gets or sets the timestamp of the feed as DateTime object. + /// + public DateTime DTTimestamp + { + get + { + return this.timestamp; + } + + set + { + this.timestamp = value; + } + } + + /// + /// Gets the date of the timestamp as string. + /// example: Mon, 25.06.2013. + /// + public string Date + { + get + { + return string.Format("{0:ddd, dd.MM.yyyy}", this.timestamp); + } + } + + /// + /// Gets the time of the timestamp as string. + /// example: 12:56 Uhr. + /// + public string Time + { + get + { + return string.Format("{0:h:mm} Uhr", this.timestamp); + } + } + + /// + /// Gets or sets the link/url of the feed. + /// + [XmlElement("link")] + public string Link + { + get + { + return this.link; + } + + set + { + if (this.link != value) + { + this.link = value; + } + } + } + + /// + /// Gets or sets the ListIndex. + /// + public int Index + { + get + { + return this.index; + } + + set + { + this.index = value; + } + } + + /// + /// Comparing function for DateTime timestamps. + /// (currently unused) + /// + /// first item + /// second item + /// -1 if item2 is older then item1, otherwise 0 + public static int CompareTimeStamp(RSSModel item1, RSSModel item2) + { + if (item1.DTTimestamp > item2.DTTimestamp) + { + return -1; + } + else + { + return 0; + } + } + + /// + /// Remove or transform html-unicode specific tags into ASCII. + /// + /// html string + /// ASCII string + private string HTMLUnicodeToString(string htmluni) + { + StringBuilder retValue = new StringBuilder(); + + for (int i = 0; i < htmluni.Length; i++) + { + switch (htmluni[i]) + { + // beginning tag of the unicode + case '&': + int startOff = i + 2; + //// sear closing tag of the unicode + int endOff = htmluni.IndexOf(';', startOff); + //// get and parse value inbetween + string sub = htmluni.Substring(startOff, endOff - startOff); + int charVal = int.Parse(sub); + + switch (charVal) + { + // if the unicode value is 128 (€) + case 128: + retValue.Append('€'); + break; + + default: + retValue.Append((char)charVal); + break; + } + + // set the current index to the end of the unicode tag + i = endOff; + break; + + case '<': + // ignoring <..> html tags + i = htmluni.IndexOf('>', i); + break; + + case '\t': + // removing tabs + break; + + default: + // adding other characters to the return string + retValue.Append(htmluni[i]); + break; + } + } + + return retValue.ToString(); + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/RSS/RSSViewModel.cs b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSViewModel.cs new file mode 100644 index 00000000..e09a01f0 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSViewModel.cs @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Model.RSS +{ + using System; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// ViewModel of the RSS feed, containing the feed/channel object. + /// + [XmlRoot("root")] + public class RSSViewModel + { + /// + /// Object to store the time when the instance was created. + /// + private DateTime createTime; + + /// + /// Channel list for the RSS feeds. + /// + private ObservableCollection channel; + + /// + /// Initializes a new instance of the class. + /// + public RSSViewModel() + { + this.channel = new ObservableCollection(); + this.createTime = DateTime.Now; + } + + /// + /// Gets or sets the channel list. + /// + [XmlArray("rss")] + [XmlArrayItem("channel")] + public ObservableCollection Channel + { + get + { + return this.channel; + } + + set + { + if (value != this.channel) + { + this.channel = value; + } + } + } + + /// + /// Gets the creation time. + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilListModel.cs b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilListModel.cs new file mode 100644 index 00000000..1a935a1a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilListModel.cs @@ -0,0 +1,80 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.StudentCouncil +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// + /// Model for menus in one week + /// + [XmlRoot("root")] + public class StudentCouncilListModel + { + #region Members + /// + /// Time when the model was created + /// + private readonly DateTime createTime; + + #endregion + #region Constructor + /// + /// Initializes a new instance of the class. + /// + public StudentCouncilListModel() + { + this.createTime = DateTime.Now; + } + + #endregion + + #region Proberty + /// + /// Gets or sets the StudentCouncils + /// + [XmlArray("data")] + [XmlArrayItem("studentcouncil")] + public ObservableCollection StudentCouncils { get; set; } + + /// + /// Gets the creation time of the model + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + + #endregion + + #region Method + /// + /// Method group the StudentCouncilList by Faculty + /// + /// a Dictionary, where the Key is name of the Faculty und the value is a List of StudentCouncil + public Dictionary> GetStudentCouncilsGroupByFaculty() + { + List> tmpList = this.StudentCouncils.GroupBy(p => p.Faculty).ToList(); + Dictionary> itemMap = new Dictionary>(); + foreach (IGrouping group in tmpList) + { + Dictionary> tempDic = new Dictionary>(); + itemMap.Add(group.Key, group.ToList()); + } + + return itemMap; + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilModel.cs b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilModel.cs new file mode 100644 index 00000000..1009645e --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilModel.cs @@ -0,0 +1,86 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.StudentCouncil +{ + using System.Xml.Serialization; + using CampusAppWP8.Resources; + + /// + /// Model for menu + /// + public class StudentCouncilModel + { + #region Member + + /// + /// name of the faculty. + /// + private string faculty; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public StudentCouncilModel() + { + } + + #endregion + + #region Property + + /// + /// Gets or sets the faculty of the StudentCouncil. + /// + [XmlAttribute("faculty")] + public string Faculty + { + get + { + return this.faculty; + } + + set + { + if (value != this.faculty) + { + this.faculty = value; + int num; + if (int.TryParse(this.faculty, out num)) + { + this.faculty = AppResources.Faculty + " " + num; + } + } + } + } + + /// + /// Gets or sets the name of the StudentCouncil. + /// + [XmlAttribute("name")] + public string Name { get; set; } + + /// + /// Gets or sets the webpage-url of the StudentCouncil. + /// + [XmlAttribute("url")] + public string Url { get; set; } + + /// + /// Gets or sets the email-address of the StudentCouncil. + /// + [XmlAttribute("email")] + public string Email { get; set; } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs new file mode 100644 index 00000000..f5e6cba8 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/ListPickerItemModel.cs @@ -0,0 +1,25 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 13.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + /// + /// Model for the ListPickerItems + /// + public class ListPickerItemModel + { + /// + /// Gets or sets the Value of an Item + /// + public string Value { get; set; } + + /// + /// Gets or sets the Text (caption) of an Item + /// + public string Text { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs new file mode 100644 index 00000000..c8d9c1a2 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs @@ -0,0 +1,96 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 17.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + /// + /// This class is a Model for the URLParameter like GET-Parameter + /// + public class UrlParamModel + { + #region Members + + /// + /// Variable of the key + /// + private readonly string key; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + /// the key for the parameter + public UrlParamModel(string key) + { + this.key = key; + } + + /// + /// Initializes a new instance of the class. + /// + /// the key for the parameter> + /// value of the parameter + public UrlParamModel(string key, string value) + { + this.key = key; + this.Value = value; + } + #endregion + #region Proberty + + /// + /// Gets or sets the value of the Parameter + /// + public string Value { get; set; } + + /// + /// Gets the key of the parameter + /// + public string Key + { + get + { + return this.key; + } + } + #endregion + + #region Methods + + /// + /// Method check if the parameter is valid + /// + /// true if is it valid, otherwise false + public virtual bool IsParamValid() + { + if (this.key == null || string.Empty.Equals(this.key) || string.Empty.Equals(this.Value)) + { + return false; + } + + return true; + } + + /// + /// Method return a formatted string like Key=Value + /// + /// return formatted string + public override string ToString() + { + if (!this.IsParamValid()) + { + return string.Empty; + } + + return "&" + this.key + "=" + this.Value; + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs new file mode 100644 index 00000000..4baedf31 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/XmlModel.cs @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 05.07.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Model +{ + using System.Text; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// + /// Xml model io handler class. + /// + /// model type + public class XmlModel : MainModel + { + /// + /// Initializes a new instance of the class. + /// + /// model io type + /// filename of the data file + /// url of the feed data + public XmlModel(ModelType modelType, string fileName, string url) + : base(modelType, fileName, url) + { + } + + /// + /// Create the model from a xml byte array. + /// + /// model data + /// true, if succeeded + protected override bool DeserializeModel(byte[] modelData) + { + bool retValue = true; + + string data = Encoding.UTF8.GetString(modelData, 0, modelData.Length); + + T tempModel = XmlManager.DeserializationToModel(data, Constants.XMLRootElementName); + if (tempModel != null) + { + this.Model = tempModel; + } + else + { + retValue = false; + } + + return retValue; + } + + /// + /// Serializes the model to a byte array. + /// + /// model data + protected override byte[] SerializeModel() + { + byte[] retValue = null; + + if (this.Model != null) + { + retValue = Encoding.UTF8.GetBytes(XmlManager.SerializationToString(this.Model)); + } + + return retValue; + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml new file mode 100644 index 00000000..2aa7d7f9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs new file mode 100644 index 00000000..2c6d8535 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using System.Windows.Media; +using CampusAppWP8.Model.Campusmap; +using System.Windows.Media.Imaging; + +namespace CampusAppWP8.Pages.Campusmap +{ + public partial class CampusMapPage : PhoneApplicationPage + { + private MapModel map; + public CampusMapPage() + { + InitializeComponent(); + this.map = new MapModel() { ImageSource = "/Assets/testmap.png", ImageWidth = 2000, ImageHeight = 2000, MapImageOffsetX = -228, MapImageOffsetY = -300, RefPoint = new Point(1000, 1000), Scale = 20}; + this.MapCanvas.DataContext = map; + + } + + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + } + + /// + /// Methods overrides the OnNavigatedTo-Method + /// + /// some NavigationEventArgs + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + MapCanvas.Children.Clear(); + Point scrollPoint = map.GetScrollPoint(map.ConverToPixelPoint(double.Parse(XPoint.Text), double.Parse(YPoint.Text))); + MapCanvas.Children.Add(map.AddPinFromRefPoint(map.ConverToPixelPoint(double.Parse(XPoint.Text), double.Parse(YPoint.Text)))); + + MapScroller.ScrollToVerticalOffset(scrollPoint.Y); + MapScroller.ScrollToHorizontalOffset(scrollPoint.X); + + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml new file mode 100644 index 00000000..fb8dd7df --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml.cs new file mode 100644 index 00000000..2647fdf7 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentFavoritePage.xaml.cs @@ -0,0 +1,112 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 01.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Departments +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Navigation; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Page to visualize the favorite department list. + /// + public partial class DepartmentFavoritePage : PhoneApplicationPage + { + /// + /// Object to store the last clicked chair button. + /// + private FrameworkElement lastClickedBtn = null; + + /// + /// Initializes a new instance of the class. + /// + public DepartmentFavoritePage() + { + this.InitializeComponent(); + } + + /// + /// On navigation to this page. + /// Initialize the list source. + /// + /// event args + protected override void OnNavigatedTo(NavigationEventArgs e) + { + this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs; + } + + /// + /// On clicking on a chair button. + /// Open or close the chair details. + /// + /// clicked button + /// event args + private void ChairTB_Click(object sender, RoutedEventArgs e) + { + FrameworkElement tempBtn = sender as FrameworkElement; + StackPanel tempParent = null; + + if (tempBtn == this.lastClickedBtn) + { + tempParent = this.lastClickedBtn.Parent as StackPanel; + tempParent.Children[1].Visibility = Visibility.Collapsed; + this.lastClickedBtn = null; + } + else + { + if (this.lastClickedBtn != null) + { + tempParent = this.lastClickedBtn.Parent as StackPanel; + tempParent.Children[1].Visibility = Visibility.Collapsed; + } + + tempParent = tempBtn.Parent as StackPanel; + tempParent.Children[1].Visibility = Visibility.Visible; + + this.lastClickedBtn = tempBtn; + } + } + + /// + /// On clicking on a delete button. + /// Removes the chair from the favorite list. + /// + /// clicked button + /// event args + private void DeleteBtn_Click(object sender, RoutedEventArgs e) + { + Button btn = this.lastClickedBtn as Button; + TextBlock btnText = btn.Content as TextBlock; + + if (DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].RemoveChair(btnText.Text) == true) + { + MessageBox.Show(AppResources.DeleteSucceeded); + } + else + { + MessageBox.Show(AppResources.DeleteFailed); + } + } + + /// + /// On clicking on a info button. + /// Open a department info page. + /// + /// clicked button + /// event args + private void InfoBtn_Click(object sender, RoutedEventArgs e) + { + FrameworkElement infoBtn = sender as FrameworkElement; + string chairName = ((this.lastClickedBtn as Button).Content as TextBlock).Text.ToString(); + + NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?url=" + infoBtn.Tag.ToString() + "&name=" + chairName, UriKind.Relative)); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml new file mode 100644 index 00000000..7cf96e78 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs new file mode 100644 index 00000000..9c048b81 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentIndexPage.xaml.cs @@ -0,0 +1,160 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Departments +{ + using System; + using System.Linq; + using System.Windows; + using System.Windows.Navigation; + using CampusAppWP8.Feed.Departments; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Page with a list of the faculties. + /// + public partial class DepartmentIndexPage : PhoneApplicationPage + { + /// + /// Department/chair feed object, storing the model and data. + /// + private static DepartmentFeed feed = null; + + /// + /// Department feed object for storing the favorite list. + /// + private static DepartmentFavoriteFeed favorite = null; + + /// + /// Initializes a new instance of the class. + /// + public DepartmentIndexPage() + { + this.InitializeComponent(); + + //// init feed objects + if (DepartmentIndexPage.feed == null) + { + DepartmentIndexPage.feed = new DepartmentFeed(false); + } + + DepartmentIndexPage.feed.onLoaded += new DepartmentFeed.OnLoaded(this.SetupFacultyList); + DepartmentIndexPage.feed.LoadData(); + + if (DepartmentIndexPage.favorite == null) + { + DepartmentIndexPage.favorite = new DepartmentFavoriteFeed(false); + } + + DepartmentIndexPage.favorite.onLoaded += new DepartmentFavoriteFeed.OnLoaded(this.CheckFavoriteFeed); + DepartmentIndexPage.favorite.LoadData(); + } + + /// + /// Return the feed object of the departments. + /// + /// feed object + public static DepartmentFeed GetFeed() + { + return DepartmentIndexPage.feed; // DepartmentIndexPage.feed; + } + + /// + /// Return the feed object of the favorite departments. + /// + /// feed object + public static DepartmentFavoriteFeed GetFavoriteFeed() + { + return DepartmentIndexPage.favorite; // DepartmentIndexPage.favorite; + } + + /// + /// On navigation to this page. + /// Initialize the feed loading. + /// + /// event args + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + if (NavigationMode.Back != e.NavigationMode) + { + } + } + + /// + /// On navigation from this page. + /// Store the favorite list. + /// + /// event args + protected override void OnNavigatedFrom(NavigationEventArgs e) + { + if (NavigationMode.Back == e.NavigationMode) + { + DepartmentIndexPage.favorite.SaveData(); + } + + base.OnNavigatedFrom(e); + } + + /// + /// On orientation changed. + /// + /// sender object + /// event args + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + } + + /// + /// Setup the faculty list. + /// + private void SetupFacultyList() + { + this.FacultyList.ItemsSource = DepartmentIndexPage.feed.GetModel().Faculties; + } + + /// + /// Checks if the favorite feed is valid. + /// + private void CheckFavoriteFeed() + { + if (DepartmentIndexPage.favorite.GetModel() == null) + { + DepartmentIndexPage.favorite.Model = new Model.Departments.DepartmentModel(); + } + + if (DepartmentIndexPage.favorite.GetModel().Faculties.Count() == 0) + { + DepartmentIndexPage.favorite.Model.Faculties.Add(new Model.Departments.FacultyModel("favorites")); + } + } + + /// + /// On clicking on the favorite button. + /// + /// clicked button + /// event args + private void FavoriteBtn_Click(object sender, RoutedEventArgs e) + { + NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentFavoritePage, UriKind.Relative)); + } + + /// + /// On clicking on a faculty button. + /// + /// clicked button + /// event args + private void FacultyBtn_Click(object sender, RoutedEventArgs e) + { + FrameworkElement tempElem = sender as FrameworkElement; + + NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentPage + "?pivotindex=" + tempElem.Tag, UriKind.Relative)); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentInfoPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentInfoPage.xaml new file mode 100644 index 00000000..19d9b033 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentInfoPage.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentInfoPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentInfoPage.xaml.cs new file mode 100644 index 00000000..4f9f7c22 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentInfoPage.xaml.cs @@ -0,0 +1,56 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 01.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Departments +{ + using System; + using System.Windows.Navigation; + using Microsoft.Phone.Controls; + + /// + /// Info page of a chair. + /// + public partial class DepartmentInfoPage : PhoneApplicationPage + { + /// + /// Initializes a new instance of the class. + /// + public DepartmentInfoPage() + { + this.InitializeComponent(); + } + + /// + /// On navigation to this page. + /// Initialize the page headline text. + /// + /// event args + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + string url = string.Empty; + string chairName = string.Empty; + + if (NavigationContext.QueryString.TryGetValue("url", out url) + && NavigationContext.QueryString.TryGetValue("name", out chairName)) + { + this.PageHeadline.Text = chairName; + this.WebBrowser.Navigate(new Uri(url, UriKind.Absolute)); + } + } + + /// + /// On orientation changed. + /// + /// sender object + /// event args + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml new file mode 100644 index 00000000..775f1c5d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs new file mode 100644 index 00000000..17af2974 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs @@ -0,0 +1,149 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Departments +{ + using System; + using System.Linq; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Navigation; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Pivot page with list of the chairs of the faculties. + /// + public partial class DepartmentPage : PhoneApplicationPage + { + /// + /// For checking, if the source of the list is already set. + /// + private bool isSourceSet = false; + + /// + /// Last clicked button object. + /// + private FrameworkElement lastClickedBtn = null; + + /// + /// Initializes a new instance of the class. + /// + public DepartmentPage() + { + this.InitializeComponent(); + } + + /// + /// On navigation to this page. + /// Initialize the feed loading. + /// + /// event args + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + if (this.isSourceSet == false) + { + this.DepartmentPivot.ItemsSource = DepartmentIndexPage.GetFeed().GetModel().Faculties; + this.isSourceSet = true; + } + + string pivotIndex = string.Empty; + + // Navigate to the selected pivotitem + if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex)) + { + int pivotIndexInt = int.Parse(pivotIndex) - 1; + + // if the index is in the range of the array + if ((pivotIndexInt >= 0) && (pivotIndexInt < DepartmentIndexPage.GetFeed().GetModel().Faculties.Count())) + { + DepartmentPivot.SelectedIndex = pivotIndexInt; + } + else + { + MessageBox.Show("ERROR: pivotIndex out of range!!!"); + } + } + } + + /// + /// On orientation changed. + /// + /// sender object + /// event args + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + } + + /// + /// On clicking a chair TextBlock. + /// Open the browser with the url of the chair. + /// + /// clicked chair TextBlock + /// event args + private void ChairTB_Click(object sender, RoutedEventArgs e) + { + FrameworkElement tempBtn = sender as FrameworkElement; + StackPanel tempParent = null; + + if (this.lastClickedBtn != tempBtn) + { + if (this.lastClickedBtn != null) + { + tempParent = this.lastClickedBtn.Parent as StackPanel; + tempParent.Children[1].Visibility = Visibility.Collapsed; + } + + tempParent = tempBtn.Parent as StackPanel; + tempParent.Children[1].Visibility = Visibility.Visible; + + this.lastClickedBtn = tempBtn; + } + else + { + tempParent = this.lastClickedBtn.Parent as StackPanel; + tempParent.Children[1].Visibility = Visibility.Collapsed; + this.lastClickedBtn = null; + } + } + + /// + /// On clicking on a add button. + /// Add the chair to the favorite list. + /// + /// clicked button + /// event args + private void AddBtn_Click(object sender, RoutedEventArgs e) + { + Button btn = this.lastClickedBtn as Button; + TextBlock btnText = btn.Content as TextBlock; + + Model.Departments.ChairModel tempModel = DepartmentIndexPage.GetFeed().GetModel().Faculties[this.DepartmentPivot.SelectedIndex].GetChairModel(btnText.Text); + + if (tempModel != null) + { + DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].AddChair(tempModel); + } + } + + /// + /// On clicking on a info button. + /// Open the info page to this chair. + /// + /// clicked button + /// event args + private void InfoBtn_Click(object sender, RoutedEventArgs e) + { + FrameworkElement infoBtn = sender as FrameworkElement; + string chairName = ((this.lastClickedBtn as Button).Content as TextBlock).Text.ToString(); + + NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?url=" + infoBtn.Tag.ToString() + "&name=" + chairName, UriKind.Relative)); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml new file mode 100644 index 00000000..91c75427 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs new file mode 100644 index 00000000..d79cc557 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 03.05.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Events +{ + using System.Linq; + using System.Windows.Navigation; + using CampusAppWP8.Feed.Events; + using CampusAppWP8.Utility; + using Microsoft.Phone.Controls; + + /// + /// Overview page of all events. + /// + public partial class EventIndexPage : PhoneApplicationPage + { + /// + /// Event Feed object, which contains the RSS models and data. + /// + private static EventFeed eventFeed = null; + + /// + /// Initializes a new instance of the class. + /// + public EventIndexPage() + { + this.InitializeComponent(); + + if (EventIndexPage.eventFeed == null) + { + EventIndexPage.eventFeed = new EventFeed(false); + } + + EventIndexPage.eventFeed.onLoaded += new EventFeed.OnLoaded(this.SetupEventPageList); + EventIndexPage.eventFeed.LoadData(); + } + + /// + /// Return the eventFeed object. + /// + /// event feed object + public static EventFeed GetEventFeed() + { + return EventIndexPage.eventFeed; + } + + /// + /// On navigation to this page, creates a FeedEventHandler and load the RSS feed data. + /// + /// event args + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + } + + /// + /// Is called after the RSS feeds are loaded into the eventFeed model. + /// If there was no feed information set to the UI, the feed list + /// will be sorted by timestamp and the buttons will be created. + /// + private void SetupEventPageList() + { + this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item; + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml new file mode 100644 index 00000000..0f72f4bf --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs new file mode 100644 index 00000000..d1b83c22 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -0,0 +1,205 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 13.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Lecture +{ + using System; + using System.Collections.Generic; + using System.Windows; + using System.Windows.Media.Imaging; + using System.Windows.Navigation; + using CampusAppWP8.Feed.Lecture; + using CampusAppWP8.Model.Lecture; + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + using Microsoft.Phone.Controls; + + /// + /// Class for the LecturePage + /// + public partial class LecturePage : PhoneApplicationPage + { + #region Member + + /// + /// actual LectureAPI + /// + private LectureApi api; + + /// + /// List for the courses of the BTU + /// + /// + /// need to be extend to full list + /// + private LecturePageModel pageModel; + + #endregion + + #region Constructor + /// + /// Initializes a new instance of the class. + /// + public LecturePage() + { + this.InitializeComponent(); + this.LoadPageModel(); + this.SetupListPickers(); + } + + #endregion + + #region methods + + #region protected + /// + /// Methods overrides the OnNavigatedFrom-Method + /// + /// some NavigationEventArgs + protected override void OnNavigatedFrom(NavigationEventArgs e) + { + if (NavigationMode.Back == e.NavigationMode) + { + // delete all models + App.SaveToIsolatedStorage(Constants.IsolatedStorage_LecturePageModel, null); + App.SaveToIsolatedStorage(Constants.IsolatedStorage_LectureModel, null); + } + else + { + this.StoreSelectedIndex(); + App.SaveToIsolatedStorage(Constants.IsolatedStorage_LecturePageModel, this.pageModel); + } + + base.OnNavigatedFrom(e); + } + + #endregion + + #region private + + /// + /// Load the PageModel + /// + private void LoadPageModel() + { + this.pageModel = new LecturePageModel(); + this.pageModel.LoadLists(); + } + + /// + /// Method sets the ItemSource of the ListPickers + /// + private void SetupListPickers() + { + this.Course.ItemsSource = this.pageModel.CourseList; + this.Degree.ItemsSource = this.pageModel.DegreeList; + this.From.ItemsSource = this.pageModel.NumberList; + this.To.ItemsSource = this.pageModel.NumberList; + this.Semester.ItemsSource = this.pageModel.SemesterList; + + // load values from last request + LecturePageModel lastPageModel = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_LecturePageModel); + if (lastPageModel != null) + { + this.SetLastSelectedIndex(lastPageModel); + } + + this.SetSelectedIndex(); + } + + /// + /// Method set the last selected index of the ListPickers + /// + /// Last PageModel + private void SetLastSelectedIndex(LecturePageModel lastPageModel) + { + this.pageModel.SelectCourseIndex = lastPageModel.SelectCourseIndex; + this.pageModel.SelectDegreeIndex = lastPageModel.SelectDegreeIndex; + this.pageModel.SelectFromIndex = lastPageModel.SelectFromIndex; + this.pageModel.SelectToIndex = lastPageModel.SelectToIndex; + this.pageModel.SelectSemesterIndex = lastPageModel.SelectSemesterIndex; + } + + /// + /// Method set the last selected index of the ListPickers + /// + private void SetSelectedIndex() + { + this.Course.SelectedIndex = this.pageModel.SelectCourseIndex; + this.Degree.SelectedIndex = this.pageModel.SelectDegreeIndex; + this.Semester.SelectedIndex = this.pageModel.SelectSemesterIndex; + this.From.SelectedIndex = this.pageModel.SelectFromIndex; + this.To.SelectedIndex = this.pageModel.SelectToIndex; + } + + /// + /// Method store the actual selectIndex to the models + /// + private void StoreSelectedIndex() + { + this.pageModel.SelectCourseIndex = this.Course.SelectedIndex; + this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex; + this.pageModel.SelectSemesterIndex = this.Semester.SelectedIndex; + this.pageModel.SelectFromIndex = this.From.SelectedIndex; + this.pageModel.SelectToIndex = this.To.SelectedIndex; + } + + /// + /// Method send a request to the Feed + /// + /// + /// have to refactors + /// + /// sender of this event + /// events arguments + private void SendRequest(object sender, RoutedEventArgs e) + { + this.api = new LectureApi(); + this.api.EventHandler.ApiIsReadyEvent += new ApiEventHandler.ApiReadyHandler(this.ApiIsReady); + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + List parameterList = this.CreateUrlParameter(); + this.api.ApiGet(parameterList); + } + + /// + /// Method read the values from the inputs and put them in a list of parameters + /// + /// a list of parameters + private List CreateUrlParameter() + { + ListPickerItemModel semester = (ListPickerItemModel)this.Semester.SelectedItem; + ListPickerItemModel degree = (ListPickerItemModel)this.Degree.SelectedItem; + ListPickerItemModel course = (ListPickerItemModel)this.Course.SelectedItem; + ListPickerItemModel from = (ListPickerItemModel)this.From.SelectedItem; + ListPickerItemModel to = (ListPickerItemModel)this.To.SelectedItem; + + List parameterList = new List(); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_Semester, semester.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_Degree, degree.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_Course, course.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_From, from.Value)); + parameterList.Add(new UrlParamModel(Constants.ParamGetLecture_To, to.Value)); + return parameterList; + } + + /// + /// Method will be execute if the feed is ready + /// + private void ApiIsReady() + { + App.SaveToIsolatedStorage(Constants.IsolatedStorage_LectureModel, this.api.Model); + this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; + Uri url = new Uri(Constants.PathLecture_ResultPage, UriKind.Relative); + NavigationService.Navigate(url); + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml new file mode 100644 index 00000000..607d04b8 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml.cs new file mode 100644 index 00000000..cf6d4332 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ModulWebPage.xaml.cs @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 11.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Lecture +{ + using System; + using System.Windows.Navigation; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Class for the page which shows Webpages from the BaseAddress + /// + public partial class ModulWebPage : PhoneApplicationPage + { + /// + /// Initializes a new instance of the class. + /// + public ModulWebPage() + { + this.InitializeComponent(); + } + + /// + /// Override the OnNavigatedTo method + /// + /// Arguments of navigation + protected override void OnNavigatedTo(NavigationEventArgs e) + { + if (NavigationContext.QueryString.ContainsKey(Constants.ParamModelLecture_ModulNumber)) + { + string number = NavigationContext.QueryString[Constants.ParamModelLecture_ModulNumber]; + this.WebmailBrowser.Navigate(new Uri(Constants.UrlLecture_ModulBaseAddr + number, UriKind.Absolute)); + } + + base.OnNavigatedTo(e); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml new file mode 100644 index 00000000..bc3d090b --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs new file mode 100644 index 00000000..e09763e3 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml.cs @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 11.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Lecture +{ + using System.Windows.Navigation; + using CampusAppWP8.Model.Lecture; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Class for the page which shows details of an activity + /// + public partial class ResultDetailPage : PhoneApplicationPage + { + /// + /// Initializes a new instance of the class. + /// + public ResultDetailPage() + { + this.InitializeComponent(); + } + + /// + /// Override the OnNavigatedTo method + /// + /// Arguments of navigation + protected override void OnNavigatedTo(NavigationEventArgs e) + { + if (NavigationContext.QueryString.ContainsKey(Constants.ParamModelLecture_ActivityId)) + { + string activityId = NavigationContext.QueryString[Constants.ParamModelLecture_ActivityId]; + this.LoadActivity(int.Parse(activityId)); + } + + base.OnNavigatedTo(e); + } + + /// + /// Method load a certain Activity from the model + /// + /// id of the activity + private void LoadActivity(int activityId) + { + LectureList list = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_LectureModel); + if (list != null) + { + LectureActivity activity = list.GetActivity(activityId); + activity.CreateLectureString(); + activity.CreateCourseString(); + this.ContentPanel.DataContext = activity; + } + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml new file mode 100644 index 00000000..d4d8c4f4 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs new file mode 100644 index 00000000..bee3a329 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 11.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Lecture +{ + using System; + using System.Linq; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Navigation; + using CampusAppWP8.Model.Lecture; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Class for the page which shows the results of an LectureRequest + /// + public partial class ResultPage : PhoneApplicationPage + { + /// + /// Initializes a new instance of the class. + /// + public ResultPage() + { + this.InitializeComponent(); + } + + /// + /// Override the OnNavigatedTo method + /// + /// Arguments of navigation + protected override void OnNavigatedTo(NavigationEventArgs e) + { + LectureList list = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_LectureModel); + if (list == null) + { + Uri url = new Uri(Constants.PathLecture_LecturePage, UriKind.Relative); + NavigationService.Navigate(url); + return; + } + + this.ResultList.ItemsSource = list.Activities.OrderByDescending(o => o.Type).ThenBy(o => o.Title).ToList(); + base.OnNavigatedTo(e); + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml new file mode 100644 index 00000000..f0378ecc --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs new file mode 100644 index 00000000..f0ccccaa --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs @@ -0,0 +1,153 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Links +{ + using System.Windows.Navigation; + using CampusAppWP8.Feed.Link; + using Microsoft.Phone.Controls; + + /// + /// Class for the LinkPage + /// + public partial class LinkPage : PhoneApplicationPage + { + #region Members + + /// + /// the feed of the CommonLinks + /// + private CommonLinkFeed commonLinkFeed; + + /// + /// the feed of the ClubLinks + /// + private ClubLinkFeed clubLinkFeed; + + /// + /// how many feeds are currently loading + /// + private int loadingFeeds; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LinkPage() + { + this.InitializeComponent(); + } + + #endregion + + #region Method + + #region protected + + /// + /// Override the OnNavigatedTo method + /// + /// Arguments of navigation + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + this.InitializeFeeds(); + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + this.loadingFeeds = 2; + this.commonLinkFeed.LoadData(); + this.clubLinkFeed.LoadData(); + } + + #endregion + #region private + + /// + /// Method initialize the Feeds + /// + private void InitializeFeeds() + { + if (this.commonLinkFeed == null) + { + this.InitializeCommonLinkFeed(); + } + + if (this.clubLinkFeed == null) + { + this.InitializeClubLinkFeed(); + } + } + + /// + /// Method initialize the CommonLinkFeed + /// + private void InitializeCommonLinkFeed() + { + this.commonLinkFeed = new CommonLinkFeed(); + this.commonLinkFeed.onLoaded += new CommonLinkFeed.OnLoaded(this.CommonLinkFeedIsReady); + } + + /// + /// Method initialize the ClubLinkFeed + /// + private void InitializeClubLinkFeed() + { + this.clubLinkFeed = new ClubLinkFeed(); + this.clubLinkFeed.onLoaded += new ClubLinkFeed.OnLoaded(this.ClubLinkFeedIsReady); + } + + /// + /// Method will be execute if the CommonLinkFeed is ready + /// + private void CommonLinkFeedIsReady() + { + this.SetupCommonPivot(); + this.loadingFeeds--; + + if (this.loadingFeeds < 1) + { + this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; + } + } + + /// + /// Method will be execute if the ClubLinkFeed is ready + /// + private void ClubLinkFeedIsReady() + { + this.SetupClubPivot(); + this.loadingFeeds--; + if (this.loadingFeeds < 1) + { + this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; + } + } + + /// + /// Method set ItemSource for the CommonLinkPanel + /// + private void SetupCommonPivot() + { + this.CommonLinkPanel.ItemsSource = this.commonLinkFeed.Model.Links; + } + + /// + /// Method set ItemSource for the ClubLinkPanel + /// + private void SetupClubPivot() + { + this.ClubLinkPanel.ItemsSource = this.clubLinkFeed.Model.Links; + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml new file mode 100644 index 00000000..aed38723 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs new file mode 100644 index 00000000..8b531f1b --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs @@ -0,0 +1,136 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 04.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Mensa +{ + using System; + using System.Windows.Navigation; + using CampusAppWP8.Feed.Mensa; + using Microsoft.Phone.Controls; + + /// + /// Class for the MensaPage + /// + public partial class MensaPage : PhoneApplicationPage + { + #region Members + + /// + /// the feed of the mensa + /// + private MensaFeed feed; + + /// + /// Index representing the weekday of today + /// 0 - Monday(Default) + /// 1 - Tuesday + /// 2 - Wednesday + /// 3 - Thursday + /// 4 - Friday + /// + private int selectedIndex; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public MensaPage() + { + this.InitializeComponent(); + this.InitializeFeed(); + } + + #endregion + + #region Method + + #region protected + + /// + /// Override the OnNavigatedTo method + /// + /// Arguments of navigation + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + if (this.feed == null) + { + this.InitializeFeed(); + } + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + this.feed.LoadData(); + } + #endregion + #region private + + /// + /// Method initialize the Feed + /// + private void InitializeFeed() + { + this.feed = new MensaFeed(); + this.feed.onLoaded += new MensaFeed.OnLoaded(this.FeedIsReady); + this.CalcSelectedIndex(); + } + + + /// + /// Method will be execute if the feed is ready + /// + private void FeedIsReady() + { + this.SetupMensaPivot(); + this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; + } + + /// + /// Method set ItemSource and SelectedIndex for the pivot + /// + private void SetupMensaPivot() + { + this.MensaPivot.ItemsSource = this.feed.Model.Menus; + this.MensaPivot.SelectedIndex = this.selectedIndex; + } + + /// + /// Method calculate which pivot has to be selected + /// + private void CalcSelectedIndex() + { + DayOfWeek today = DateTime.Now.DayOfWeek; + int todayIndex; + switch (today) + { + case DayOfWeek.Monday: + todayIndex = 0; + break; + case DayOfWeek.Tuesday: + todayIndex = 1; + break; + case DayOfWeek.Wednesday: + todayIndex = 2; + break; + case DayOfWeek.Thursday: + todayIndex = 3; + break; + case DayOfWeek.Friday: + todayIndex = 4; + break; + default: + todayIndex = 0; + break; + } + + this.selectedIndex = todayIndex; + } + #endregion + #endregion + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml new file mode 100644 index 00000000..16f279a4 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs new file mode 100644 index 00000000..a7974800 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 03.05.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Pages.News +{ + using System.Linq; + using System.Windows.Navigation; + using CampusAppWP8.Feed.News; + using CampusAppWP8.Utility; + using Microsoft.Phone.Controls; + + /// + /// Overview page of all news. + /// + public partial class NewsIndexPage : PhoneApplicationPage + { + /// + /// News Feed object, which contains the RSS models and data. + /// + private static NewsFeed newsFeed = null; + + /// + /// Initializes a new instance of the class. + /// + public NewsIndexPage() + { + this.InitializeComponent(); + + if (NewsIndexPage.newsFeed == null) + { + NewsIndexPage.newsFeed = new NewsFeed(false); + } + + NewsIndexPage.newsFeed.onLoaded += new NewsFeed.OnLoaded(this.SetupNewsPageList); + NewsIndexPage.newsFeed.LoadData(); + } + + /// + /// Return the newsFeed object. + /// + /// news feed object + public static NewsFeed GetNewsFeed() + { + return NewsIndexPage.newsFeed; + } + + /// + /// On navigation to this page, creates a FeedEventHandler and load the RSS feed data. + /// + /// event args + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + } + + /// + /// Is called after the RSS feeds are loaded into the newsFeed model. + /// If there was no feed information set to the UI, the feed list + /// will be sorted by timestamp and the buttons will be created. + /// + private void SetupNewsPageList() + { + this.NewsList.ItemsSource = NewsIndexPage.newsFeed.Model.Channel[0].Item; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml new file mode 100644 index 00000000..887d4de0 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +