コード例 #1
0
        public Gesture AddNewGesture()
        {
            if (!CanAddNewGesture)
            {
                return(null); //do not add a new gesture if any currently edited gesture doesn't contain enough data to be allowed to save
            }
            if (EditorVisible)
            {
                SaveGesture(); //CanAddNewGesture has already checked if CanSaveGesture when EditorVisible
            }
            // Clear the initial state store
            ExGesture = null;

            // Make the new gesture and name it properly
            Gesture g = MakeNewGesture();

            g.Name = GlblRes.NewGesture;
            while (GestureCollection.Where(x => x.Name.StartsWith(g.Name)).Count() > 0)
            {
                g.Name += " " + Convert.ToString(GestureCollection.Where(x => x.Name.StartsWith(g.Name)).Count() + 1);
            }

            // Add the new gesture to the Gesture Collection
            GestureCollection.Add(g);

            // Go
            TheWorkspace.DataContext = g;
            ShowEditor();

            return(g);
        }
コード例 #2
0
        public void AddNewGesture(object parameter)
        {
            // Clear the initial state store
            ExGesture = null;
            // Make the new gesture and name it properly
            Gesture g = MakeNewGesture();

            g.Name = "New Gesture";
            while (GestureCollection.Where(x => x.Name.StartsWith(g.Name)).Count() > 0)
            {
                g.Name += " " + Convert.ToString(GestureCollection.Where(x => x.Name.StartsWith(g.Name)).Count() + 1);
            }
            // Add the new gesture to the Gesture Collection
            GestureCollection.Add(g);
            // Go go go
            TheWorkspace.DataContext = g;
            LaunchEditor();
        }