本文整理汇总了C#中PhoneApplicationFrame.AddHandler方法的典型用法代码示例。如果您正苦于以下问题:C# PhoneApplicationFrame.AddHandler方法的具体用法?C# PhoneApplicationFrame.AddHandler怎么用?C# PhoneApplicationFrame.AddHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhoneApplicationFrame
的用法示例。
在下文中一共展示了PhoneApplicationFrame.AddHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnListPickerModeChanged
private void OnListPickerModeChanged(ListPickerMode oldValue, ListPickerMode newValue)
{
if ((ListPickerMode.Expanded == oldValue))
{
if (null != _page)
{
_page.BackKeyPress -= HandlePageBackKeyPress;
_page = null;
}
if (null != _frame)
{
_frame.ManipulationStarted -= HandleFrameManipulationStarted;
_frame = null;
}
}
if (ListPickerMode.Expanded == newValue)
{
// Hook up to frame if not already done
if (null == _frame)
{
_frame = Application.Current.RootVisual as PhoneApplicationFrame;
if (null != _frame)
{
_frame.AddHandler(ManipulationStartedEvent, new EventHandler<ManipulationStartedEventArgs>(HandleFrameManipulationStarted), true);
}
}
if (null != _frame)
{
_page = _frame.Content as PhoneApplicationPage;
if (null != _page)
{
_page.BackKeyPress += HandlePageBackKeyPress;
}
}
}
if (ListPickerMode.Full == oldValue)
{
ClosePickerPage();
}
if (ListPickerMode.Full == newValue)
{
OpenPickerPage();
}
SizeForAppropriateView(ListPickerMode.Full != oldValue);
IsHighlighted = (ListPickerMode.Expanded == newValue);
}
示例2: OnListPickerModeChanged
private void OnListPickerModeChanged(ListPickerMode oldValue, ListPickerMode newValue)
{
// Hook up to frame if not already done
if (null == _frame)
{
_frame = Application.Current.RootVisual as PhoneApplicationFrame;
if (null != _frame)
{
_frame.AddHandler(ManipulationCompletedEvent, new EventHandler<ManipulationCompletedEventArgs>(HandleFrameManipulationCompleted), true);
}
}
// Restore state
if ((ListPickerMode.Full == oldValue) && !DesignerProperties.IsInDesignTool)
{
if (null != _fullModePopupPart)
{
_fullModePopupPart.IsOpen = false;
}
if (null != _fullModeSelectorPart)
{
_fullModeSelectorPart.SelectionChanged -= HandleFullModeSelectorPartSelectionChanged;
_fullModeSelectorPart.Loaded -= HandleFullModeSelectorPartLoaded;
_fullModeSelectorPart.ItemsSource = null;
}
Action restoreSystemTray = () =>
{
try
{
SystemTray.IsVisible = _savedSystemTrayIsVisible;
}
catch (InvalidOperationException)
{
}
};
try
{
restoreSystemTray();
}
catch (InvalidOperationException)
{
Dispatcher.BeginInvoke(restoreSystemTray);
}
if (null != _page)
{
if (null != _page.ApplicationBar)
{
_page.ApplicationBar.IsVisible = _savedApplicationBarIsVisible;
}
}
if (null != _frame)
{
_frame.OrientationChanged -= HandleFrameOrientationChanged;
}
}
if ((ListPickerMode.Expanded == oldValue) || (ListPickerMode.Full == oldValue))
{
if (null != _page)
{
_page.BackKeyPress -= HandlePageBackKeyPress;
_page = null;
}
}
// Hook up to relevant events
if ((ListPickerMode.Expanded == newValue) || (ListPickerMode.Full == newValue))
{
if (null != _frame)
{
_page = _frame.Content as PhoneApplicationPage;
if (null != _page)
{
_page.BackKeyPress += HandlePageBackKeyPress;
}
}
}
if ((ListPickerMode.Full == newValue) && !DesignerProperties.IsInDesignTool)
{
Action saveTrayAndHide = () =>
{
try
{
_savedSystemTrayIsVisible = SystemTray.IsVisible;
SystemTray.IsVisible = false;
}
catch (InvalidOperationException)
{
}
};
try
{
saveTrayAndHide();
}
catch (InvalidOperationException)
{
Dispatcher.BeginInvoke(saveTrayAndHide);
}
if (null != _frame)
{
//.........这里部分代码省略.........