本文整理汇总了C#中OrientationChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# OrientationChangedEventArgs类的具体用法?C# OrientationChangedEventArgs怎么用?C# OrientationChangedEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrientationChangedEventArgs类属于命名空间,在下文中一共展示了OrientationChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnOrientationChanged
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
base.OnOrientationChanged(e);
if (_previousOrientation == null)
return;
RotateTransition transitionElement = new RotateTransition();
// counter clockwise rotation
if (_previousOrientation == PageOrientation.LandscapeRight && e.Orientation == PageOrientation.PortraitUp ||
_previousOrientation == PageOrientation.PortraitUp && e.Orientation == PageOrientation.LandscapeLeft ||
_previousOrientation == PageOrientation.LandscapeLeft && e.Orientation == PageOrientation.PortraitDown ||
_previousOrientation == PageOrientation.PortraitDown && e.Orientation == PageOrientation.LandscapeRight)
transitionElement.Mode = RotateTransitionMode.In90Counterclockwise;
// clockwise rotation
else if (_previousOrientation == PageOrientation.LandscapeLeft && e.Orientation == PageOrientation.PortraitUp ||
_previousOrientation == PageOrientation.PortraitDown && e.Orientation == PageOrientation.LandscapeLeft ||
_previousOrientation == PageOrientation.LandscapeRight && e.Orientation == PageOrientation.PortraitDown ||
_previousOrientation == PageOrientation.PortraitUp && e.Orientation == PageOrientation.LandscapeRight)
transitionElement.Mode = RotateTransitionMode.In90Clockwise;
// 180 rotation
else
transitionElement.Mode = RotateTransitionMode.In180Clockwise;
var transition = transitionElement.GetTransition((PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual).Content));
transition.Completed += delegate { transition.Stop(); };
transition.Begin();
_previousOrientation = e.Orientation;
}
示例2: MainPageOrientationChanged
void MainPageOrientationChanged(object sender, OrientationChangedEventArgs e)
{
//var newOrientation = e.Orientation;
//var transitionElement = new RotateTransition();
//switch (newOrientation)
//{
// case PageOrientation.Landscape:
// case PageOrientation.LandscapeRight:
// transitionElement.Mode = _lastOrientation == PageOrientation.PortraitUp ? RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In180Clockwise;
// break;
// case PageOrientation.LandscapeLeft:
// transitionElement.Mode = _lastOrientation == PageOrientation.LandscapeRight ? RotateTransitionMode.In180Counterclockwise : RotateTransitionMode.In90Clockwise;
// break;
// case PageOrientation.Portrait:
// case PageOrientation.PortraitUp:
// transitionElement.Mode = _lastOrientation == PageOrientation.LandscapeLeft ? RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In90Clockwise;
// break;
// default:
// break;
//}
//var phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;
//var transition = transitionElement.GetTransition(phoneApplicationPage);
//transition.Completed += delegate
//{
// transition.Stop();
// UpdateOrientation();
//};
//transition.Begin();
//_lastOrientation = newOrientation;
}
示例3: PhoneApplicationPage_OrientationChanged
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
double ScreenWidth;
double ScreenHeight;
double AnchoContenido;
// Switch the placement of the buttons based on an orientation change.
if ((e.Orientation & PageOrientation.Portrait) == (PageOrientation.Portrait))
{
ScreenWidth = Application.Current.Host.Content.ActualWidth;
ScreenHeight = Application.Current.Host.Content.ActualHeight;
AnchoContenido = ScreenWidth - 50;
}
// If not in portrait, move buttonList content to visible row and column.
else
{
ScreenHeight = Application.Current.Host.Content.ActualWidth;
ScreenWidth = Application.Current.Host.Content.ActualHeight;
AnchoContenido = ScreenWidth - 147;
}
wbContenido.Width = AnchoContenido;
stpContenido.Height = ScreenHeight - 20;
stpContenido.Width = ScreenWidth - 20;
}
示例4: AnimateOrientationChange
/// <summary>
/// Animates the rectangle on orientation change
/// </summary>
/// <param name="e"></param>
public void AnimateOrientationChange(OrientationChangedEventArgs e)
{
// check if new orientation is landscape or portrait
if (e.Orientation == PageOrientation.Landscape || e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight) {
// if landscape dimensions were not calculated we must do it now
if (!mAnimationInitialized) {
// calculate landscape box size based on screen size
mLandscapeWidth = ActualWidth * kLandscapeRatio;
mLandscapeHeight = mLandscapeWidth * kAspectRatio;
// set animation values for both animations (landcape to portrait and reverse)
mP2LWidthAnimation.From = mPortraitHeight;
mP2LWidthAnimation.To = mLandscapeWidth;
mP2LHeightAnimation.From = mPortraitWidth;
mP2LHeightAnimation.To = mLandscapeHeight;
mL2PWidthAnimation.From = mLandscapeHeight;
mL2PWidthAnimation.To = mPortraitWidth;
mL2PHeightAnimation.From = mLandscapeWidth;
mL2PHeightAnimation.To = mPortraitHeight;
// mark animation as initialized and ready
mAnimationInitialized = true;
}
// start portrait to landscape animation
mP2LAnimation.Begin();
} else {
// start landscape to portrait animation if all values are calculated
if (mAnimationInitialized) {
mL2PAnimation.Begin();
}
}
}
示例5: OnOrientationChanged
public void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (Camera != null)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
// LandscapeRight rotation when camera is on back of device.
int landscapeRightRotation = 180;
// Change LandscapeRight rotation for front-facing camera.
if (Camera.CameraType == CameraType.FrontFacing) landscapeRightRotation = -180;
// Rotate video brush from camera.
if (e.Orientation == PageOrientation.LandscapeRight)
{
// Rotate for LandscapeRight orientation.
CurrentVideoBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = landscapeRightRotation };
}
else
{
// Rotate for standard landscape orientation.
CurrentVideoBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
}
});
}
}
示例6: OnOrientationChanged
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
var RootGrid = this.FindName("LayoutRoot") as Grid;
// var RotationGrid = RootGrid.FindName("ScreenFlow") as Grid;
switch (e.Orientation)
{
case PageOrientation.Landscape:
// ((Grid)this.FindName("LayoutRoot")).Margin = new Thickness(120, 0, 0, 0);
break;
case PageOrientation.LandscapeLeft:
// RotationGrid.Margin = new Thickness(60, 0,70, 0);
break;
case PageOrientation.LandscapeRight:
break;
case PageOrientation.None:
break;
case PageOrientation.Portrait:
break;
case PageOrientation.PortraitDown:
break;
case PageOrientation.PortraitUp:
break;
default:
break;
}
base.OnOrientationChanged(e);
}
示例7: OnOrientationChanged
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (!(e.Orientation == PageOrientation.LandscapeRight))
{
base.OnOrientationChanged(e);
}
}
示例8: OnOrientationChanged
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
base.OnOrientationChanged(e);
switch (e.Orientation)
{
case PageOrientation.Landscape:
break;
case PageOrientation.LandscapeLeft:
ContentPanel.Margin = new Thickness(0, 0, 75, 0);
break;
case PageOrientation.LandscapeRight:
ContentPanel.Margin = new Thickness(75, 0, 0, 0);
break;
case PageOrientation.None:
case PageOrientation.Portrait:
case PageOrientation.PortraitDown:
case PageOrientation.PortraitUp:
default:
ContentPanel.Margin = new Thickness(0, 0, 0, 0);
break;
}
}
示例9: OnOrientationChanged
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
base.OnOrientationChanged(e);
var orientation = e.Orientation;
SetOrientation(orientation);
}
示例10: GamePageWP8_OrientationChanged
private void GamePageWP8_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (this._game != null)
{
(this._game.Window as WindowsPhoneGameWindow).OrientationChanged += GamePage_OrientationChanged;
}
}
示例11: OnOrientationChanged
// Ensure that the viewfinder is upright in LandscapeRight.
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (camera != null)
{
// LandscapeRight rotation when camera is on back of phone
int landscapeRightRotation = 180;
// Change LandscapeRight rotation for front-facing camera
if (camera.CameraType == CameraType.FrontFacing)
landscapeRightRotation = -180;
// Rotate video brush from camera
if (e.Orientation == PageOrientation.PortraitUp)
{
// Rotate for LandscapeRight orientation
mainCameraBrush.RelativeTransform = new CompositeTransform()
{
CenterX = 0.5,
CenterY = 0.5,
Rotation = landscapeRightRotation
};
}
else
{
// Rotate for standard landscape orientation
mainCameraBrush.RelativeTransform = new CompositeTransform()
{
CenterX = 0.5,
CenterY = 0.5,
Rotation = 0
};
}
}
base.OnOrientationChanged(e);
}
示例12: OnOrientationChanged
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.PortraitDown || e.Orientation == PageOrientation.PortraitUp)
{
NavigationService.GoBack();
}
base.OnOrientationChanged(e);
}
示例13: OnOrientationChanged
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
base.OnOrientationChanged(e);
//vm.OnOrientationChanged(e);
}
示例14: ResponsiveApp_OrientationChanged
void ResponsiveApp_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (frame != null)
{
//intial call to setup default styles
handleChangeEvents(new Size(frame.ActualWidth, frame.ActualHeight),
frame.Orientation);
}
}
示例15: PageOrientationChanged
private void PageOrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight)
{
var temp = ChapterTextContent.Height;
ChapterTextContent.Height = ChapterTextContent.Width;
ChapterTextContent.Width = temp;
}
}