diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs index 3da6312e..30a96096 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs @@ -1,53 +1,66 @@ -using CampusAppWP8.Pages.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; -using CampusAppWP8.Feed.Events; - +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 03.05.2013 +//----------------------------------------------------------------------------- namespace CampusAppWP8.Pages.Events { + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Navigation; + using CampusAppWP8.Feed.Events; + using CampusAppWP8.Model.events_news; + 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. + /// Gets or sets Event Feed object, which contains the RSS models and data. /// public static EventFeed eventFeed { get; set; } /// - /// Default constructor. + /// Initializes a new instance of the class. /// public EventIndexPage() { - InitializeComponent(); + this.InitializeComponent(); EventIndexPage.eventFeed = new EventFeed(); } /// - /// On navigation to this page, creates a FeedEventHandler and load the rss feed data. + /// 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(); + if ((EventIndexPage.eventFeed.Model == null) + || (EventIndexPage.eventFeed.Model.Channel == null) + || (EventIndexPage.eventFeed.Model.Channel.Count() == 0) + || (EventIndexPage.eventFeed.Model.Channel[0].item == null) + || (EventIndexPage.eventFeed.Model.Channel[0].item.Count() == 0)) + { + // Set handler and load the fees informations. + EventIndexPage.eventFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.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 + /// 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() @@ -71,7 +84,7 @@ namespace CampusAppWP8.Pages.Events tempBtn.HorizontalContentAlignment = HorizontalAlignment.Stretch; tempBtn.BorderThickness = new Thickness(0.0); tempBtn.Padding = new Thickness(0.0); - tempBtn.Click += EventRowAppButton_Click; + tempBtn.Click += this.EventRowAppButton_Click; tempBtn.Tag = i; this.ButtonPanel.Items.Add(tempBtn); @@ -80,12 +93,11 @@ namespace CampusAppWP8.Pages.Events } /// - /// Return the eventFeed object. + /// Gets the eventFeed object. /// - static public EventFeed GetEventFeed + public static EventFeed GetEventFeed { get { return EventIndexPage.eventFeed; } - set { } } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml index e5782082..a84c2441 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml @@ -37,7 +37,7 @@ - +