This commit is contained in:
Christian Fiedler
2013-06-17 14:49:00 +02:00
parent 53d5fa413e
commit 978fb9b83b
5 changed files with 133 additions and 105 deletions

View File

@@ -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;
//-----------------------------------------------------------------------------
// <copyright file="EventIndexPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>03.05.2013</sience>
//-----------------------------------------------------------------------------
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;
/// <summary>
/// Overview page of all events.
/// </summary>
public partial class EventIndexPage : PhoneApplicationPage
{
/// <summary>
/// Event Feed object, which contains the rss models and data.
/// Gets or sets Event Feed object, which contains the RSS models and data.
/// </summary>
public static EventFeed eventFeed { get; set; }
/// <summary>
/// Default constructor.
/// Initializes a new instance of the <see cref="EventIndexPage" /> class.
/// </summary>
public EventIndexPage()
{
InitializeComponent();
this.InitializeComponent();
EventIndexPage.eventFeed = new EventFeed();
}
/// <summary>
/// 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.
/// </summary>
/// <param name="e">event args</param>
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();
}
}
/// <summary>
/// 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.
/// </summary>
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
}
/// <summary>
/// Return the eventFeed object.
/// Gets the eventFeed object.
/// </summary>
static public EventFeed GetEventFeed
public static EventFeed GetEventFeed
{
get { return EventIndexPage.eventFeed; }
set { }
}
/// <summary>

View File

@@ -37,7 +37,7 @@
</Grid.RowDefinitions>
<TextBlock x:Name="EventHeadline" Text="{Binding Path=Title, Mode=OneWay}" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="42"/>
<ScrollViewer Grid.Row="1">
<ScrollViewer x:Name="EventTextScroll" Grid.Row="1">
<TextBlock x:Name="EventText" Text="{Binding Path=Text, Mode=OneWay}" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="24" />
</ScrollViewer>
<Button Name="EventHome" Content="{Binding Path=LocalizedResources.NewsHomeBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="2" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="EventHome_Click"/>

View File

@@ -1,16 +1,22 @@
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Navigation;
//-----------------------------------------------------------------------------
// <copyright file="EventPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>03.05.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.Events
{
using System;
using System.Linq;
using System.Windows;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
/// <summary>
/// EventPage, where every event fees has his own pivotitem.
/// EventPage, where every event fees has his own PivotItem.
/// </summary>
public partial class EventPage : PhoneApplicationPage
{
@@ -20,19 +26,19 @@ namespace CampusAppWP8.Pages.Events
private bool isSourceSet = false;
/// <summary>
/// Default constructor.
/// Initializes a new instance of the <see cref="EventPage" /> class.
/// </summary>
public EventPage()
{
InitializeComponent();
this.InitializeComponent();
}
/// <summary>
/// On navigation to this page.
/// The pivotitem source will be set, if it wasn't befor.
/// Navigating to the submited index of the choosen pivotitem page.
/// The PivotItem source will be set, if it wasn't before.
/// Navigating to the submitted index of the chosen PivotItem page.
/// </summary>
/// <param name="e"></param>
/// <param name="e">Event Args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
@@ -49,7 +55,7 @@ namespace CampusAppWP8.Pages.Events
}
}
string pivotIndex = "";
string pivotIndex = string.Empty;
// Navigate to the selected pivotitem
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
@@ -57,12 +63,15 @@ namespace CampusAppWP8.Pages.Events
int pivotIndexInt = int.Parse(pivotIndex);
// if the index is in the range of the array
if((pivotIndexInt >= 0) && (pivotIndexInt < EventIndexPage.GetEventFeed.Model.Channel[0].item.Count()))
if ((pivotIndexInt >= 0) && (pivotIndexInt < EventIndexPage.GetEventFeed.Model.Channel[0].item.Count()))
{
EventPivot.SelectedIndex = pivotIndexInt;
}
else
{
MessageBox.Show("ERROR: pivotIndex out of range!!!");
}
}
}
/// <summary>
@@ -80,7 +89,7 @@ namespace CampusAppWP8.Pages.Events
/// <summary>
/// On clicking the link button if a link exists in the feed
/// (lower right).
/// Open the webbrowser with the url set in the feed.
/// Open the WebBrowser with the url set in the feed.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>

View File

@@ -1,57 +1,66 @@
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.Model.events_news;
using CampusAppWP8.Utility;
using CampusAppWP8.Resources;
using System.Collections.ObjectModel;
using CampusAppWP8.Pages.News;
using CampusAppWP8.Feed.News;
//-----------------------------------------------------------------------------
// <copyright file="NewsIndexPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>03.05.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.News
{
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.News;
using CampusAppWP8.Model.events_news;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
/// <summary>
/// Overview page of all news.
/// </summary>
public partial class NewsIndexPage : PhoneApplicationPage
{
/// <summary>
/// News Feed object, which contains the rss models and data.
/// Gets or sets News Feed object, which contains the RSS models and data.
/// </summary>
public static NewsFeed newsFeed { get; set; }
/// <summary>
/// Default constructor.
/// Initializes a new instance of the <see cref="NewsIndexPage" /> class.
/// </summary>
public NewsIndexPage()
{
InitializeComponent();
this.InitializeComponent();
NewsIndexPage.newsFeed = new NewsFeed();
}
/// <summary>
/// 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.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Set handler and load the fees informations.
NewsIndexPage.newsFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(SetupNewsPageList);
NewsIndexPage.newsFeed.LoadFeed();
if ((NewsIndexPage.newsFeed.Model == null)
|| (NewsIndexPage.newsFeed.Model.Channel == null)
|| (NewsIndexPage.newsFeed.Model.Channel.Count() == 0)
|| (NewsIndexPage.newsFeed.Model.Channel[0].item == null)
|| (NewsIndexPage.newsFeed.Model.Channel[0].item.Count() == 0))
{
// Set handler and load the fees informations.
NewsIndexPage.newsFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.SetupNewsPageList);
NewsIndexPage.newsFeed.LoadFeed();
}
}
/// <summary>
/// Is called after the rss feeds are loaded into the newsFeed model.
/// If there was no feed informations set to the ui, the feed list
/// 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.
/// </summary>
private void SetupNewsPageList()
@@ -75,7 +84,7 @@ namespace CampusAppWP8.Pages.News
tempBtn.HorizontalContentAlignment = HorizontalAlignment.Stretch;
tempBtn.BorderThickness = new Thickness(0.0);
tempBtn.Padding = new Thickness(0.0);
tempBtn.Click += NewsRowAppButton_Click;
tempBtn.Click += this.NewsRowAppButton_Click;
tempBtn.Tag = i;
this.ButtonPanel.Items.Add(tempBtn);
@@ -84,12 +93,11 @@ namespace CampusAppWP8.Pages.News
}
/// <summary>
/// Return the newsFeed object.
/// Gets the newsFeed object.
/// </summary>
static public NewsFeed GetNewsFeed
public static NewsFeed GetNewsFeed
{
get { return NewsIndexPage.newsFeed; }
set { }
}
/// <summary>

View File

@@ -1,27 +1,22 @@
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.Xml.Linq;
using System.Xml;
using System.IO;
using Microsoft.Phone.Tasks;
using CampusAppWP8.Model.events_news;
using CampusAppWP8.Utility;
using CampusAppWP8.Resources;
//-----------------------------------------------------------------------------
// <copyright file="NewsPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>03.05.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.News
{
using System;
using System.Linq;
using System.Windows;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
/// <summary>
/// EventPage, where every news fees has his own pivotitem.
/// EventPage, where every news fees has his own PivotItem.
/// </summary>
public partial class NewsPage : PhoneApplicationPage
{
@@ -31,36 +26,37 @@ namespace CampusAppWP8.Pages.News
private bool isSourceSet = false;
/// <summary>
/// Default constructor.
/// Initializes a new instance of the <see cref="NewsPage" /> class.
/// </summary>
public NewsPage()
{
InitializeComponent();
this.InitializeComponent();
}
/// <summary>
/// On navigation to this page.
/// The pivotitem source will be set, if it wasn't befor.
/// Navigating to the submited index of the choosen pivotitem page.
/// The PivotItem source will be set, if it wasn't before.
/// Navigating to the submitted index of the chosen PivotItem page.
/// </summary>
/// <param name="e"></param>
/// <param name="e">Event Args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Set pivotitem Source
if (this.isSourceSet == false)
{
if ((NewsIndexPage.GetNewsFeed.Model != null)
&& (NewsIndexPage.GetNewsFeed.Model.Channel != null)
&& (NewsIndexPage.GetNewsFeed.Model.Channel.Count() >= 1))
&& (NewsIndexPage.GetNewsFeed.Model.Channel.Count() >= 1)
&& (this.NewsPivot.Items.Count() == 0))
{
this.NewsPivot.ItemsSource = NewsIndexPage.GetNewsFeed.Model.Channel[0].item;
this.isSourceSet = true;
}
}
string pivotIndex = "";
string pivotIndex = string.Empty;
// Navigate to the selected pivotitem
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
@@ -69,11 +65,14 @@ namespace CampusAppWP8.Pages.News
// if the index is in the range of the array
if ((pivotIndexInt >= 0) && (pivotIndexInt < NewsIndexPage.GetNewsFeed.Model.Channel[0].item.Count()))
{
NewsPivot.SelectedIndex = pivotIndexInt;
}
else
{
MessageBox.Show("ERROR: pivotIndex out of range!!!");
}
}
}
/// <summary>
@@ -91,7 +90,7 @@ namespace CampusAppWP8.Pages.News
/// <summary>
/// On clicking the link button if a link exists in the feed
/// (lower right).
/// Open the webbrowser with the url set in the feed.
/// Open the WebBrowser with the url set in the feed.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>