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

        //}

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