private void DeleteState(object sender, EventArgs e) { try { MainWindow.Current.UndoManager.RegisterUndoItem(new StateDeleteUndoItem(_fileEditor.DmiEx, _state)); _fileEditor.DmiEx.RemoveState(_state); } catch (Exception ex) { ErrorPopupHelper.Create(ex); } }
private void DuplicateState(object sender, EventArgs e) { try { DmiEXState state = (DmiEXState)_state.Clone(); state.Id = state.Id + "_duplicate"; MainWindow.Current.UndoManager.RegisterUndoItem(new StateNewUndoItem(_fileEditor.DmiEx, state)); _fileEditor.DmiEx.AddState(state); } catch (Exception ex) { ErrorPopupHelper.Create(ex); } }
private void ChangeID(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) { return; } try { MainWindow.Current.UndoManager.RegisterUndoItem(new StateIdChangeUndoItem(State)); State.Id = id_editor.Text; } catch (ArgumentException) { ErrorPopupHelper.Create($"StateID \"{id_editor.Text}\" is not valid!"); } }
private void NewState(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) { return; } try { var id = new_state_editor.Text; DmiEXState state = (DmiEXState)_dmiEx.AddNewState(id); MainWindow.Current.UndoManager.RegisterUndoItem(new StateNewUndoItem(_dmiEx, state)); } catch (ArgumentException ex) { ErrorPopupHelper.Create(ex); } }