Example #1
0
        private void GestureParser_GestureCaptured(Gesture gesture)
        {
            if (gesture.Count() == 0 && gesture.Modifier == GestureModifier.None) return;
            Debug.WriteLine("GestureCaptured: " + gesture);
            var formerMnemonic = lb_mnemonic.Text;

            CapturedGesture = gesture;
            //if (_intent != null)
            {
                var found = _app.Find(gesture);

                if (found != null && (found != _intent))
                {
                    lb_errMsg.Text = "相同手势(" + found.Name + ")已存在,点击‘保存’会将其替代";
                    flowAlert.Visible = true;
                }
                else
                {
                    flowAlert.Visible = false;
                }
            }
                            
            lb_mnemonic.Text = gesture.ToString();

            if (formerMnemonic == tb_gestureName.Text|| string.IsNullOrEmpty(tb_gestureName.Text))
            {
                tb_gestureName.Text = lb_mnemonic.Text;
                tb_gestureName.SelectAll();
                tb_gestureName.Focus();
            }
            else
            {
                btnOk.Focus();
            }

            btnOk.Enabled = true;
            
        }
Example #2
0
 private void PathTrackerOnPathStart(PathEventArgs args)
 {
     //初始化
     _effectiveIntent = null;
     _pointCount = 1;
     _gesture = new Gesture(args.Context.GestureButton);
     _lastPoint = args.Location;
 }
Example #3
0
        /// <summary>
        /// 当处于捕获模式,用户手势结束的时候发生。如果注册GestureCaptured Handler的时候捕获的SynchronizationContext不为null(比如Gui线程),
        /// 则在其SynchronizationContext文中执行。
        /// </summary>
        /// <param name="gesture"></param>
        protected void OnGestureCaptured(Gesture gesture)
        {
            lock (@lock)
            {
                if (_gestureCapturedEventHandlerContexts.Count == 0) return;

                foreach (var kv in _gestureCapturedEventHandlerContexts)
                {
                    var syncContext = kv.Value;
                    var handler = kv.Key;
                    if (syncContext == null)
                    {
                        handler(gesture);
                    }
                    else
                    {
                        syncContext.Post(s => handler(gesture), null);
                    }
                }

            }
        }
        private void HandleGestureRecorded(Gesture g)
        {
            if (!ShowPath && !ShowCommandName) return;

            Debug.WriteLine("WhenGestureCaptured");

            EndView();
        }
        //todo: 合并为IntentRecogChanged?
        private void HandleIntentInvalid(Gesture gesture)
        {
            if (!ShowPath && !ShowCommandName) return;

            Debug.WriteLine("IntentInvalid");
            //pre
            if (ShowCommandName)
            {
                HideLabel();
            }

            if (_isCurrentRecognized && ShowPath)
            {
                _pathPen = _alternativePen;
                _isCurrentRecognized = false;
                _recognizeStateChanged = true;

                //ResetPathDirtyRect();
            }

            //draw
            DrawAndUpdate();

            //clear
            if (ShowCommandName)
            {
                _labelRect = default(Rectangle);
                _labelChanged = false;
            }
        }