Пример #1
0
        public GestureCanvas InputGesture(bool isMatching /*as opposed to defining*/, int excludeIdFromMatch = -1)
        {
            GestureCanvas drawer = new GestureCanvas(false, isMatching, true, excludeIdFromMatch);

            if (drawer.DialogResult == true)
            {
                return(drawer);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        private void MatchAndExecuteGesture()
        {
            GestureCanvas gDrawer = InputGesture(true);

            if (gDrawer != null)
            {
                Gesture gMatched = gDrawer.matchedGesture;
                if (gMatched != null)
                {
                    gMatched.Action.Execute();
                }
            }
        }
Пример #3
0
        internal void DefineNewGesture()
        {
            GestureCanvas gDrawer = InputGesture(false);

            if (gDrawer == null)
            {
                // no op
            }
            else if (!gDrawer.defineTooSimilar)
            {
                Gesture gDrawn = gDrawer.drawnGesture;
                this.Add(gDrawn);
            }
            else if (gDrawer.defineTooSimilar)
            {
                MessageBox.Show("Gesture too similar to a previously defined gesture.");
            }
        }
Пример #4
0
        internal void RedefineGesture(int internalGestureID)
        {
            GestureCanvas gDrawer = InputGesture(false, internalGestureID);

            if (gDrawer != null && !gDrawer.defineTooSimilar)
            {
                Gesture gDrawn = gDrawer.drawnGesture;

                foreach (Gesture g in MainWindow.Instance.GestureCollection)
                {
                    if (g.InternalID == internalGestureID)
                    {
                        int index = MainWindow.Instance.GestureCollection.IndexOf(g);
                        g.copyActionAndDescriptionTo(gDrawn);
                        MainWindow.Instance.GestureCollection[index] = gDrawn;
                        break;
                    }
                }
            }
            else if (gDrawer != null && gDrawer.defineTooSimilar)
            {
                MessageBox.Show("Gesture too similar to a previously defined gesture.");
            }
        }