Ejemplo n.º 1
0
        public Window1()
            : base()
        {
            InitializeComponent();
            inkCanvas1.StylusSystemGesture += new StylusSystemGestureEventHandler(inkCanvas1_StylusSystemGesture);

            //<Snippet2>
            Stylus.SetIsFlicksEnabled(canvas1, false);
            //</Snippet2>

            //<Snippet4>
            Stylus.SetIsTapFeedbackEnabled(canvas1, false);
            //</Snippet4>

            //<Snippet5>
            bool tapFeedbackEnabled = Stylus.GetIsTapFeedbackEnabled(canvas1);
            //</Snippet5>

            //<Snippet6>
            bool flicksEnabled = Stylus.GetIsFlicksEnabled(canvas1);

            //</Snippet6>

            canvas1.StylusSystemGesture += new StylusSystemGestureEventHandler(canvas1_StylusSystemGesture);
        }
Ejemplo n.º 2
0
 private void TouchFeedbackStatus(bool enable)
 {
     Stylus.SetIsTouchFeedbackEnabled(this, enable);
     Stylus.SetIsTapFeedbackEnabled(this, enable);
     Stylus.SetIsPressAndHoldEnabled(this, enable);
     Cursor = enable ? Cursors.Arrow : Cursors.None;
 }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();
            if (System.Windows.Forms.Screen.AllScreens.Length >= 2)
            {
                screen0 = System.Windows.Forms.Screen.AllScreens[0].Bounds;
                screen1 = System.Windows.Forms.Screen.AllScreens[1].Bounds;
                STATICS.SCREEN_WIDTH  = screen0.Width;
                STATICS.SCREEN_HEIGHT = screen0.Height;
                STATICS.SCREEN_NUM    = 2;
                System.Drawing.Rectangle screenBounds = System.Windows.Forms.Screen.AllScreens[0].Bounds;
                this.Left = screenBounds.Left;
                this.Top  = screenBounds.Top;
                InitializeCloudView();
            }
            else
            {
                STATICS.SCREEN_WIDTH  = (int)SystemParameters.PrimaryScreenWidth;
                STATICS.SCREEN_HEIGHT = (int)SystemParameters.PrimaryScreenHeight;
                STATICS.SCREEN_NUM    = 1;
                //STATICS.DEAULT_CARD_SIZE = new Size(0.08333 * STATICS.SCREEN_WIDTH, 0.11111 * STATICS.SCREEN_HEIGHT);
                //STATICS.DEAULT_CARD_SIZE_WITH_BORDER = new Size(0.08333 * STATICS.SCREEN_WIDTH + 5, 0.11111 * STATICS.SCREEN_HEIGHT + 5);
                this.Width       = STATICS.SCREEN_WIDTH;
                this.Height      = STATICS.SCREEN_HEIGHT;
                this.WindowState = System.Windows.WindowState.Maximized;
                this.Left        = 0;
            }
            boundary = new Rect(0, 0, STATICS.SCREEN_WIDTH, STATICS.SCREEN_HEIGHT);
            Stylus.SetIsPressAndHoldEnabled(this, false);
            Stylus.SetIsTapFeedbackEnabled(this, false);
            Stylus.SetIsFlicksEnabled(this, false);
            Stylus.SetIsTouchFeedbackEnabled(this, false);

            this.Loaded += Window_Loaded;
            Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata {
                DefaultValue = 28
            });
            controlWindow = new Control_Window(this);
            controlWindow.Show();

            this.Visibility = Visibility.Hidden;
            this.KeyDown   += MainWindow_KeyDown;
        }
Ejemplo n.º 4
0
        void Win7TouchVeMapLoaded(object sender, RoutedEventArgs e)
        {
            if (!Handler.DigitizerCapabilities.IsMultiTouchReady)
            {
                return;
            }

            //the current window is not available during construction, so the current window will haved to be obtained in another event, such as loaded
            Window parentWindow = Window.GetWindow(this);

            Factory.EnableStylusEvents(parentWindow);

            Stylus.SetIsPressAndHoldEnabled(this, true);
            Stylus.SetIsFlicksEnabled(this, false);
            Stylus.SetIsTapFeedbackEnabled(this, true);
            Stylus.SetIsTouchFeedbackEnabled(this, true);

            _manipulationProcessor = new ManipulationInertiaProcessor(ProcessorManipulations.ALL, Factory.CreateTimer());
            _manipulationProcessor.BeforeInertia     += ManipulationProcessorBeforeInertia;
            _manipulationProcessor.ManipulationDelta += ManipulationProcessorManipulationDelta;
        }
Ejemplo n.º 5
0
        public static void AttachTouchTapEvent(this FrameworkElement element, Action <Point> tapEvent)
        {
            Stylus.SetIsPressAndHoldEnabled(element, false);
            Stylus.SetIsTapFeedbackEnabled(element, false);
            element.PreviewTouchDown += (sender, ex) =>
            {
                if (tapTrace.ContainsKey(ex.TouchDevice.Id) == false)
                {
                    TapInfo info = new TapInfo();
                    info.Key       = ex.TouchDevice.Id;
                    info.Position  = ex.GetTouchPoint(Application.Current.MainWindow).Position;
                    info.Timestamp = ex.Timestamp;
                    tapTrace.Add(ex.TouchDevice.Id, info);
                }
            };

            element.PreviewTouchUp += (sender, ex) =>
            {
                if (tapTrace.ContainsKey(ex.TouchDevice.Id))
                {
                    TapInfo info = tapTrace[ex.TouchDevice.Id];
                    tapTrace.Remove(ex.TouchDevice.Id);
                    int timeStampDiff = (ex.Timestamp - info.Timestamp);
                    if (timeStampDiff < 400)//0.4 seconds
                    {
                        Point newPos = ex.GetTouchPoint(Application.Current.MainWindow).Position;
                        Point result = newPos.Sub(info.Position);


                        if (result.Length() < GestureConsts.Current.DoubleTapDistance)
                        {
                            tapEvent(info.Position);
                        }
                    }
                }
            };
        }