Merge branch 'release/r#' into develmaster

This commit is contained in:
stubbfel
2013-10-22 14:03:39 +02:00
3 changed files with 67 additions and 63 deletions

View File

@@ -13,7 +13,6 @@
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
OrientationChanged="PhoneApplicationPage_OrientationChanged"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
@@ -270,7 +269,7 @@
</ScrollViewer>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" StateChanged="ApplicationBar_StateChanged" Opacity="0.5" >
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" StateChanged="ApplicationBar_StateChanged" Opacity="0.5">
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="Setting" Click="ApplicationBarMenuItem_Click"/>
<shell:ApplicationBarMenuItem Text="Setting2" Click="ApplicationBarMenuItem2_Click"/>

View File

@@ -39,9 +39,6 @@ namespace CampusAppWP8.Pages
/// <summary> List of initialise courses. </summary>
private CourseFeed initCourseList;
/// <summary> The previous orientation. </summary>
private PageOrientation prevOrientation;
/// <summary> Identifier for the ndef. </summary>
private long ndefId;
@@ -121,15 +118,6 @@ namespace CampusAppWP8.Pages
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (this.Orientation.Equals(PageOrientation.PortraitUp) || this.Orientation.Equals(PageOrientation.PortraitDown) || this.Orientation.Equals(PageOrientation.Portrait))
{
this.prevOrientation = PageOrientation.Portrait;
}
else
{
this.prevOrientation = PageOrientation.Landscape;
}
this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);
}
@@ -162,50 +150,19 @@ namespace CampusAppWP8.Pages
this.initCourseList.SaveData();
}
/// <summary> Method handle OrientationPage. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
/// <param name="sender"> Caller of the function. </param>
/// <param name="e"> some EventArgs. </param>
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
/// <summary> Raises the orientation changed event. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
/// <seealso cref="M:CampusAppWP8.Utility.PortraitLandscapePage.OnSwitchedToPortrait(OrientationChangedEventArgs)"/>
/// ### <param name="e"> Event information to send to registered event handlers. </param>
protected override void OnSwitchedToPortrait(OrientationChangedEventArgs e)
{
// Switch the placement of the buttons based on an orientation change.
if (this.Orientation.Equals(PageOrientation.LandscapeLeft))
{
this.ContentPanel.Margin = new Thickness(24, -24, 76, 0);
this.AppTitle.Margin = new Thickness(12, 17, 0, 28);
if (!this.prevOrientation.Equals(PageOrientation.Landscape))
{
this.MoveGridToLandscape();
this.prevOrientation = PageOrientation.Landscape;
}
}
else if (this.Orientation.Equals(PageOrientation.LandscapeRight))
{
this.ContentPanel.Margin = new Thickness(76, -24, 24, 0);
this.AppTitle.Margin = new Thickness(64, 17, 0, 28);
if (!this.prevOrientation.Equals(PageOrientation.Landscape))
{
this.MoveGridToLandscape();
this.prevOrientation = PageOrientation.Landscape;
}
}
else
{
this.ContentPanel.Margin = new Thickness(12, 0, 12, 12);
this.AppTitle.Margin = new Thickness(12, 17, 0, 28);
base.OnSwitchedToPortrait(e);
if (!this.prevOrientation.Equals(PageOrientation.Portrait))
{
this.MoveToPortrait();
this.prevOrientation = PageOrientation.Portrait;
}
}
}
this.ApplicationBar.Opacity = 0.5;
//this.ContentPanel.Margin = new Thickness(12, 0, 12, 12);
//this.AppTitle.Margin = new Thickness(12, 17, 0, 28);
/// <summary> Move to Portrait format. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
private void MoveToPortrait()
{
if (!this.Row0.Children.Contains(this.MailAppButton)
&& !this.Row1.Children.Contains(this.OpenHoursAppButton)
&& !this.Row2.Children.Contains(this.LinkAppButton))
@@ -226,10 +183,20 @@ namespace CampusAppWP8.Pages
this.LinkAppButton.SetValue(Grid.ColumnProperty, 2);
}
/// <summary> Move Grid to landscape format. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
private void MoveGridToLandscape()
/// <summary> Raises the orientation changed event. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
/// <seealso cref="M:CampusAppWP8.Utility.PortraitLandscapePage.OnSwitchedToLandscape(OrientationChangedEventArgs)"/>
/// ### <param name="e"> Event information to send to registered event handlers. </param>
protected override void OnSwitchedToLandscape(OrientationChangedEventArgs e)
{
base.OnSwitchedToLandscape(e);
this.ApplicationBar.Opacity = 1.0;
//this.ContentPanel.Margin = new Thickness(76, -24, 24, 0); // LandscapeRight
//this.ContentPanel.Margin = new Thickness(24, -24, 76, 0); // LandscapeLeft
//this.AppTitle.Margin = new Thickness(12, 17, 0, 28);
if (!this.Row3.Children.Contains(this.MailAppButton)
&& !this.Row3.Children.Contains(this.OpenHoursAppButton)
&& !this.Row3.Children.Contains(this.LinkAppButton))

View File

@@ -19,7 +19,12 @@ namespace CampusAppWP8.Utility
{
/// <summary> The default application bar mode. </summary>
private ApplicationBarMode defaultApplicationBarMode;
/// <summary> true if this object is default mode set. </summary>
private bool isDefaultModeSet = false;
/// <summary> The last orientation. </summary>
private PageOrientation lastOrientation;
/// <summary> true to suppress application bar mode change. </summary>
private bool suppressApplicationBarModeChange = false;
/// <summary> Initializes a new instance of the PortraitLandscapePage class. </summary>
/// <remarks> Fiedler, 21.10.2013. </remarks>
@@ -27,6 +32,14 @@ namespace CampusAppWP8.Utility
{
}
/// <summary> Sets suppress mode. </summary>
/// <remarks> Fiedler, 22.10.2013. </remarks>
/// <param name="suppress"> the suppress. </param>
protected void SetSuppressMode(bool suppress)
{
this.suppressApplicationBarModeChange = suppress;
}
/// <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)"/>
@@ -40,7 +53,16 @@ namespace CampusAppWP8.Utility
base.OnNavigatedTo(e);
if (this.ApplicationBar != null)
if (this.Orientation.Equals(PageOrientation.Landscape) || this.Orientation.Equals(PageOrientation.LandscapeLeft) || this.Orientation.Equals(PageOrientation.LandscapeRight))
{
this.lastOrientation = PageOrientation.Landscape;
}
else
{
this.lastOrientation = PageOrientation.Portrait;
}
if (this.ApplicationBar != null && this.suppressApplicationBarModeChange == false)
{
if (this.Orientation.Equals(PageOrientation.Landscape) || this.Orientation.Equals(PageOrientation.LandscapeLeft) || this.Orientation.Equals(PageOrientation.LandscapeRight))
{
@@ -54,24 +76,40 @@ namespace CampusAppWP8.Utility
/// <seealso cref="M:Microsoft.Phone.Controls.PhoneApplicationPage.OnOrientationChanged(OrientationChangedEventArgs)"/>
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (this.ApplicationBar != null)
if (this.ApplicationBar != null && this.suppressApplicationBarModeChange == false)
{
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);
}
}
}
if (e.Orientation.Equals(PageOrientation.Landscape) || e.Orientation.Equals(PageOrientation.LandscapeLeft) || e.Orientation.Equals(PageOrientation.LandscapeRight))
{
if (this.lastOrientation.Equals(PageOrientation.Portrait))
{
this.OnSwitchedToLandscape(e);
}
this.lastOrientation = PageOrientation.Landscape;
}
else
{
if (this.lastOrientation.Equals(PageOrientation.Landscape))
{
this.OnSwitchedToPortrait(e);
}
this.lastOrientation = PageOrientation.Portrait;
}
base.OnOrientationChanged(e);
}