diff --git a/CampusAppWP8/CampusAppWP8/App.xaml b/CampusAppWP8/CampusAppWP8/App.xaml index 99ad2874..7f65fb63 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml +++ b/CampusAppWP8/CampusAppWP8/App.xaml @@ -1,20 +1,21 @@  + xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" + x:Class="CampusAppWP8.App" + > - + - + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs index d13894e8..00d78264 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -7,29 +7,14 @@ using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using CampusAppWP8.Resources; -using CampusAppWP8.ViewModels; +using System.IO.IsolatedStorage; + namespace CampusAppWP8 { public partial class App : Application { - private static MainViewModel viewModel = null; - /// - /// Eine statisches ViewModel, an das die Ansichten gebunden werden. - /// - /// MainViewModel-Objekt. - public static MainViewModel ViewModel - { - get - { - // Erstellung des Ansichtsmodells verzögern bis erforderlich - if (viewModel == null) - viewModel = new MainViewModel(); - - return viewModel; - } - } /// /// Bietet einen einfachen Zugriff auf den Stammframe der Phone-Anwendung. @@ -75,6 +60,37 @@ namespace CampusAppWP8 } } + /// + /// 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); + } // 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) @@ -85,11 +101,7 @@ namespace CampusAppWP8 // Dieser Code wird beim ersten Starten der Anwendung nicht ausgeführt private void Application_Activated(object sender, ActivatedEventArgs e) { - // Sicherstellen, dass der Anwendungszustand ordnungsgemäß wiederhergestellt wird - if (!App.ViewModel.IsDataLoaded) - { - App.ViewModel.LoadData(); - } + } // Code, der ausgeführt werden soll, wenn die Anwendung deaktiviert wird (in den Hintergrund gebracht wird) diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/campus_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/campus_159_dark.png new file mode 100644 index 00000000..e019ac39 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/campus_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/campus_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/campus_159_light.png new file mode 100644 index 00000000..cae8735c Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/campus_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/departments_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/departments_159_dark.png new file mode 100644 index 00000000..2aeac69f Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/departments_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/departments_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/departments_159_light.png new file mode 100644 index 00000000..381e22bc Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/departments_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/homework_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/homework_159_dark.png new file mode 100644 index 00000000..d118e23d Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/homework_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/homework_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/homework_159_light.png new file mode 100644 index 00000000..5ecf6523 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/homework_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/lectures_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/lectures_159_dark.png new file mode 100644 index 00000000..05a56ba2 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/lectures_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/lectures_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/lectures_159_light.png new file mode 100644 index 00000000..20763277 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/lectures_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/link_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/link_159_dark.png new file mode 100644 index 00000000..0491962d Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/link_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/link_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/link_159_light.png new file mode 100644 index 00000000..da0bca39 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/link_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/mensa_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/mensa_159_dark.png new file mode 100644 index 00000000..f1df7318 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/mensa_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/mensa_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/mensa_159_light.png new file mode 100644 index 00000000..ceefcd59 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/mensa_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/news_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/news_159_dark.png new file mode 100644 index 00000000..42a50354 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/news_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/news_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/news_159_light.png new file mode 100644 index 00000000..2a7c0fa8 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/news_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/openhours_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/openhours_159_dark.png new file mode 100644 index 00000000..68e82d0d Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/openhours_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/openhours_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/openhours_159_light.png new file mode 100644 index 00000000..8bc66811 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/openhours_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/schedule_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/schedule_159_dark.png new file mode 100644 index 00000000..266cd74b Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/schedule_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/schedule_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/schedule_159_light.png new file mode 100644 index 00000000..9807c694 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/schedule_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/student_council_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/student_council_159_dark.png new file mode 100644 index 00000000..c168e650 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/student_council_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/student_council_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/student_council_159_light.png new file mode 100644 index 00000000..7c0cfb2d Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/student_council_159_light.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/webmail_159_dark.png b/CampusAppWP8/CampusAppWP8/Assets/icons/webmail_159_dark.png new file mode 100644 index 00000000..295a60ee Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/webmail_159_dark.png differ diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/webmail_159_light.png b/CampusAppWP8/CampusAppWP8/Assets/icons/webmail_159_light.png new file mode 100644 index 00000000..0f27f6fc Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/webmail_159_light.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/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 65eb7650..19f0fb80 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -25,6 +25,7 @@ true 11.0 true + 5.0.40218.0 true @@ -36,6 +37,8 @@ true prompt 4 + + pdbonly @@ -94,8 +97,66 @@ App.xaml - - MainPage.xaml + + + + + + + + + + + + + + + + CampusMapPage.xaml + + + + + DepartmentPage.xaml + + + + EventIndexPage.xaml + + + EventPage.xaml + + + LecturePage.xaml + + + + + + ModulWebPage.xaml + + + ResultDetailPage.xaml + + + ResultPage.xaml + + + MensaPage.xaml + + + + NewsIndexPage.xaml + + + NewsPage.xaml + + + + StartPage.xaml + + + WebmailPage.xaml @@ -103,24 +164,82 @@ True AppResources.resx - - + + True + True + Constants.resx + + + + + + + + + + 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 - + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + @@ -132,6 +251,28 @@ PreserveNewest + + + + + + + + + + + + + + + + + + + + + + PreserveNewest @@ -157,13 +298,20 @@ PublicResXFileCodeGenerator AppResources.Designer.cs + Designer + + + ResXFileCodeGenerator + Constants.Designer.cs + ..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/MainPage.xaml.cs b/CampusAppWP8/CampusAppWP8/MainPage.xaml.cs deleted file mode 100644 index f92d1b7e..00000000 --- a/CampusAppWP8/CampusAppWP8/MainPage.xaml.cs +++ /dev/null @@ -1,53 +0,0 @@ -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 CampusAppWP8.Resources; - -namespace CampusAppWP8 -{ - public partial class MainPage : PhoneApplicationPage - { - // Konstruktor - public MainPage() - { - InitializeComponent(); - - // Datenkontext des Listenfeldsteuerelements auf die Beispieldaten festlegen - DataContext = App.ViewModel; - - // Beispielcode zur Lokalisierung der ApplicationBar - //BuildLocalizedApplicationBar(); - } - - // Daten für die ViewModel-Elemente laden - protected override void OnNavigatedTo(NavigationEventArgs e) - { - if (!App.ViewModel.IsDataLoaded) - { - App.ViewModel.LoadData(); - } - } - - // Beispielcode zur Erstellung einer lokalisierten ApplicationBar - //private void BuildLocalizedApplicationBar() - //{ - // // ApplicationBar der Seite einer neuen Instanz von ApplicationBar zuweisen - // ApplicationBar = new ApplicationBar(); - - // // Eine neue Schaltfläche erstellen und als Text die lokalisierte Zeichenfolge aus AppResources zuweisen. - // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); - // appBarButton.Text = AppResources.AppBarButtonText; - // ApplicationBar.Buttons.Add(appBarButton); - - // // Ein neues Menüelement mit der lokalisierten Zeichenfolge aus AppResources erstellen - // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); - // ApplicationBar.MenuItems.Add(appBarMenuItem); - //} - } -} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs new file mode 100644 index 00000000..c98aadc2 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.Departments +{ + /// + /// Class to hold information about a professorship chair. + /// + public class ChairModel : BaseModel + { + private string name_de; // german name of the chair + private string url; // link-url to the chair homepage + private string name_en; // english name of the chair + + /// + /// Default Constructor. Set every class variable to default value. + /// + public ChairModel() + { + this.name_de = String.Empty; + this.name_en = String.Empty; + this.url = String.Empty; + } + + /// + /// Constructor. Set the german and english name. + /// + /// Name of the professorship chair. + public ChairModel(string name) + { + this.name_de = name; + this.name_en = name; + this.url = String.Empty; + } + + /// + /// Set or return the german name of the chair. + /// + [XmlAttribute("name_de")] + public string Name_DE + { + get { return this.name_de; } + set + { + if (value != this.name_de) + { + this.name_de = value; + NotifyPropertyChanged("chair"); + } + } + } + + /// + /// Set or return the english name of the chair. + /// + [XmlAttribute("name_en")] + public string Name_EN + { + get { return this.name_en; } + set + { + if (value != this.name_en) + { + this.name_en = value; + NotifyPropertyChanged("chair"); + } + } + } + + /// + /// Set or return the url of the chair homepage. + /// + [XmlAttribute("url")] + public string Url + { + get { return this.url; } + set + { + if (value != this.url) + { + this.url = value; + NotifyPropertyChanged("chair"); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs new file mode 100644 index 00000000..ab547308 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Windows; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.Departments +{ + public class DepartmentModel : BaseModel + { + [XmlElement("chair")] + public ObservableCollection _chairs { get; set; } + + private string _name = "d_mod"; + private Visibility visible; + + public DepartmentModel() + { + this.visible = Visibility.Collapsed; + this.Chairs = new ObservableCollection(); + //this.LoadData(); + } + + public DepartmentModel(string name) + { + this.visible = Visibility.Collapsed; + _name = name; + this.Chairs = new ObservableCollection(); + //this.LoadData(); + } + + public void LoadData() + { + this.Chairs.Add(new ChairModel("LS 1")); + this.Chairs.Add(new ChairModel("LS 2")); + this.Chairs.Add(new ChairModel("LS 3")); + this.Chairs.Add(new ChairModel("LS 4")); + } + + public ObservableCollection Chairs + { + get + { + return _chairs; + } + set + { + if (value != _chairs) + { + _chairs = value; + NotifyPropertyChanged("department"); + } + } + } + + public string Name + { + get + { + return _name; + } + set + { + if (value != _name) + { + _name = value; + NotifyPropertyChanged("chair"); + } + } + } + + public Visibility Visible + { + get { return this.visible; } + set + { + if (value != this.visible) + { + this.visible = value; + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentViewModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentViewModel.cs new file mode 100644 index 00000000..5b57d3c6 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentViewModel.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.Departments +{ + [XmlRoot("root")] + public class DepartmentViewModel : BaseViewModel + { + [XmlArray("professorships")] + [XmlArrayItem("faculty")] + public ObservableCollection _faculties { get; set; } + + public DepartmentViewModel() + { + this.Faculties = new ObservableCollection(); + } + + public ObservableCollection Faculties + { + get + { + return _faculties; + } + set + { + if (value != _faculties) + { + _faculties = value; + NotifyPropertyChanged("foodDays"); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs new file mode 100644 index 00000000..3ceea2a8 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Xml.Serialization; +using CampusAppWP8.Resources; + +namespace CampusAppWP8.Model.Departments +{ + public class FacultyModel : BaseModel + { + [XmlElement("chair")] + public ObservableCollection chairs { get; set; } + //public ObservableCollection _faculties { get; set; } + + private string name = "t_fak"; + + public FacultyModel() + { + //this.Faculties = new ObservableCollection(); + this.chairs = new ObservableCollection(); + } + + public FacultyModel(string name) + { + this.name = name; + //this.Faculties = new ObservableCollection(); + this.chairs = new ObservableCollection(); + } + + public ObservableCollection Chairs + { + get { return this.chairs; } + set + { + if (value != this.chairs) + { + this.chairs = value; + NotifyPropertyChanged("faculty"); + } + } + } + + [XmlAttribute("id")] + public string Name + { + get + { + return AppResources.Faculty + " " + this.name; + } + set + { + if (value != this.name) + { + this.name = value; + NotifyPropertyChanged("faculty"); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs new file mode 100644 index 00000000..2e8bc8aa --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs @@ -0,0 +1,45 @@ +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; + NotifyPropertyChanged("item"); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs new file mode 100644 index 00000000..19d53cb9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs @@ -0,0 +1,204 @@ +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); } + } + + /// + /// 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/Events/RSSViewModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSViewModel.cs new file mode 100644 index 00000000..a9625df9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Events/RSSViewModel.cs @@ -0,0 +1,47 @@ +using CampusAppWP8.Model; +using System.Collections.ObjectModel; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.events_news +{ + /// + /// ViewModel of the rss feed, containing the feed/channel object. + /// + [XmlRoot("root")] + public class RSSViewModel : BaseViewModel + { + /// + /// channel list for the rss feeds. + /// + [XmlArray("rss")] + [XmlArrayItem("channel")] + public ObservableCollection channel { get; set; } + + /// + /// Default constructor. + /// + public RSSViewModel() + { + this.channel = new ObservableCollection(); + } + + /// + /// Set/Get the channel list. + /// + public ObservableCollection Channel + { + get + { + return this.channel; + } + set + { + if (value != this.channel) + { + this.channel = value; + NotifyPropertyChanged("channel"); + } + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureActivity.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureActivity.cs new file mode 100644 index 00000000..3c178b2d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureActivity.cs @@ -0,0 +1,140 @@ +using CampusAppWP8.Utility; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.Lecture +{ + public class LectureActivity + { + #region + private ObservableCollection lecturer; + private string lecturerString; + private string courseString; + private string topic; + #endregion + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LectureActivity() + { + } + + #endregion + + #region Proberty + + [XmlElement("art")] + public string Type { get; set; } + + [XmlAttribute("id")] + public int Id { get; set; } + + [XmlElement("semester")] + public int Semester { get; set; } + + [XmlElement("sws")] + public string SWS { get; set; } + + [XmlElement("modul")] + public LectureModul Modul { get; set; } + + [XmlElement("lehrperson")] + public ObservableCollection Lecturer { + get + { + return lecturer; + } + set + { + if (value != lecturer) + { + lecturer = value; + } + } + } + + public string LecturerString { + get + { + return this.lecturerString; + } + set + { + if (value != this.lecturerString) + { + this.lecturerString = value; + } + } + } + + public string CourseString + { + get + { + return this.courseString; + } + set + { + if (value != this.courseString) + { + this.courseString = value; + } + } + } + + + [XmlElement("studiengang")] + public ObservableCollection Course { get; set; } + + [XmlElement("termin")] + public ObservableCollection Dates { get; set; } + + [XmlElement("zugeordnete_einrichtung")] + public string Department { get; set; } + + [XmlElement("lehrinhalt")] + public string Topic + { + get + { + return topic; + } + set + { + if (value != topic) + { + topic = StringManager.StripHTML(value); + } + } + } + + #endregion + + public void createLectureString() + { + string result = string.Empty; + foreach (LectureLecturer tmpLecturer in Lecturer) + { + result += tmpLecturer.ToString() + "\n"; + } + this.LecturerString = result.TrimEnd('\n'); + } + + public void createCourseString() + { + string result = string.Empty; + foreach (LectureCourse course in Course) + { + result += course.Title + "\n"; + } + this.CourseString = result.TrimEnd('\n'); + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureCourse.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureCourse.cs new file mode 100644 index 00000000..30018c7e --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureCourse.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.Lecture +{ + public class LectureCourse + { + public LectureCourse() + { + } + [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..9e802558 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureDate.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.Lecture +{ + public class LectureDate + { + public LectureDate() + { + } + + [XmlElement("wochentag")] + public string WeekDay { get; set; } + [XmlElement("von")] + public string From { get; set; } + [XmlElement("bis")] + public string To { get; set; } + [XmlElement("rhythmus")] + public string Interval { get; set; } + [XmlElement("raum")] + public string Room { get; set; } + [XmlElement("anfangsdatum")] + public string StarDate { get; set; } + [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..c0cc8b42 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureLecturer.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Serialization; + +namespace CampusAppWP8.Model.Lecture +{ + public class LectureLecturer + { + public LectureLecturer() + { + } + + [XmlElement("vorname")] + public string FirstName { get; set; } + + [XmlElement("name")] + public string LastName { get; set; } + + [XmlElement("titel")] + public string Title { get; set; } + + [XmlAttribute("zustaendigkeit")] + public string Responsibility { get; set; } + + public override string ToString() + { + string result = string.Empty; + + if (!Title.Equals(string.Empty)) + { + result += Title + " "; + } + + result += FirstName + " "; + result += LastName + " "; + + if (!Responsibility.Equals(string.Empty)) + { + result += "(" + 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..6dff6569 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureList.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 10.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + using System.Linq; + + [XmlRoot("lsf_auszug")] + public class LectureList + { + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LectureList() + { + } + + #endregion + + #region Proberty + + [XmlArray("veranstaltungsliste")] + [XmlArrayItem("veranstaltung")] + public ObservableCollection Activities { get; set; } + + #endregion + + #region Methods + + public LectureActivity GetActivity(int id) + { + LectureActivity activity = Activities.Where(p => p.Id == id).First(); + return activity; + } + #endregion + + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModul.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModul.cs new file mode 100644 index 00000000..883f763f --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LectureModul.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 10.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.Lecture +{ + using CampusAppWP8.Resources; + using System; + using System.Xml.Serialization; + public class LectureModul + { + #region Members + + private int number; + + private Uri url; + + #endregion + + #region Constructor + + public LectureModul() + { + } + + #endregion + + #region Property + + [XmlElement("titel")] + public string Title {get; set;} + + [XmlElement("nummer")] + public int Number{ + get + { + return this.number; + } + set + { + if (value != this.number) + { + this.number = value; + this.createUrl(); + } + } + } + + public Uri Url{ + get + { + return url; + } + } + + #endregion + + #region Methods + + private void createUrl() + { + this.url = new Uri(Constants.UrlLectureModulBaseAddr + number.ToString()); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml new file mode 100644 index 00000000..7919009f --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..9e4cd703 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs @@ -0,0 +1,24 @@ +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; + +namespace CampusAppWP8.Pages.Campusmap +{ + public partial class CampusMapPage : PhoneApplicationPage + { + public CampusMapPage() + { + InitializeComponent(); + } + + 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..3049f3c9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..2d71e3cd --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs @@ -0,0 +1,131 @@ +using CampusAppWP8.Feed.Departments; +using CampusAppWP8.Pages.Departments; +using CampusAppWP8.Utility; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Tasks; +using System; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; + + +namespace CampusAppWP8.Pages.Departments +{ + /// + /// Pivot page with list of the chairs of the facultis. + /// + public partial class DepartmentPage : PhoneApplicationPage + { + /// + /// Stores the last visible department panel. + /// + private UIElement lastVisibleUIElem = null; + /// + /// department/chair feed object, storing the model and data. + /// + private DepartmentFeed feed { get; set; } + + /// + /// Default constructor. + /// + public DepartmentPage() + { + InitializeComponent(); + // init feed object + this.feed = new DepartmentFeed(); + } + + /// + /// On naviagtion to this page. + /// Init the feed loading. + /// + /// event args + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(SetupDepartmentPivot); + this.feed.LoadFeed(); + } + + /// + /// Called after the feeds are loaded. + /// Set the pivotitem source of this page. + /// + private void SetupDepartmentPivot() + { + DepartmentPivot.ItemsSource = feed.Model._faculties; + } + + /// + /// On orientation changed. + /// + /// unused + /// unused + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + } + + /// + /// Called at clicking on the department headline buttons. + /// Collapses all visible department panels and open (set to visible) + /// the clicked department list. + /// + /// clicked department button + /// unused + private void DepartmentBtn_Click(object sender, RoutedEventArgs e) + { + // if the sender was a button + if(sender is Button) + { + Button btn = sender as Button; + + // if the parent is a stackpanel + if(btn.Parent is StackPanel) + { + StackPanel pan = (StackPanel)btn.Parent; + + // if there is a child after the clicked button in the parent panel + if ((pan.Children.Count() > 1) && (pan.Children[1] != null)) + { + // if the clicked department wasn't the one clicked before + if (pan.Children[1] != this.lastVisibleUIElem) + { + // collapse the last visible chair list + if (this.lastVisibleUIElem != null) + this.lastVisibleUIElem.Visibility = Visibility.Collapsed; + + // open the choosen chair list + pan.Children[1].Visibility = Visibility.Visible; + this.lastVisibleUIElem = pan.Children[1]; + } + } + } + } + } + + /// + /// On clicking a chair textbolock. + /// Open the browser with the url of the chair. + /// + /// clicked chair textblock + /// + private void ChairTB_Click(object sender, RoutedEventArgs e) + { + if (sender is FrameworkElement) + { + FrameworkElement btn = sender as FrameworkElement; + + // if the chair has a url in the tag element + if ((btn.Tag != null) && ((btn.Tag as string).Length > 0)) + { + // open browser with the url + WebBrowserTask task = new WebBrowserTask(); + task.Uri = new Uri(btn.Tag.ToString(), UriKind.Absolute); + task.Show(); + } + } + } + } +} \ 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..1c4b30c8 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + \ 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..4d3538e3 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs @@ -0,0 +1,104 @@ +using CampusAppWP8.Feed.Events; +using CampusAppWP8.Model.events_news; +using CampusAppWP8.Utility; +using Microsoft.Phone.Controls; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; + +namespace CampusAppWP8.Pages.Events +{ + /// + /// Overview page of all events. + /// + public partial class EventIndexPage : PhoneApplicationPage + { + /// + /// Event Feed object, which contains the rss models and data. + /// + public static EventFeed eventFeed { get; set; } + + /// + /// Default constructor. + /// + public EventIndexPage() + { + InitializeComponent(); + EventIndexPage.eventFeed = new 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); + + // Set handler and load the fees informations. + EventIndexPage.eventFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(SetupEventPageList); + EventIndexPage.eventFeed.LoadFeed(); + } + + /// + /// Is called after the rss feeds are loaded into the eventFeed model. + /// If there was no feed informations set to the ui, the feed list + /// will be sorted by timestamp and the buttons will be created. + /// + private void SetupEventPageList() + { + if ((EventIndexPage.eventFeed.Model != null) + && (EventIndexPage.eventFeed.Model.Channel != null) + && (EventIndexPage.eventFeed.Model.Channel.Count() >= 1) + && (this.ButtonPanel.Items.Count() == 0)) + { + // Sort the list of rssfeeds. + IEnumerable tempList = EventIndexPage.eventFeed.Model.Channel[0].item.OrderByDescending(e => e.DTTimestamp); + EventIndexPage.eventFeed.Model.Channel[0].item = new ObservableCollection(tempList); + + // Create the buttons for the fees selection and add it to the buttonpanel. + for (int i = 0; i < EventIndexPage.eventFeed.Model.Channel[0].item.Count(); i++) + { + Button tempBtn = new Button(); + tempBtn.Name = "EventRowAppButton"; + tempBtn.Content = EventIndexPage.eventFeed.Model.Channel[0].item[i].Title; + tempBtn.VerticalContentAlignment = VerticalAlignment.Stretch; + tempBtn.HorizontalContentAlignment = HorizontalAlignment.Stretch; + tempBtn.BorderThickness = new Thickness(0.0); + tempBtn.Padding = new Thickness(0.0); + tempBtn.Click += EventRowAppButton_Click; + tempBtn.Tag = i; + + this.ButtonPanel.Items.Add(tempBtn); + } + } + } + + /// + /// Return the eventFeed object. + /// + static public EventFeed GetEventFeed + { + get { return EventIndexPage.eventFeed; } + set { } + } + + /// + /// Is called on clicking on a feed button. + /// Navigates to the event pivot page with the information of the + /// selected feed index. + /// + /// pressed button object + /// event args + private void EventRowAppButton_Click(object sender, RoutedEventArgs e) + { + FrameworkElement tempElem = sender as FrameworkElement; + + NavigationService.Navigate(new Uri("/pages/events/EventPage.xaml?pivotindex=" + tempElem.Tag, UriKind.Relative)); + } + } +} \ 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..e5782082 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..21f26d96 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -0,0 +1,28 @@ +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 CampusAppWP8.Pages.Lecture; +using CampusAppWP8.Utility; + +namespace CampusAppWP8.Pages.lecture +{ + public partial class Lecture : PhoneApplicationPage + { + public Lecture() + { + InitializeComponent(); + LectureFeed test = new LectureFeed(); + test.LoadFeed(); + } + + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + } + } +} \ 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..989f0b51 --- /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.ParamLectureModulNumber)) + { + string number = NavigationContext.QueryString[Constants.ParamLectureModulNumber]; + this.WebmailBrowser.Navigate(new Uri(Constants.UrlLectureModulBaseAddr + 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..04b6ada9 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..6a404776 --- /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.ParamLectureActivityId)) + { + string activityId = NavigationContext.QueryString[Constants.ParamLectureActivityId]; + 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.IsolatedStorageLectureModel); + 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..187ffc38 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs new file mode 100644 index 00000000..d3eefb73 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs @@ -0,0 +1,85 @@ +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 Windows.UI.Input; + +namespace CampusAppWP8.Pages +{ + public partial class StartPage : PhoneApplicationPage + { + public StartPage() + { + InitializeComponent(); + + if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible) + this.SetIconThemeToDark(); + } + + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + // Switch the placement of the buttons based on an orientation change. + if (this.Orientation == PageOrientation.LandscapeLeft || this.Orientation == PageOrientation.LandscapeRight) + { + OpenHoursAppButton.SetValue(Grid.RowProperty, 0); + OpenHoursAppButton.SetValue(Grid.ColumnProperty, 3); + + OSAAppButton.SetValue(Grid.RowProperty, 1); + OSAAppButton.SetValue(Grid.ColumnProperty, 3); + + LinkAppButton.SetValue(Grid.RowProperty, 2); + LinkAppButton.SetValue(Grid.ColumnProperty, 3); + ContentPanel.Margin = new Thickness(12, -24, 0, 0); + + } + // If not in portrait, move buttonList content to visible row and column. + else + { + OpenHoursAppButton.SetValue(Grid.RowProperty, 3); + OpenHoursAppButton.SetValue(Grid.ColumnProperty, 0); + + OSAAppButton.SetValue(Grid.RowProperty, 3); + OSAAppButton.SetValue(Grid.ColumnProperty, 1); + + LinkAppButton.SetValue(Grid.RowProperty, 3); + LinkAppButton.SetValue(Grid.ColumnProperty, 2); + ContentPanel.Margin = new Thickness(12, 0, 0, 0); + + } + } + + private void SetIconThemeToDark() + { + this.ImgLightCampus.Visibility = Visibility.Collapsed; + this.ImgLightDepartments.Visibility = Visibility.Collapsed; + this.ImgLightEvents.Visibility = Visibility.Collapsed; + this.ImgLightHomework.Visibility = Visibility.Collapsed; + this.ImgLightLectures.Visibility = Visibility.Collapsed; + this.ImgLightLink.Visibility = Visibility.Collapsed; + this.ImgLightMensa.Visibility = Visibility.Collapsed; + this.ImgLightNews.Visibility = Visibility.Collapsed; + this.ImgLightOpenhours.Visibility = Visibility.Collapsed; + this.ImgLightStudentcouncil.Visibility = Visibility.Collapsed; + this.ImgLightTimetable.Visibility = Visibility.Collapsed; + this.ImgLightWebmail.Visibility = Visibility.Collapsed; + + this.ImgDarkCampus.Visibility = Visibility.Visible; + this.ImgDarkDepartments.Visibility = Visibility.Visible; + this.ImgDarkEvents.Visibility = Visibility.Visible; + this.ImgDarkHomework.Visibility = Visibility.Visible; + this.ImgDarkLectures.Visibility = Visibility.Visible; + this.ImgDarkLink.Visibility = Visibility.Visible; + this.ImgDarkMensa.Visibility = Visibility.Visible; + this.ImgDarkNews.Visibility = Visibility.Visible; + this.ImgDarkOpenhours.Visibility = Visibility.Visible; + this.ImgDarkStudentcouncil.Visibility = Visibility.Visible; + this.ImgDarkTimetable.Visibility = Visibility.Visible; + this.ImgDarkWebmail.Visibility = Visibility.Visible; + } + } +} \ 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..ab90cff2 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/pages/mensa/MensaPage.xaml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..5723b4b0 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/pages/mensa/MensaPage.xaml.cs @@ -0,0 +1,136 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 03.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Mensa +{ + using System; + using System.Windows.Navigation; + using CampusAppWP8.Utility; + 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.feed.LoadFeed(); + } + + #region private + + /// + /// Method initialize the Feed + /// + private void InitializeFeed() + { + this.feed = new MensaFeed(); + this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady); + this.CalcSelectedIndex(); + } + #endregion + + /// + /// Method will be execute if the feed is ready + /// + private void FeedIsReady() + { + this.SetupMensaPivot(); + } + + /// + /// 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/RSSItem.cs b/CampusAppWP8/CampusAppWP8/pages/news/RSSItem.cs new file mode 100644 index 00000000..9688e392 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/pages/news/RSSItem.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Pages.news +{ + class RSSItem + { + private string title; + private string text; + private DateTime timestamp; + + public string Title + { + get { return this.title; } + set { this.title = value; } + } + + public string Text + { + get { return this.text; } + set { this.text = HTMLUnicodeToString(value); } + } + + public string Timestamp + { + get { return this.timestamp.ToString("R"); } + set { this.timestamp = DateTime.Parse(value); } + } + + public string Date + { + get { return String.Format("{0:ddd, dd.MM.yyyy}", this.timestamp); } + } + + public string Time + { + get { return String.Format("{0:h:mm} Uhr", this.timestamp); } + } + + private string HTMLUnicodeToString(string htmluni) + { + StringBuilder retValue = new StringBuilder(); + + for(int i = 0; i < htmluni.Length; i++) + { + switch (htmluni[i]) + { + case '&': + { + int startOff = i + 2; + int endOff = htmluni.IndexOf(';', startOff); + string sub = htmluni.Substring(startOff, endOff - startOff); + int cVal = int.Parse(sub); + + switch (cVal) + { + case 128: + retValue.Append('€'); + break; + + default: + retValue.Append((char)cVal); + break; + } + + i = endOff; + } + break; + case '<': + { + i = htmluni.IndexOf('>', i); + } + break; + case '\t': + break; + + default: + { + retValue.Append(htmluni[i]); + } + break; + } + } + + return retValue.ToString(); + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml b/CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml new file mode 100644 index 00000000..7ed4c242 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + +