Merge branch 'feature/#218' into develop

This commit is contained in:
Christian Fiedler
2013-10-08 15:52:06 +02:00
18 changed files with 237 additions and 30 deletions

View File

@@ -180,7 +180,7 @@ namespace CampusAppWP8.Pages.Departments
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));
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?" + Constants.ParamUrl + "=" + infoBtn.Tag.ToString() + "&" + Constants.ParamName + "=" + chairName, UriKind.Relative));
}
#endregion

View File

@@ -47,16 +47,7 @@ namespace CampusAppWP8.Pages.Departments
this.progressBar.Visibility = Visibility.Visible;
//// init feed objects
if (DepartmentIndexPage.feed == null)
{
DepartmentIndexPage.feed = new DepartmentFeed(false);
}
DepartmentIndexPage.feed.OnLoaded += new DepartmentFeed.OnIO(this.SetupFacultyList);
DepartmentIndexPage.feed.OnFailedWeb += new DepartmentFeed.OnFailed(this.FeedIsFailedWeb);
DepartmentIndexPage.feed.OnFailedFile += new DepartmentFeed.OnFailed(this.FeedIsFailedFile);
DepartmentIndexPage.feed.LoadData(Utilities.GetLoadModus<CampusAppWPortalLib8.Model.Departments.DepartmentModel>());
DepartmentIndexPage.InitFeed(this.SetupFacultyList, this.FeedIsFailedWeb, this.FeedIsFailedFile);
if (DepartmentIndexPage.favorite == null)
{
@@ -83,10 +74,7 @@ namespace CampusAppWP8.Pages.Departments
set
{
if (value != DepartmentIndexPage.feed)
{
DepartmentIndexPage.feed = value;
}
DepartmentIndexPage.feed = value;
}
}
@@ -179,6 +167,26 @@ namespace CampusAppWP8.Pages.Departments
{
}
/// <summary>
/// Initialize the feed objects and load the data.
/// </summary>
public static void InitFeed(DepartmentFeed.OnIO onLoaded = null, DepartmentFeed.OnIO failedWeb = null, DepartmentFeed.OnIO failedFile = null)
{
if (DepartmentIndexPage.feed == null)
{
DepartmentIndexPage.feed = new DepartmentFeed(false);
}
if(onLoaded != null)
DepartmentIndexPage.feed.OnLoaded += new DepartmentFeed.OnIO(onLoaded);
if(failedWeb != null)
DepartmentIndexPage.feed.OnFailedWeb += new DepartmentFeed.OnFailed(failedWeb);
if(failedFile != null)
DepartmentIndexPage.feed.OnFailedFile += new DepartmentFeed.OnFailed(failedFile);
DepartmentIndexPage.feed.LoadData(Utilities.GetLoadModus<CampusAppWPortalLib8.Model.Departments.DepartmentModel>());
}
/// <summary>
/// Setup the faculty list.
/// </summary>

View File

@@ -8,14 +8,23 @@
namespace CampusAppWP8.Pages.Departments
{
using System;
using System.Windows;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Departments;
/// <summary>
/// Info page of a chair.
/// </summary>
public partial class DepartmentInfoPage : PhoneApplicationPage
{
private bool feedLoadedFlag = false;
private string chairName = string.Empty;
#region Constructor
/// <summary>
@@ -41,15 +50,32 @@ namespace CampusAppWP8.Pages.Departments
{
base.OnNavigatedTo(e);
string url = string.Empty;
string chairName = string.Empty;
this.feedLoadedFlag = false;
if (NavigationContext.QueryString.TryGetValue("url", out url)
&& NavigationContext.QueryString.TryGetValue("name", out chairName))
string url = string.Empty;
if(NavigationContext.QueryString.TryGetValue(Constants.ParamName, out this.chairName))
{
this.PageHeadline.Text = this.chairName;
}
if (NavigationContext.QueryString.TryGetValue(Constants.ParamUrl, out url))
{
this.PageHeadline.Text = chairName;
this.WebBrowser.Navigate(new Uri(url, UriKind.Absolute));
}
else
{
CampusAppWP8.Feed.Departments.DepartmentFeed temp = DepartmentIndexPage.Feed;
if (temp != null)
{
this.OnFeedReady();
}
else
{
DepartmentIndexPage.InitFeed(this.OnFeedReady);
}
}
}
#endregion
@@ -64,6 +90,53 @@ namespace CampusAppWP8.Pages.Departments
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
/// <summary>
/// On feed ready.
/// </summary>
private void OnFeedReady()
{
if (this.feedLoadedFlag == false)
{
this.feedLoadedFlag = true;
DepartmentIndexPage.Feed.OnLoaded -= this.OnFeedReady;
ChairModel chair = null;
ObservableCollection<FacultyModel> tempModelList = DepartmentIndexPage.GetFeed().Model.Faculties;
foreach (CampusAppWPortalLib8.Model.Departments.FacultyModel model in tempModelList)
{
if (chair == null)
{
chair = model.GetChairModel(this.chairName);
}
}
if (chair != null)
{
this.WebBrowser.Navigate(new Uri(chair.Url, UriKind.Absolute));
}
else
{
MessageBoxResult res = MessageBox.Show(AppResources.DepartmentNotFound + " " + AppResources.DepartmentForwarding, string.Empty, MessageBoxButton.OKCancel);
switch (res)
{
case MessageBoxResult.OK:
{
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentIndexPage, UriKind.Relative));
}
break;
case MessageBoxResult.Cancel:
{
NavigationService.GoBack();
}
break;
}
}
}
}
#endregion

