当前位置: 首页>>代码示例>>C#>>正文


C# PhoneApplicationFrame.AddHandler方法代码示例

本文整理汇总了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);
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:51,代码来源:ListPicker.cs

示例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)
                {
//.........这里部分代码省略.........
开发者ID:TediWang,项目名称:4thandmayor-ancient,代码行数:101,代码来源:ListPicker.cs


注:本文中的PhoneApplicationFrame.AddHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。