Пример #1
0
 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();
            }
        }
Пример #3
0
 private void PasteKlass()
 {
     _undoRedoController.AddAndExecute(new NewKlassCommand(Klasses, _clipboard));
     if (_selectedKlass != null)
     {
         _selectedKlass.IsSelected = false;
     }
     _selectedKlass        = _clipboard;
     _clipboard.IsSelected = true;
     CopyKlass();
 }
Пример #4
0
 public void ChangeArrow()
 {
     if (selectedEdge != null)
     {
         undoRedoController.AddAndExecute(new ChangeArrowCommand(Edges, selectedEdge));
     }
     selectedEdge = null;
 }
Пример #5
0
        //private void ExitWindow(window)
        //{
        //    window.Close();

        //}

        // Adds a Shape with an AddShapeCommand.
        private void AddClassBox()
        {
            undoRedoController.AddAndExecute(new AddClassBoxCommand(ClassBoxes, new ClassBoxViewModel()));
        }
Пример #6
0
 public void AddAndExecute(IUndoRedoCommand command)
 {
     undoRedoController.AddAndExecute(command);
     UpdateUIforUndoRedo();
 }
Пример #7
0
 // Adds a Shape with an AddShapeCommand.
 private void AddShape()
 {
     undoRedoController.AddAndExecute(new AddShapeCommand(Shapes, new Shape()));
 }
Пример #8
0
 public void AddAccount()
 {
     undoRedoController.AddAndExecute(new AddAccountCommand(MainViewModel.Accounts, InitialStateAccount, EndStateAccount));
     MainViewModel.CurrentViewModel = MainViewModel._TransactionListModel;
     MainViewModel.Save.Execute(null);
 }
Пример #9
0
 // Tilføjer punkt med kommando.
 public void AddNode()
 {
     undoRedoController.AddAndExecute(new AddNodeCommand(Nodes));
 }