Example #1
0
 private void EditButtonClick(object sender, RoutedEventArgs e)
 {
     changesMade = true;
     if (listOfGesturesToShow.SelectedItem != null)
     {
         Gesture gesture;
         Gesture gestureToEdit      = listOfGesturesToShow.SelectedItem as Gesture;
         GestureAdderAndEditor wind = new GestureAdderAndEditor(gestureToEdit.type, gestureToEdit.command, gestureToEdit.code);
         if (wind.ShowDialog() == true)
         {
             listOfGestures.Remove(listOfGesturesToShow.SelectedItem as Gesture);
             gesture = wind.createdGesture;
             foreach (Gesture tmpG in listOfGestures)
             {
                 if (tmpG == null)
                 {
                     return;
                 }
                 if (tmpG.code.Contains(gesture.code) || gesture.code.Contains(tmpG.code))
                 {
                     MessageBox.Show($"Gesture with desired code or part of it already exists changes were not saved\n {gesture.code} and {tmpG.code}", "Can't change gesture");
                     listOfGestures.Add(gestureToEdit);
                     return;
                 }
             }
             listOfGestures.Add(gesture);
         }
     }
 }
Example #2
0
        private void AddButtonClick(object sender, RoutedEventArgs e)
        {
            changesMade = true;
            Gesture gesture;
            GestureAdderAndEditor wind = new GestureAdderAndEditor();

            if (wind.ShowDialog() == true)
            {
                gesture = wind.createdGesture;
                foreach (Gesture tmpG in listOfGestures)
                {
                    if (tmpG == null)
                    {
                        return;
                    }
                    if (tmpG.code.Contains(gesture.code) || gesture.code.Contains(tmpG.code))
                    {
                        MessageBox.Show($"Gesture with desired code or part of it already exists\n {gesture.code} and {tmpG.code}", "Can't add gesture");
                        return;
                    }
                }
                listOfGestures.Add(gesture);
            }
        }