Merge branch 'release/r#104' into develmaster
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles/ListButton.xaml"/>
|
||||
<ResourceDictionary Source="Styles/StartPageStyles.xaml"/>
|
||||
<ResourceDictionary>
|
||||
<local:LocalizedStrings xmlns:local="clr-namespace:CampusAppWP8" x:Key="LocalizedStrings"/>
|
||||
<local:ThemelizedIcons xmlns:local="clr-namespace:CampusAppWP8" x:Key="ThemelizedIcons"/>
|
||||
|
||||
@@ -216,6 +216,7 @@
|
||||
<Compile Include="Utility\Lui\Button\PhoneButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\LinkButton.cs" />
|
||||
<Compile Include="Utility\StringManager.cs" />
|
||||
<Compile Include="Utility\TiltEffect.cs" />
|
||||
<Compile Include="Utility\URLList.cs" />
|
||||
<Compile Include="Utility\XmlApi.cs" />
|
||||
<Compile Include="Utility\XmlFeed.cs" />
|
||||
@@ -290,6 +291,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\StartPageStyles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\ListButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18046
|
||||
// Laufzeitversion:4.0.30319.18051
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
@@ -177,6 +177,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Haus- aufgaben ähnelt.
|
||||
/// </summary>
|
||||
public static string HomeworkApp_Title2 {
|
||||
get {
|
||||
return ResourceManager.GetString("HomeworkApp_Title2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
|
||||
/// </summary>
|
||||
@@ -447,6 +456,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Öffnungs- zeiten ähnelt.
|
||||
/// </summary>
|
||||
public static string OpenHoursApp_Title2 {
|
||||
get {
|
||||
return ResourceManager.GetString("OpenHoursApp_Title2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Fachschaften ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -149,8 +149,8 @@
|
||||
<data name="EventApp_Title" xml:space="preserve">
|
||||
<value>Events</value>
|
||||
</data>
|
||||
<data name="HomeworkApp_Title" xml:space="preserve">
|
||||
<value>Hausaufgaben</value>
|
||||
<data name="HomeworkApp_Title2" xml:space="preserve">
|
||||
<value>Haus- aufgaben</value>
|
||||
</data>
|
||||
<data name="LectureApp_Title" xml:space="preserve">
|
||||
<value>Vorlesungen</value>
|
||||
@@ -167,8 +167,8 @@
|
||||
<data name="NewsApp_Title" xml:space="preserve">
|
||||
<value>News</value>
|
||||
</data>
|
||||
<data name="OpenHoursApp_Title" xml:space="preserve">
|
||||
<value>Öffnungszeiten</value>
|
||||
<data name="OpenHoursApp_Title2" xml:space="preserve">
|
||||
<value>Öffnungs- zeiten</value>
|
||||
</data>
|
||||
<data name="OSAApp_Title" xml:space="preserve">
|
||||
<value>Fachschaften</value>
|
||||
@@ -293,4 +293,10 @@
|
||||
<data name="LinkApp_CommonLinks" xml:space="preserve">
|
||||
<value>allg. Links</value>
|
||||
</data>
|
||||
<data name="HomeworkApp_Title" xml:space="preserve">
|
||||
<value>Hausaufgaben</value>
|
||||
</data>
|
||||
<data name="OpenHoursApp_Title" xml:space="preserve">
|
||||
<value>Öffnungszeiten</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2,11 +2,13 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tilt="clr-namespace:CampusAppWP8.Utility"
|
||||
mc:Ignorable="d">
|
||||
<Style x:Key="ListButtonStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="Gray"/>
|
||||
<Setter Property="BorderBrush" Value="Gray"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="Margin" Value="-10"/>
|
||||
<Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource PhoneBorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0,2,0,0"/>
|
||||
<Setter Property="Margin" Value="-11"/>
|
||||
<Setter Property="tilt:TiltEffect.IsTiltEnabled" Value="True"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
28
CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml
Normal file
28
CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tilt="clr-namespace:CampusAppWP8.Utility"
|
||||
mc:Ignorable="d">
|
||||
<Style x:Key="StartPageStackPanelStyle" TargetType="StackPanel">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
|
||||
</Style>
|
||||
<Style x:Key="StartPageButton" TargetType="Button">
|
||||
<Setter Property="Margin" Value="-10"/>
|
||||
<Setter Property="BorderBrush" Value="{x:Null}"/>
|
||||
<Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="tilt:TiltEffect.IsTiltEnabled" Value="True"/>
|
||||
</Style>
|
||||
<Style x:Key="StartPageButtonText" TargetType="TextBlock">
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style x:Key="StartPageButtonImg" TargetType="Image">
|
||||
<Setter Property="Height" Value="100"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
648
CampusAppWP8/CampusAppWP8/Utility/TiltEffect.cs
Normal file
648
CampusAppWP8/CampusAppWP8/Utility/TiltEffect.cs
Normal file
@@ -0,0 +1,648 @@
|
||||
/*
|
||||
Copyright (c) 2010 Microsoft Corporation. All rights reserved.
|
||||
Use of this sample source code is subject to the terms of the Microsoft license
|
||||
agreement under which you licensed this sample source code and is provided AS-IS.
|
||||
If you did not accept the terms of the license agreement, you are not authorized
|
||||
to use this sample source code. For the terms of the license, please see the
|
||||
license agreement between you and Microsoft.
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
|
||||
#if WINDOWS_PHONE
|
||||
using Microsoft.Phone.Controls;
|
||||
#endif
|
||||
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// This code provides attached properties for adding a 'tilt' effect to all controls within a container.
|
||||
/// </summary>
|
||||
public class TiltEffect : DependencyObject
|
||||
{
|
||||
|
||||
#region Constructor and Static Constructor
|
||||
/// <summary>
|
||||
/// This is not a constructable class, but it cannot be static because it derives from DependencyObject.
|
||||
/// </summary>
|
||||
private TiltEffect()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the static properties
|
||||
/// </summary>
|
||||
static TiltEffect()
|
||||
{
|
||||
// The tiltable items list.
|
||||
TiltableItems = new List<Type>() { typeof(ButtonBase), typeof(ListBoxItem), };
|
||||
UseLogarithmicEase = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Fields and simple properties
|
||||
|
||||
// These constants are the same as the built-in effects
|
||||
/// <summary>
|
||||
/// Maximum amount of tilt, in radians
|
||||
/// </summary>
|
||||
const double MaxAngle = 0.3;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum amount of depression, in pixels
|
||||
/// </summary>
|
||||
const double MaxDepression = 25;
|
||||
|
||||
/// <summary>
|
||||
/// Delay between releasing an element and the tilt release animation playing
|
||||
/// </summary>
|
||||
static readonly TimeSpan TiltReturnAnimationDelay = TimeSpan.FromMilliseconds(200);
|
||||
|
||||
/// <summary>
|
||||
/// Duration of tilt release animation
|
||||
/// </summary>
|
||||
static readonly TimeSpan TiltReturnAnimationDuration = TimeSpan.FromMilliseconds(100);
|
||||
|
||||
/// <summary>
|
||||
/// The control that is currently being tilted
|
||||
/// </summary>
|
||||
static FrameworkElement currentTiltElement;
|
||||
|
||||
/// <summary>
|
||||
/// The single instance of a storyboard used for all tilts
|
||||
/// </summary>
|
||||
static Storyboard tiltReturnStoryboard;
|
||||
|
||||
/// <summary>
|
||||
/// The single instance of an X rotation used for all tilts
|
||||
/// </summary>
|
||||
static DoubleAnimation tiltReturnXAnimation;
|
||||
|
||||
/// <summary>
|
||||
/// The single instance of a Y rotation used for all tilts
|
||||
/// </summary>
|
||||
static DoubleAnimation tiltReturnYAnimation;
|
||||
|
||||
/// <summary>
|
||||
/// The single instance of a Z depression used for all tilts
|
||||
/// </summary>
|
||||
static DoubleAnimation tiltReturnZAnimation;
|
||||
|
||||
/// <summary>
|
||||
/// The center of the tilt element
|
||||
/// </summary>
|
||||
static Point currentTiltElementCenter;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the animation just completed was for a 'pause' or not
|
||||
/// </summary>
|
||||
static bool wasPauseAnimation = false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to use a slightly more accurate (but slightly slower) tilt animation easing function
|
||||
/// </summary>
|
||||
public static bool UseLogarithmicEase { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default list of items that are tiltable
|
||||
/// </summary>
|
||||
public static List<Type> TiltableItems { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Dependency properties
|
||||
|
||||
/// <summary>
|
||||
/// Whether the tilt effect is enabled on a container (and all its children)
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsTiltEnabledProperty = DependencyProperty.RegisterAttached(
|
||||
"IsTiltEnabled",
|
||||
typeof(bool),
|
||||
typeof(TiltEffect),
|
||||
new PropertyMetadata(OnIsTiltEnabledChanged)
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsTiltEnabled dependency property from an object
|
||||
/// </summary>
|
||||
/// <param name="source">The object to get the property from</param>
|
||||
/// <returns>The property's value</returns>
|
||||
public static bool GetIsTiltEnabled(DependencyObject source) { return (bool)source.GetValue(IsTiltEnabledProperty); }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the IsTiltEnabled dependency property on an object
|
||||
/// </summary>
|
||||
/// <param name="source">The object to set the property on</param>
|
||||
/// <param name="value">The value to set</param>
|
||||
public static void SetIsTiltEnabled(DependencyObject source, bool value) { source.SetValue(IsTiltEnabledProperty, value); }
|
||||
|
||||
/// <summary>
|
||||
/// Suppresses the tilt effect on a single control that would otherwise be tilted
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty SuppressTiltProperty = DependencyProperty.RegisterAttached(
|
||||
"SuppressTilt",
|
||||
typeof(bool),
|
||||
typeof(TiltEffect),
|
||||
null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SuppressTilt dependency property from an object
|
||||
/// </summary>
|
||||
/// <param name="source">The object to get the property from</param>
|
||||
/// <returns>The property's value</returns>
|
||||
public static bool GetSuppressTilt(DependencyObject source) { return (bool)source.GetValue(SuppressTiltProperty); }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the SuppressTilt dependency property from an object
|
||||
/// </summary>
|
||||
/// <param name="source">The object to get the property from</param>
|
||||
/// <returns>The property's value</returns>
|
||||
public static void SetSuppressTilt(DependencyObject source, bool value) { source.SetValue(SuppressTiltProperty, value); }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Property change handler for the IsTiltEnabled dependency property
|
||||
/// </summary>
|
||||
/// <param name="target">The element that the property is atteched to</param>
|
||||
/// <param name="args">Event args</param>
|
||||
/// <remarks>
|
||||
/// Adds or removes event handlers from the element that has been (un)registered for tilting
|
||||
/// </remarks>
|
||||
static void OnIsTiltEnabledChanged(DependencyObject target, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
if (target is FrameworkElement)
|
||||
{
|
||||
// Add / remove the event handler if necessary
|
||||
if ((bool)args.NewValue == true)
|
||||
{
|
||||
(target as FrameworkElement).ManipulationStarted += TiltEffect_ManipulationStarted;
|
||||
}
|
||||
else
|
||||
{
|
||||
(target as FrameworkElement).ManipulationStarted -= TiltEffect_ManipulationStarted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Top-level manipulation event handlers
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for ManipulationStarted
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of the event - this will be the tilt container (eg, entire page)</param>
|
||||
/// <param name="e">event args</param>
|
||||
static void TiltEffect_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
|
||||
{
|
||||
|
||||
TryStartTiltEffect(sender as FrameworkElement, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for ManipulationDelta
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of the event - this will be the tilting object (eg a button)</param>
|
||||
/// <param name="e">event args</param>
|
||||
static void TiltEffect_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
|
||||
{
|
||||
|
||||
ContinueTiltEffect(sender as FrameworkElement, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for ManipulationCompleted
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of the event - this will be the tilting object (eg a button)</param>
|
||||
/// <param name="e">event args</param>
|
||||
static void TiltEffect_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
|
||||
{
|
||||
|
||||
EndTiltEffect(currentTiltElement);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Core tilt logic
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the manipulation should cause a tilt, and if so starts the tilt effect
|
||||
/// </summary>
|
||||
/// <param name="source">The source of the manipulation (the tilt container, eg entire page)</param>
|
||||
/// <param name="e">The args from the ManipulationStarted event</param>
|
||||
static void TryStartTiltEffect(FrameworkElement source, ManipulationStartedEventArgs e)
|
||||
{
|
||||
foreach (FrameworkElement ancestor in (e.OriginalSource as FrameworkElement).GetVisualAncestors())
|
||||
{
|
||||
foreach (Type t in TiltableItems)
|
||||
{
|
||||
if (t.IsAssignableFrom(ancestor.GetType()))
|
||||
{
|
||||
if ((bool)ancestor.GetValue(SuppressTiltProperty) != true)
|
||||
{
|
||||
// Use first child of the control, so that you can add transforms and not
|
||||
// impact any transforms on the control itself
|
||||
FrameworkElement element = VisualTreeHelper.GetChild(ancestor, 0) as FrameworkElement;
|
||||
FrameworkElement container = e.ManipulationContainer as FrameworkElement;
|
||||
|
||||
if (element == null || container == null)
|
||||
return;
|
||||
|
||||
// Touch point relative to the element being tilted
|
||||
Point tiltTouchPoint = container.TransformToVisual(element).Transform(e.ManipulationOrigin);
|
||||
|
||||
// Center of the element being tilted
|
||||
Point elementCenter = new Point(element.ActualWidth / 2, element.ActualHeight / 2);
|
||||
|
||||
// Camera adjustment
|
||||
Point centerToCenterDelta = GetCenterToCenterDelta(element, source);
|
||||
|
||||
BeginTiltEffect(element, tiltTouchPoint, elementCenter, centerToCenterDelta);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the delta between the centre of an element and its container
|
||||
/// </summary>
|
||||
/// <param name="element">The element to compare</param>
|
||||
/// <param name="container">The element to compare against</param>
|
||||
/// <returns>A point that represents the delta between the two centers</returns>
|
||||
static Point GetCenterToCenterDelta(FrameworkElement element, FrameworkElement container)
|
||||
{
|
||||
Point elementCenter = new Point(element.ActualWidth / 2, element.ActualHeight / 2);
|
||||
Point containerCenter;
|
||||
|
||||
#if WINDOWS_PHONE
|
||||
|
||||
// Need to special-case the frame to handle different orientations
|
||||
if (container is PhoneApplicationFrame)
|
||||
{
|
||||
PhoneApplicationFrame frame = container as PhoneApplicationFrame;
|
||||
|
||||
// Switch width and height in landscape mode
|
||||
if ((frame.Orientation & PageOrientation.Landscape) == PageOrientation.Landscape)
|
||||
{
|
||||
|
||||
containerCenter = new Point(container.ActualHeight / 2, container.ActualWidth / 2);
|
||||
}
|
||||
else
|
||||
containerCenter = new Point(container.ActualWidth / 2, container.ActualHeight / 2);
|
||||
}
|
||||
else
|
||||
containerCenter = new Point(container.ActualWidth / 2, container.ActualHeight / 2);
|
||||
#else
|
||||
|
||||
containerCenter = new Point(container.ActualWidth / 2, container.ActualHeight / 2);
|
||||
|
||||
#endif
|
||||
|
||||
Point transformedElementCenter = element.TransformToVisual(container).Transform(elementCenter);
|
||||
Point result = new Point(containerCenter.X - transformedElementCenter.X, containerCenter.Y - transformedElementCenter.Y);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Begins the tilt effect by preparing the control and doing the initial animation
|
||||
/// </summary>
|
||||
/// <param name="element">The element to tilt </param>
|
||||
/// <param name="touchPoint">The touch point, in element coordinates</param>
|
||||
/// <param name="centerPoint">The center point of the element in element coordinates</param>
|
||||
/// <param name="centerDelta">The delta between the <paramref name="element"/>'s center and
|
||||
/// the container's center</param>
|
||||
static void BeginTiltEffect(FrameworkElement element, Point touchPoint, Point centerPoint, Point centerDelta)
|
||||
{
|
||||
|
||||
|
||||
if (tiltReturnStoryboard != null)
|
||||
StopTiltReturnStoryboardAndCleanup();
|
||||
|
||||
if (PrepareControlForTilt(element, centerDelta) == false)
|
||||
return;
|
||||
|
||||
currentTiltElement = element;
|
||||
currentTiltElementCenter = centerPoint;
|
||||
PrepareTiltReturnStoryboard(element);
|
||||
|
||||
ApplyTiltEffect(currentTiltElement, touchPoint, currentTiltElementCenter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepares a control to be tilted by setting up a plane projection and some event handlers
|
||||
/// </summary>
|
||||
/// <param name="element">The control that is to be tilted</param>
|
||||
/// <param name="centerDelta">Delta between the element's center and the tilt container's</param>
|
||||
/// <returns>true if successful; false otherwise</returns>
|
||||
/// <remarks>
|
||||
/// This method is conservative; it will fail any attempt to tilt a control that already
|
||||
/// has a projection on it
|
||||
/// </remarks>
|
||||
static bool PrepareControlForTilt(FrameworkElement element, Point centerDelta)
|
||||
{
|
||||
// Prevents interference with any existing transforms
|
||||
if (element.Projection != null || (element.RenderTransform != null && element.RenderTransform.GetType() != typeof(MatrixTransform)))
|
||||
return false;
|
||||
|
||||
TranslateTransform transform = new TranslateTransform();
|
||||
transform.X = centerDelta.X;
|
||||
transform.Y = centerDelta.Y;
|
||||
element.RenderTransform = transform;
|
||||
|
||||
PlaneProjection projection = new PlaneProjection();
|
||||
projection.GlobalOffsetX = -1 * centerDelta.X;
|
||||
projection.GlobalOffsetY = -1 * centerDelta.Y;
|
||||
element.Projection = projection;
|
||||
|
||||
element.ManipulationDelta += TiltEffect_ManipulationDelta;
|
||||
element.ManipulationCompleted += TiltEffect_ManipulationCompleted;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes modifications made by PrepareControlForTilt
|
||||
/// </summary>
|
||||
/// <param name="element">THe control to be un-prepared</param>
|
||||
/// <remarks>
|
||||
/// This method is basic; it does not do anything to detect if the control being un-prepared
|
||||
/// was previously prepared
|
||||
/// </remarks>
|
||||
static void RevertPrepareControlForTilt(FrameworkElement element)
|
||||
{
|
||||
element.ManipulationDelta -= TiltEffect_ManipulationDelta;
|
||||
element.ManipulationCompleted -= TiltEffect_ManipulationCompleted;
|
||||
element.Projection = null;
|
||||
element.RenderTransform = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tilt return storyboard (if not already created) and targets it to the projection
|
||||
/// </summary>
|
||||
/// <param name="projection">the projection that should be the target of the animation</param>
|
||||
static void PrepareTiltReturnStoryboard(FrameworkElement element)
|
||||
{
|
||||
|
||||
if (tiltReturnStoryboard == null)
|
||||
{
|
||||
tiltReturnStoryboard = new Storyboard();
|
||||
tiltReturnStoryboard.Completed += TiltReturnStoryboard_Completed;
|
||||
|
||||
tiltReturnXAnimation = new DoubleAnimation();
|
||||
Storyboard.SetTargetProperty(tiltReturnXAnimation, new PropertyPath(PlaneProjection.RotationXProperty));
|
||||
tiltReturnXAnimation.BeginTime = TiltReturnAnimationDelay;
|
||||
tiltReturnXAnimation.To = 0;
|
||||
tiltReturnXAnimation.Duration = TiltReturnAnimationDuration;
|
||||
|
||||
tiltReturnYAnimation = new DoubleAnimation();
|
||||
Storyboard.SetTargetProperty(tiltReturnYAnimation, new PropertyPath(PlaneProjection.RotationYProperty));
|
||||
tiltReturnYAnimation.BeginTime = TiltReturnAnimationDelay;
|
||||
tiltReturnYAnimation.To = 0;
|
||||
tiltReturnYAnimation.Duration = TiltReturnAnimationDuration;
|
||||
|
||||
tiltReturnZAnimation = new DoubleAnimation();
|
||||
Storyboard.SetTargetProperty(tiltReturnZAnimation, new PropertyPath(PlaneProjection.GlobalOffsetZProperty));
|
||||
tiltReturnZAnimation.BeginTime = TiltReturnAnimationDelay;
|
||||
tiltReturnZAnimation.To = 0;
|
||||
tiltReturnZAnimation.Duration = TiltReturnAnimationDuration;
|
||||
|
||||
if (UseLogarithmicEase)
|
||||
{
|
||||
tiltReturnXAnimation.EasingFunction = new LogarithmicEase();
|
||||
tiltReturnYAnimation.EasingFunction = new LogarithmicEase();
|
||||
tiltReturnZAnimation.EasingFunction = new LogarithmicEase();
|
||||
}
|
||||
|
||||
tiltReturnStoryboard.Children.Add(tiltReturnXAnimation);
|
||||
tiltReturnStoryboard.Children.Add(tiltReturnYAnimation);
|
||||
tiltReturnStoryboard.Children.Add(tiltReturnZAnimation);
|
||||
}
|
||||
|
||||
Storyboard.SetTarget(tiltReturnXAnimation, element.Projection);
|
||||
Storyboard.SetTarget(tiltReturnYAnimation, element.Projection);
|
||||
Storyboard.SetTarget(tiltReturnZAnimation, element.Projection);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Continues a tilt effect that is currently applied to an element, presumably because
|
||||
/// the user moved their finger
|
||||
/// </summary>
|
||||
/// <param name="element">The element being tilted</param>
|
||||
/// <param name="e">The manipulation event args</param>
|
||||
static void ContinueTiltEffect(FrameworkElement element, ManipulationDeltaEventArgs e)
|
||||
{
|
||||
FrameworkElement container = e.ManipulationContainer as FrameworkElement;
|
||||
if (container == null || element == null)
|
||||
return;
|
||||
|
||||
Point tiltTouchPoint = container.TransformToVisual(element).Transform(e.ManipulationOrigin);
|
||||
|
||||
// If touch moved outside bounds of element, then pause the tilt (but don't cancel it)
|
||||
if (new Rect(0, 0, currentTiltElement.ActualWidth, currentTiltElement.ActualHeight).Contains(tiltTouchPoint) != true)
|
||||
{
|
||||
|
||||
PauseTiltEffect();
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply the updated tilt effect
|
||||
ApplyTiltEffect(currentTiltElement, e.ManipulationOrigin, currentTiltElementCenter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ends the tilt effect by playing the animation
|
||||
/// </summary>
|
||||
/// <param name="element">The element being tilted</param>
|
||||
static void EndTiltEffect(FrameworkElement element)
|
||||
{
|
||||
if (element != null)
|
||||
{
|
||||
element.ManipulationCompleted -= TiltEffect_ManipulationCompleted;
|
||||
element.ManipulationDelta -= TiltEffect_ManipulationDelta;
|
||||
}
|
||||
|
||||
if (tiltReturnStoryboard != null)
|
||||
{
|
||||
wasPauseAnimation = false;
|
||||
if (tiltReturnStoryboard.GetCurrentState() != ClockState.Active)
|
||||
tiltReturnStoryboard.Begin();
|
||||
}
|
||||
else
|
||||
StopTiltReturnStoryboardAndCleanup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the storyboard complete event
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of the event</param>
|
||||
/// <param name="e">event args</param>
|
||||
static void TiltReturnStoryboard_Completed(object sender, EventArgs e)
|
||||
{
|
||||
if (wasPauseAnimation)
|
||||
ResetTiltEffect(currentTiltElement);
|
||||
else
|
||||
StopTiltReturnStoryboardAndCleanup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the tilt effect on the control, making it appear 'normal' again
|
||||
/// </summary>
|
||||
/// <param name="element">The element to reset the tilt on</param>
|
||||
/// <remarks>
|
||||
/// This method doesn't turn off the tilt effect or cancel any current
|
||||
/// manipulation; it just temporarily cancels the effect
|
||||
/// </remarks>
|
||||
static void ResetTiltEffect(FrameworkElement element)
|
||||
{
|
||||
PlaneProjection projection = element.Projection as PlaneProjection;
|
||||
projection.RotationY = 0;
|
||||
projection.RotationX = 0;
|
||||
projection.GlobalOffsetZ = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the tilt effect and release resources applied to the currently-tilted control
|
||||
/// </summary>
|
||||
static void StopTiltReturnStoryboardAndCleanup()
|
||||
{
|
||||
if (tiltReturnStoryboard != null)
|
||||
tiltReturnStoryboard.Stop();
|
||||
|
||||
RevertPrepareControlForTilt(currentTiltElement);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the tilt effect so that the control returns to the 'at rest' position, but doesn't
|
||||
/// stop the tilt effect (handlers are still attached, etc.)
|
||||
/// </summary>
|
||||
static void PauseTiltEffect()
|
||||
{
|
||||
if ((tiltReturnStoryboard != null) && !wasPauseAnimation)
|
||||
{
|
||||
tiltReturnStoryboard.Stop();
|
||||
wasPauseAnimation = true;
|
||||
tiltReturnStoryboard.Begin();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the storyboard to not running
|
||||
/// </summary>
|
||||
private static void ResetTiltReturnStoryboard()
|
||||
{
|
||||
tiltReturnStoryboard.Stop();
|
||||
wasPauseAnimation = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the tilt effect to the control
|
||||
/// </summary>
|
||||
/// <param name="element">the control to tilt</param>
|
||||
/// <param name="touchPoint">The touch point, in the container's coordinates</param>
|
||||
/// <param name="centerPoint">The center point of the container</param>
|
||||
static void ApplyTiltEffect(FrameworkElement element, Point touchPoint, Point centerPoint)
|
||||
{
|
||||
// Stop any active animation
|
||||
ResetTiltReturnStoryboard();
|
||||
|
||||
// Get relative point of the touch in percentage of container size
|
||||
Point normalizedPoint = new Point(
|
||||
Math.Min(Math.Max(touchPoint.X / (centerPoint.X * 2), 0), 1),
|
||||
Math.Min(Math.Max(touchPoint.Y / (centerPoint.Y * 2), 0), 1));
|
||||
|
||||
// Shell values
|
||||
double xMagnitude = Math.Abs(normalizedPoint.X - 0.5);
|
||||
double yMagnitude = Math.Abs(normalizedPoint.Y - 0.5);
|
||||
double xDirection = -Math.Sign(normalizedPoint.X - 0.5);
|
||||
double yDirection = Math.Sign(normalizedPoint.Y - 0.5);
|
||||
double angleMagnitude = xMagnitude + yMagnitude;
|
||||
double xAngleContribution = xMagnitude + yMagnitude > 0 ? xMagnitude / (xMagnitude + yMagnitude) : 0;
|
||||
|
||||
double angle = angleMagnitude * MaxAngle * 180 / Math.PI;
|
||||
double depression = (1 - angleMagnitude) * MaxDepression;
|
||||
|
||||
// RotationX and RotationY are the angles of rotations about the x- or y-*axis*;
|
||||
// to achieve a rotation in the x- or y-*direction*, we need to swap the two.
|
||||
// That is, a rotation to the left about the y-axis is a rotation to the left in the x-direction,
|
||||
// and a rotation up about the x-axis is a rotation up in the y-direction.
|
||||
PlaneProjection projection = element.Projection as PlaneProjection;
|
||||
projection.RotationY = angle * xAngleContribution * xDirection;
|
||||
projection.RotationX = angle * (1 - xAngleContribution) * yDirection;
|
||||
projection.GlobalOffsetZ = -depression;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Custom easing function
|
||||
|
||||
/// <summary>
|
||||
/// Provides an easing function for the tilt return
|
||||
/// </summary>
|
||||
private class LogarithmicEase : EasingFunctionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Computes the easing function
|
||||
/// </summary>
|
||||
/// <param name="normalizedTime">The time</param>
|
||||
/// <returns>The eased value</returns>
|
||||
protected override double EaseInCore(double normalizedTime)
|
||||
{
|
||||
return Math.Log(normalizedTime + 1) / 0.693147181; // ln(t + 1) / ln(2)
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Couple of simple helpers for walking the visual tree
|
||||
/// </summary>
|
||||
static class TreeHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the ancestors of the element, up to the root
|
||||
/// </summary>
|
||||
/// <param name="node">The element to start from</param>
|
||||
/// <returns>An enumerator of the ancestors</returns>
|
||||
public static IEnumerable<FrameworkElement> GetVisualAncestors(this FrameworkElement node)
|
||||
{
|
||||
FrameworkElement parent = node.GetVisualParent();
|
||||
while (parent != null)
|
||||
{
|
||||
yield return parent;
|
||||
parent = parent.GetVisualParent();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visual parent of the element
|
||||
/// </summary>
|
||||
/// <param name="node">The element to check</param>
|
||||
/// <returns>The visual parent</returns>
|
||||
public static FrameworkElement GetVisualParent(this FrameworkElement node)
|
||||
{
|
||||
return VisualTreeHelper.GetParent(node) as FrameworkElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
<Grid x:Name="ContentPanel" Margin="12,0,0,0" Grid.Row="1">
|
||||
<Grid x:Name="ContentPanel" Margin="12,0,12,12" Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@@ -43,90 +43,94 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Row 0 -->
|
||||
<lui:NavigateButton Name="TimeTableAppButton" Grid.Row="0" Grid.Column="0" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" IsEnabled="False">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Schedule, Source={StaticResource ThemelizedIcons}}" Height="100"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="TimeTableAppButton" Grid.Row="0" Grid.Column="0" Style="{StaticResource StartPageButton}" IsEnabled="False">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Schedule, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="LectureAppButton" Grid.Row="0" Grid.Column="1" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" Url="{Binding Path=Constants.PathLecture_LecturePage, Source={StaticResource Const}}">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Lectures, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="NewsAppButton" Grid.Row="0" Grid.Column="1" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathNews_NewsIndexPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.News, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.NewsApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="NewsAppButton" Grid.Row="0" Grid.Column="2" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" Url="{Binding Path=Constants.PathNews_NewsIndexPage, Source={StaticResource Const}}">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.News, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.NewsApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="LectureAppButton" Grid.Row="0" Grid.Column="2" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathLecture_LecturePage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Lectures, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<!-- Row 1 -->
|
||||
<lui:NavigateButton Name="MensaAppButton" Grid.Row="1" Grid.Column="0" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" Url="{Binding Path=Constants.PathMensa_MensaPage, Source={StaticResource Const}}">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Mensa, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
|
||||
<lui:NavigateButton Name="HomeworkAppButton" Grid.Row="1" Grid.Column="0" Style="{StaticResource StartPageButton}" IsEnabled="False">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Homework, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Name="HomeworkAppButtonText" Text="{Binding Path=LocalizedResources.HomeworkApp_Title2, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="CampusMapAppButton" Grid.Row="1" Grid.Column="1" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" IsEnabled="False">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Campus, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="EventAppButton" Grid.Row="1" Grid.Column="1" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathEvents_EventsIndexPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.News, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.EventApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="HomeworkAppButton" Grid.Row="1" Grid.Column="2" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" IsEnabled="False">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Homework, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.HomeworkApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="CampusMapAppButton" Grid.Row="1" Grid.Column="2" Style="{StaticResource StartPageButton}" IsEnabled="False">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Campus, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<!-- Row 2 -->
|
||||
<lui:NavigateButton Name="DepartmentAppButton" Grid.Row="2" Grid.Column="0" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" IsEnabled="False">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Departments, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="DepartmentAppButton" Grid.Row="2" Grid.Column="0" Style="{StaticResource StartPageButton}" IsEnabled="False">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Departments, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="EventAppButton" Grid.Row="2" Grid.Column="1" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" Url="{Binding Path=Constants.PathEvents_EventsIndexPage, Source={StaticResource Const}}">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.News, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.EventApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="MensaAppButton" Grid.Row="2" Grid.Column="1" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathMensa_MensaPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Mensa, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="MailAppButton" Grid.Row="2" Grid.Column="2" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0" Url="{Binding Path=Constants.PathMail_WebMailPage, Source={StaticResource Const}}">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.WebMail, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MailApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="MailAppButton" Grid.Row="2" Grid.Column="2" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathMail_WebMailPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.WebMail, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MailApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<!-- Row 3 -->
|
||||
<lui:NavigateButton Name="OpenHoursAppButton" Url="{Binding Path=Constants.PathOpeninghours_OpeninghoursPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="0" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Openhours, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.OpenHoursApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="OpenHoursAppButton" Url="{Binding Path=Constants.PathOpeninghours_OpeninghoursPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="0" Style="{StaticResource StartPageButton}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Openhours, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Name="OpenHoursAppButtonText" Text="{Binding Path=LocalizedResources.OpenHoursApp_Title2, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="OSAAppButton" Url="{Binding Path=Constants.PathStudentCouncil_StudentCouncilPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="1" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.StudentCouncil, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.OSAApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="LinkAppButton" Url="{Binding Path=Constants.PathLinks_LinkPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="1" Style="{StaticResource StartPageButton}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Link, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LinkApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="LinkAppButton" Url="{Binding Path=Constants.PathLinks_LinkPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="2" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0">
|
||||
<StackPanel Height="auto" Margin="-12,-12,-12,-12">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Link, Source={StaticResource ThemelizedIcons}}" Height="100" Visibility="Visible"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LinkApp_Title, Source={StaticResource LocalizedStrings}}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<lui:NavigateButton Name="OSAAppButton" Url="{Binding Path=Constants.PathStudentCouncil_StudentCouncilPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="2" Style="{StaticResource StartPageButton}">
|
||||
<lui:NavigateButton.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</lui:NavigateButton.RenderTransform>
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.StudentCouncil, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.OSAApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
</Grid>
|
||||
|
||||
@@ -39,26 +39,35 @@ namespace CampusAppWP8.Pages
|
||||
{
|
||||
OpenHoursAppButton.SetValue(Grid.RowProperty, 0);
|
||||
OpenHoursAppButton.SetValue(Grid.ColumnProperty, 3);
|
||||
OpenHoursAppButtonText.Text = AppResources.OpenHoursApp_Title;
|
||||
|
||||
OSAAppButton.SetValue(Grid.RowProperty, 1);
|
||||
OSAAppButton.SetValue(Grid.ColumnProperty, 3);
|
||||
|
||||
LinkAppButton.SetValue(Grid.RowProperty, 2);
|
||||
LinkAppButton.SetValue(Grid.ColumnProperty, 3);
|
||||
|
||||
ContentPanel.Margin = new Thickness(12, -24, 0, 0);
|
||||
|
||||
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not in portrait, move buttonList content to visible row and column.
|
||||
ContentPanel.Margin = new Thickness(12, 0, 12, 12);
|
||||
OpenHoursAppButton.SetValue(Grid.RowProperty, 3);
|
||||
OpenHoursAppButton.SetValue(Grid.ColumnProperty, 0);
|
||||
OpenHoursAppButtonText.Text = AppResources.OpenHoursApp_Title2;
|
||||
|
||||
OSAAppButton.SetValue(Grid.RowProperty, 3);
|
||||
OSAAppButton.SetValue(Grid.ColumnProperty, 1);
|
||||
|
||||
LinkAppButton.SetValue(Grid.RowProperty, 3);
|
||||
LinkAppButton.SetValue(Grid.ColumnProperty, 2);
|
||||
|
||||
ContentPanel.Margin = new Thickness(12, 0, 0, 0);
|
||||
|
||||
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user