#244 #256 #PortraitLandscapePage

This commit is contained in:
Christian Fiedler
2013-10-21 17:51:19 +02:00
parent 3174669fb1
commit ab6990786d
12 changed files with 113 additions and 84 deletions

View File

@@ -295,6 +295,7 @@
<Compile Include="Pages\Dev\QRScanner.xaml.cs">
<DependentUpon>QRScanner.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\PortraitLandscapePage.cs" />
<Compile Include="Utility\Wp8StringManager.cs" />
<Compile Include="Utility\Utilities.cs">
<SubType>Code</SubType>

View File

@@ -11,7 +11,7 @@
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
@@ -26,10 +26,7 @@
<header:DefaultHeader x:Name="DefHeader" Grid.Row="0" HeaderName="{Binding Path=LocalizedResources.Favorites, Source={StaticResource LocalizedStrings}}"/>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<ListBox x:Name="ContentPanel" ItemsSource="{Binding Chairs}" Grid.Row="1" Margin="12,0,12,0">
<Style TargetType="ListBox">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
</Style>
<ListBox x:Name="TheList" ItemsSource="{Binding}" Grid.Row="1" Margin="12,0,12,0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>

View File

@@ -8,10 +8,12 @@
namespace CampusAppWP8.Pages.Departments
{
using System.Windows;
using System.Collections.ObjectModel;
using System.Windows.Navigation;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.Button;
using Microsoft.Phone.Controls;
using CampusAppWPortalLib8.Model.Departments;
/// <summary> Page to visualize the favorite department list. </summary>
/// <remarks> Fiedler, 18.10.2013. </remarks>
@@ -75,9 +77,9 @@ namespace CampusAppWP8.Pages.Departments
/// <remarks> Fiedler, 18.10.2013. </remarks>
private void SetListSource()
{
if (this.ContentPanel.ItemsSource == null)
if (this.TheList.ItemsSource == null)
{
this.ContentPanel.ItemsSource = DepartmentIndexPage.FavoriteFeed.Model.Faculties[0].Chairs;
this.TheList.ItemsSource = DepartmentIndexPage.FavoriteFeed.Model.Faculties[0].Chairs;
}
this.DefHeader.ProgressVisibility = Visibility.Collapsed;

View File

@@ -1,4 +1,5 @@
<phone:PhoneApplicationPage
<!--<phone:PhoneApplicationPage-->
<page:PortraitLandscapePage
x:Class="CampusAppWP8.Pages.Departments.DepartmentIndexPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -8,6 +9,7 @@
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"
xmlns:page="clr-namespace:CampusAppWP8.Utility"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -78,4 +80,4 @@
<lui:UpdateButtonAppBar Click="DeptForceUpdate_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
</page:PortraitLandscapePage>

View File

@@ -20,13 +20,12 @@ namespace CampusAppWP8.Pages.Departments
/// <summary> Page with a list of the faculties. </summary>
/// <remarks> Fiedler, 18.10.2013. </remarks>
/// <seealso cref="T:Microsoft.Phone.Controls.PhoneApplicationPage"/>
public partial class DepartmentIndexPage : PhoneApplicationPage
public partial class DepartmentIndexPage : PortraitLandscapePage
{
#region Member
/// <summary> Department/chair feed object, storing the model and data. </summary>
private static DepartmentFeed feed = null;
/// <summary> Department feed object for storing the favorite list. </summary>
private static DepartmentFavoriteFile favorite = null;
@@ -38,7 +37,7 @@ namespace CampusAppWP8.Pages.Departments
/// Initializes a new instance of the <see cref="DepartmentIndexPage" /> class.
/// </summary>
/// <remarks> Fiedler, 18.10.2013. </remarks>
public DepartmentIndexPage()
public DepartmentIndexPage() : base()
{
this.InitializeComponent();
this.DefHeader.ProgressVisibility = Visibility.Visible;
@@ -116,12 +115,7 @@ namespace CampusAppWP8.Pages.Departments
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (this.Orientation.Equals(PageOrientation.Landscape) || this.Orientation.Equals(PageOrientation.LandscapeLeft) || this.Orientation.Equals(PageOrientation.LandscapeRight))
{
ApplicationBar.Mode = Microsoft.Phone.Shell.ApplicationBarMode.Default;
}
if (NavigationContext.QueryString.ContainsKey(Constants.ParamRemoveBack))
{
if (NavigationContext.QueryString[Constants.ParamRemoveBack].Equals("true")) {
@@ -147,22 +141,6 @@ namespace CampusAppWP8.Pages.Departments
#region private
/// <summary> On orientation changed. </summary>
/// <remarks> Fiedler, 18.10.2013. </remarks>
/// <param name="sender"> sender object. </param>
/// <param name="e"> event args. </param>
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (e.Orientation.Equals(PageOrientation.Landscape) || e.Orientation.Equals(PageOrientation.LandscapeLeft) || e.Orientation.Equals(PageOrientation.LandscapeRight))
{
ApplicationBar.Mode = Microsoft.Phone.Shell.ApplicationBarMode.Default;
}
else
{
ApplicationBar.Mode = Microsoft.Phone.Shell.ApplicationBarMode.Minimized;
}
}
/// <summary> Initialize the feed objects and load the data. </summary>
/// <remarks> Fiedler, 18.10.2013. </remarks>
/// <param name="onLoaded"> (Optional) the on loaded. </param>

View File

@@ -11,7 +11,6 @@
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
OrientationChanged="PhoneApplicationPage_OrientationChanged"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">

View File

@@ -82,15 +82,6 @@ namespace CampusAppWP8.Pages.Departments
#region private
/// <summary>
/// On orientation changed.
/// </summary>
/// <param name="sender">sender object</param>
/// <param name="e">event args</param>
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
/// <summary>
/// On feed ready.
/// </summary>

View File

@@ -36,9 +36,6 @@
<phone:Pivot.ItemTemplate>
<DataTemplate>
<ListBox x:Name="TheListBox" ItemsSource="{Binding Path=Chairs, Mode=OneWay}">
<Style TargetType="ListBox">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
</Style>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>

View File

@@ -1,4 +1,4 @@
<phone:PhoneApplicationPage
<page:PortraitLandscapePage
x:Class="CampusAppWP8.Pages.Events.EventIndexPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -8,6 +8,7 @@
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"
xmlns:page="clr-namespace:CampusAppWP8.Utility"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -24,12 +25,6 @@
<!--header-->
<header:DefaultHeader x:Name="DefHeader" Grid.Row="0" 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" Margin="12,0,12,0">
<ListBox.ItemContainerStyle>
@@ -52,4 +47,4 @@
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
</page:PortraitLandscapePage>

View File

@@ -21,7 +21,7 @@ namespace CampusAppWP8.Pages.Events
/// <summary>
/// Overview page of all events.
/// </summary>
public partial class EventIndexPage : PhoneApplicationPage
public partial class EventIndexPage : PortraitLandscapePage
{
#region Method
@@ -29,7 +29,7 @@ namespace CampusAppWP8.Pages.Events
/// Event Feed object, which contains the RSS models and data.
/// </summary>
private static EventFeed eventFeed = null;
#endregion
#region Constructor
@@ -41,7 +41,7 @@ namespace CampusAppWP8.Pages.Events
{
this.InitializeComponent();
this.DefHeader.ProgressVisibility = Visibility.Visible;
ApplicationBarIconButton updateBtn = new ApplicationBarIconButton();
updateBtn.IconUri = new Uri(Icons.Update, UriKind.Relative);
updateBtn.Text = AppResources.UpdateBtn;
@@ -108,11 +108,6 @@ namespace CampusAppWP8.Pages.Events
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (this.Orientation.Equals(PageOrientation.Landscape) || this.Orientation.Equals(PageOrientation.LandscapeLeft) || this.Orientation.Equals(PageOrientation.LandscapeRight))
{
ApplicationBar.Mode = Microsoft.Phone.Shell.ApplicationBarMode.Default;
}
}
/// <summary>
@@ -130,26 +125,6 @@ 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

@@ -22,7 +22,7 @@ namespace CampusAppWP8.Utility.Lui.Button
#region Member
/// <summary> The value property. </summary>
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(AddButton), new PropertyMetadata(false));
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(DelButton), new PropertyMetadata(false));
/// <summary> The icon. </summary>
private static BitmapImage icon = new BitmapImage(new Uri(Icons.Delete, UriKind.Relative));

View File

@@ -0,0 +1,92 @@
//-----------------------------------------------------------------------
// <copyright file="PortraitLandscapePage.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>21.10.2013</date>
// <summary>Implements the portrait landscape page class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
/// <summary> A portrait landscape page. </summary>
/// <remarks> Fiedler, 21.10.2013. </remarks>
/// <seealso cref="T:Microsoft.Phone.Controls.PhoneApplicationPage"/>
public class PortraitLandscapePage : PhoneApplicationPage
{
/// <summary> The default application bar mode. </summary>
private ApplicationBarMode defaultApplicationBarMode;
private bool isDefaultModeSet = false;
/// <summary> Initializes a new instance of the PortraitLandscapePage class. </summary>
/// <remarks> Fiedler, 21.10.2013. </remarks>
protected PortraitLandscapePage() : base()
{
}
/// <summary> Wird aufgerufen, wenn eine Seite die aktive Seite in einem Frame wird. </summary>
/// <remarks> Fiedler, 21.10.2013. </remarks>
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs)"/>
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
if(this.ApplicationBar != null && this.isDefaultModeSet == false)
{
this.defaultApplicationBarMode = this.ApplicationBar.Mode;
this.isDefaultModeSet = true;
}
base.OnNavigatedTo(e);
if (this.ApplicationBar != null)
{
if (this.Orientation.Equals(PageOrientation.Landscape) || this.Orientation.Equals(PageOrientation.LandscapeLeft) || this.Orientation.Equals(PageOrientation.LandscapeRight))
{
this.ApplicationBar.Mode = ApplicationBarMode.Default;
}
}
}
/// <summary> Wird aufgerufen, nachdem die Orientation-Eigenschaft geändert wurde. </summary>
/// <remarks> Fiedler, 21.10.2013. </remarks>
/// <seealso cref="M:Microsoft.Phone.Controls.PhoneApplicationPage.OnOrientationChanged(OrientationChangedEventArgs)"/>
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (this.ApplicationBar != null)
{
if (this.defaultApplicationBarMode.Equals(ApplicationBarMode.Minimized))
{
if (e.Orientation.Equals(PageOrientation.Landscape) || e.Orientation.Equals(PageOrientation.LandscapeLeft) || e.Orientation.Equals(PageOrientation.LandscapeRight))
{
this.ApplicationBar.Mode = ApplicationBarMode.Default;
this.OnSwitchedToLandscape(e);
}
else
{
this.ApplicationBar.Mode = ApplicationBarMode.Minimized;
this.OnSwitchedToPortrait(e);
}
}
}
base.OnOrientationChanged(e);
}
/// <summary> Raises the orientation changed event. </summary>
/// <remarks> Fiedler, 21.10.2013. </remarks>
/// <param name="e"> Event information to send to registered event handlers. </param>
protected virtual void OnSwitchedToLandscape(OrientationChangedEventArgs e)
{
}
/// <summary> Raises the orientation changed event. </summary>
/// <remarks> Fiedler, 21.10.2013. </remarks>
/// <param name="e"> Event information to send to registered event handlers. </param>
protected virtual void OnSwitchedToPortrait(OrientationChangedEventArgs e)
{
}
}
}