public void AddTransaction() { Transaction.BalanceAtTimeStamp = Transaction.Account.Balance + Transaction.Amount; undoRedoController.AddAndExecute(new AddTransaction(MainViewModel.CurrentAccount.Transactions, initialStateTransaction, Transaction)); MainViewModel.CurrentViewModel = MainViewModel._TransactionListModel; MainViewModel.Save.Execute(null); }
private void DeSerializeXMLToObject(string filepath) { XmlSerializer serializer = new XmlSerializer(typeof(SaveLoadCollection)); using (StreamReader wr = new StreamReader(filepath)) { SaveLoadCollection Load = (SaveLoadCollection)serializer.Deserialize(wr); classCollection.Clear(); arrowCollection.Clear(); ClassIndex = Load.tempDiagrams.Count + 1; foreach (Diagram tempDiagram in Load.tempDiagrams) { classCollection.Add(new ClassViewModel(tempDiagram)); } foreach (ArrowViewModel arrow in Load.tempArrows) { ClassViewModel DiagramA = null; ClassViewModel DiagramB = null; foreach (ClassViewModel diagram in classCollection) { if (arrow.DiagramA.Id == diagram.Id) { DiagramA = diagram; } else if (arrow.DiagramB.Id == diagram.Id) { DiagramB = diagram; } } ArrowViewModel tempArrow = new ArrowViewModel(DiagramA, DiagramB, arrow.arrow); undoRedoController.AddAndExecute(new AddArrowCommand(arrowCollection, tempArrow)); } undoRedoController.Reset(); } }
private void PasteKlass() { _undoRedoController.AddAndExecute(new NewKlassCommand(Klasses, _clipboard)); if (_selectedKlass != null) { _selectedKlass.IsSelected = false; } _selectedKlass = _clipboard; _clipboard.IsSelected = true; CopyKlass(); }
public void ChangeArrow() { if (selectedEdge != null) { undoRedoController.AddAndExecute(new ChangeArrowCommand(Edges, selectedEdge)); } selectedEdge = null; }
//private void ExitWindow(window) //{ // window.Close(); //} // Adds a Shape with an AddShapeCommand. private void AddClassBox() { undoRedoController.AddAndExecute(new AddClassBoxCommand(ClassBoxes, new ClassBoxViewModel())); }
public void AddAndExecute(IUndoRedoCommand command) { undoRedoController.AddAndExecute(command); UpdateUIforUndoRedo(); }
// Adds a Shape with an AddShapeCommand. private void AddShape() { undoRedoController.AddAndExecute(new AddShapeCommand(Shapes, new Shape())); }
public void AddAccount() { undoRedoController.AddAndExecute(new AddAccountCommand(MainViewModel.Accounts, InitialStateAccount, EndStateAccount)); MainViewModel.CurrentViewModel = MainViewModel._TransactionListModel; MainViewModel.Save.Execute(null); }
// Tilføjer punkt med kommando. public void AddNode() { undoRedoController.AddAndExecute(new AddNodeCommand(Nodes)); }