private bool SaveAction() { try { var regex = new Regex("finger_[0-9]+_start_[XY]?|finger_[0-9]+_end_[XY]?|finger_[0-9]+_ID"); var replaced = regex.Replace(ConditionTextBox.Text, "10"); DataTable dataTable = new DataTable(); dataTable.Compute(replaced, null); } catch (Exception exception) { return(ShowErrorMessage(LocalizationProvider.Instance.GetTextValue("ActionDialog.Messages.ConditionError"), exception.Message)); } var sameAction = _sourceApplication.Actions.FirstOrDefault(a => a == _sourceAction); if (sameAction != null) { NewAction = sameAction; } else { _sourceApplication.AddAction(NewAction); } // Store new values NewAction.Condition = string.IsNullOrWhiteSpace(ConditionTextBox.Text) ? null : ConditionTextBox.Text; NewAction.ActivateWindow = ActivateWindowCheckBox.IsChecked; NewAction.GestureName = CurrentGesture?.Name ?? string.Empty; NewAction.Name = ActionNameTextBox.Text.Trim(); NewAction.MouseHotkey = (MouseActions?)MouseActionComboBox.SelectedValue ?? MouseActions.None; NewAction.Hotkey = HotKeyTextBox.HotKey != null ? new Hotkey() { KeyCode = KeyInterop.VirtualKeyFromKey(HotKeyTextBox.HotKey.Key), ModifierKeys = (int)HotKeyTextBox.HotKey.ModifierKeys } : null; int contactCount = (int)ContactCountSlider.Value; NewAction.ContinuousGesture = ContinuousGestureSwitch.IsChecked.GetValueOrDefault() && contactCount > 1 && GestureListBox.SelectedIndex >= 0 ? new ContinuousGesture(contactCount, (Gestures)(1 << GestureListBox.SelectedIndex)) : null; // Save entire list of applications ApplicationManager.Instance.SaveApplications(); return(true); }