/// <summary>
        /// 在构造函数中设置好计时器的各项属性,并添加上下滚动的交互区域(UpScrollRegion DownScrollRegion),调用相应的方法.
        /// </summary>
        public StorySelectionControl()
        {
            this.InitializeComponent();

            if (Settings.Default.ShowScrollRegions)
            {
                this.scrollTimer = new DispatcherTimer();
                double scrollingTick = 100 - Settings.Default.ScrollSpeed;
                this.scrollTimer.Interval = TimeSpan.FromMilliseconds(scrollingTick);
                this.scrollTimer.Tick    += this.ScrollTimer_Tick;
                KinectController.AddPreviewHandEnterHandler(this.UpScrollRegion, this.OnPreviewHandEnterUp);
                KinectController.AddPreviewHandLeaveHandler(this.UpScrollRegion, this.OnPreviewHandLeaveUp);
                KinectController.AddPreviewHandEnterHandler(this.DownScrollRegion, this.OnPreviewHandEnterDown);
                KinectController.AddPreviewHandLeaveHandler(this.DownScrollRegion, this.OnPreviewHandLeaveDown);
                ContentScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
                this.ContentScrollViewer.ScrollChanged         += new ScrollChangedEventHandler(this.ContentScrollViewer_ScrollChanged);
            }
            else
            {
            }
        }
        public StorySelectionControl()
        {
            this.InitializeComponent();

            if (Settings.Default.ShowScrollRegions)
            {
                this.scrollTimer = new DispatcherTimer();
                double scrollingTick = 100 - Settings.Default.ScrollSpeed;
                this.scrollTimer.Interval = TimeSpan.FromMilliseconds(scrollingTick);
                this.scrollTimer.Tick    += this.ScrollTimer_Tick;
                KinectController.AddPreviewHandEnterHandler(this.LeftScrollRegion, this.OnPreviewHandEnterLeft);
                KinectController.AddPreviewHandLeaveHandler(this.LeftScrollRegion, this.OnPreviewHandLeaveLeft);
                KinectController.AddPreviewHandEnterHandler(this.RightScrollRegion, this.OnPreviewHandEnterRight);
                KinectController.AddPreviewHandLeaveHandler(this.RightScrollRegion, this.OnPreviewHandLeaveRight);
                ContentScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                this.ContentScrollViewer.ScrollChanged           += new ScrollChangedEventHandler(this.ContentScrollViewer_ScrollChanged);
            }
            else
            {
                this.MainGrid.Children.Remove(this.LeftScrollRegion);
                this.MainGrid.Children.Remove(this.RightScrollRegion);
            }
        }
Ejemplo n.º 3
0
 public HoverDwellButton()
 {
     KinectController.AddPreviewHandEnterHandler(this, this.OnPreviewHandEnter);
     KinectController.AddPreviewHandLeaveHandler(this, this.OnPreviewHandLeave);
 }