View File

@@ -205,7 +205,7 @@ namespace CampusAppWP8.Pages.Departments
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));
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?" + Constants.ParamUrl + "=" + infoBtn.Tag.ToString() + "&" + Constants.ParamName + "=" + chairName, UriKind.Relative));
}
#endregion

View File

@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -23,10 +24,13 @@
<ProgressBar x:Name="progressBar" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed" IsIndeterminate="True"/>
<!-- Title and headline -->
<header:DefaultHeader HeaderName="{Binding Path=LocalizedResources.EventApp_Title, Source={StaticResource LocalizedStrings}}" />
<!--
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Path=LocalizedResources.EventApp_Title, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
-->
<!-- Content -->
<ListBox x:Name="EventList" Grid.Row="1">
<ListBox.ItemContainerStyle>
@@ -39,7 +43,15 @@
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
<lui:NavigateButton Name="EventItem" QuerryStringValue="{Binding Index}" Url="{Binding Path=Constants.PathEvent_EventPage, Source={StaticResource Const}}" QuerryStringName="{Binding Path=Constants.ParamPivotIndex, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}" HorizontalContentAlignment="Left">
<TextBlock TextWrapping="Wrap" Text="{Binding Title}"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" TextWrapping="NoWrap" Text="{Binding ShortDate}" Margin="-8,0,10,0"/>
<TextBlock Grid.Column="1" TextWrapping="Wrap" Text="{Binding Title}"/>
</Grid>
</lui:NavigateButton>
</Border>
</DataTemplate>

View File

@@ -125,6 +125,26 @@ namespace CampusAppWP8.Pages.Events
base.OnNavigatedFrom(e);
}
/// <summary>
/// Methods overrides the OnOrientationChanged-Method.
/// </summary>
/// <param name="e">orientation changed event args.</param>
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.Landscape
|| e.Orientation == PageOrientation.LandscapeLeft
|| e.Orientation == PageOrientation.LandscapeRight)
{
ApplicationBar.Mode = ApplicationBarMode.Default;
}
else
{
ApplicationBar.Mode = ApplicationBarMode.Minimized;
}
base.OnOrientationChanged(e);
}
#endregion
#region private

View File

@@ -34,13 +34,13 @@
<Grid x:Name="EventTextGrid" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="Auto" MaxHeight="300"/>
<RowDefinition Height="*" />
</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"/>
<TextBlock x:Name="EventHeadline" Text="{Binding Path=Title, Mode=OneWay}" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource PhoneTextTitle2Style}"/>
<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" />
<TextBlock x:Name="EventText" Text="{Binding Path=Text, Mode=OneWay}" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource PhoneTextNormalStyle}" />
</ScrollViewer>
</Grid>

View File

@@ -21,7 +21,7 @@ namespace CampusAppWP8.Pages.Events
using CampusAppWPortalLib8.Model.RSS;
/// <summary>
/// EventPage, where every event fees has his own PivotItem.
/// EventPage, where every event feed has his own PivotItem.
/// </summary>
public partial class EventPage : PhoneApplicationPage
{

View File

@@ -43,7 +43,15 @@
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
<lui:NavigateButton Name="NewsItem" QuerryStringValue="{Binding Index}" Url="{Binding Path=Constants.PathNews_NewsPage, Source={StaticResource Const}}" QuerryStringName="{Binding Path=Constants.ParamPivotIndex, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}" HorizontalContentAlignment="Left">
<TextBlock TextWrapping="Wrap" Text="{Binding Title}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" TextWrapping="NoWrap" Text="{Binding ShortDate}" Margin="-8, 0, 10, 0"/>
<TextBlock Grid.Column="1" TextWrapping="Wrap" Text="{Binding Title}" />
</Grid>
</lui:NavigateButton>
</Border>
</DataTemplate>

View File

@@ -125,6 +125,26 @@ namespace CampusAppWP8.Pages.News
#region private
/// <summary>
/// Methods overrides the OnOrientationChanged-Method.
/// </summary>
/// <param name="e">orientation changed event args.</param>
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.LandscapeRight
|| e.Orientation == PageOrientation.LandscapeLeft
|| e.Orientation == PageOrientation.Landscape)
{
ApplicationBar.Mode = ApplicationBarMode.Default;
}
else
{
ApplicationBar.Mode = ApplicationBarMode.Minimized;
}
base.OnOrientationChanged(e);
}
/// <summary>
/// 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

View File

@@ -33,13 +33,13 @@
<Grid x:Name="NewsTextGrid" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="Auto" MaxHeight="300"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock x:Name="NewsHeadline" Text="{Binding Path=Title, Mode=OneWay}" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="42"/>
<TextBlock x:Name="NewsHeadline" Text="{Binding Path=Title, Mode=OneWay}" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Style="{StaticResource PhoneTextTitle2Style}"/>
<ScrollViewer Grid.Row="1">
<TextBlock x:Name="NewsText" Text="{Binding Path=Text, Mode=OneWay}" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="24" />
<TextBlock x:Name="NewsText" Text="{Binding Path=Text, Mode=OneWay}" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource PhoneTextNormalStyle}" />
</ScrollViewer>
</Grid>

View File

@@ -150,6 +150,24 @@ namespace CampusAppWP8.Pages.News
}
}
/*
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.Landscape
|| e.Orientation == PageOrientation.LandscapeLeft
|| e.Orientation == PageOrientation.LandscapeRight)
{
ApplicationBar.Mode = ApplicationBarMode.Default;
}
else
{
ApplicationBar.Mode = ApplicationBarMode.Minimized;
}
base.OnOrientationChanged(e);
}
*/
/// <summary>
/// Called when the index of the selected PivotItem is changed.
/// Set the text Grid to visible and the WebBrowser to collapsed.

View File

@@ -195,6 +195,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Möchten Sie Weiter zur Lehstuhlübersicht? ähnelt.
/// </summary>
public static string DepartmentForwarding {
get {
return ResourceManager.GetString("DepartmentForwarding", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Der angegebene Lehrstuhl konnte nicht gefunden werden. ähnelt.
/// </summary>
public static string DepartmentNotFound {
get {
return ResourceManager.GetString("DepartmentNotFound", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
/// </summary>

View File

@@ -439,5 +439,10 @@
</data>
<data name="MensaApp_CloseMensa" xml:space="preserve">
<value>Die Mensa ist heute geschlossen</value>
<data name="DepartmentForwarding" xml:space="preserve">
<value>Möchten Sie Weiter zur Lehstuhlübersicht?</value>
</data>
<data name="DepartmentNotFound" xml:space="preserve">
<value>Der angegebene Lehrstuhl konnte nicht gefunden werden.</value>
</data>
</root>

View File

@@ -555,4 +555,7 @@
<data name="DeploymentNumber" xml:space="preserve">
<value>3</value>
</data>
<data name="ParamName" xml:space="preserve">
<value>name</value>
</data>
</root>

View File

@@ -672,6 +672,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die name ähnelt.
/// </summary>
public static string ParamName {
get {
return ResourceManager.GetString("ParamName", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Uebersicht ähnelt.
/// </summary>

View File

@@ -135,6 +135,18 @@ namespace CampusAppWPortalLib8.Model.RSS
}
}
/// <summary>
/// Gets the date of the timestamp as string.
/// example: 25.06.
/// </summary>
public string ShortDate
{
get
{
return string.Format("{0:dd.MM.}", this.timestamp);
}
}
/// <summary>
/// Gets the time of the timestamp as string.
/// example: 12:56.

View File

@@ -179,6 +179,7 @@
<Content Include="srcImages\listicons\lecture.svg" />
<Content Include="srcImages\listicons\practise.svg" />
<Content Include="srcImages\listicons\seminar.svg" />
<Content Include="srcImages\listicons\speaker.svg" />
<Content Include="srcImages\optionbuttons\add.svg" />
<Content Include="srcImages\optionbuttons\add_contact.svg" />
<Content Include="srcImages\optionbuttons\add_small.svg" />