public void RestoreConnections()
        {
            #region Restore connection view models

            var hs = new HashSet <Connection>();
            foreach (GateViewModelWithCoordinates g in GateList)
            {
                foreach (PinViewModel p in g.gateViewModel.AllPins)
                {
                    foreach (Connection cvm in p.Pin.Connections)
                    {
                        hs.Add(cvm);
                    }
                }
            }

            foreach (Connection con in hs)
            {
                ConnectionViewModel cvm = new ConnectionViewModel(con);
                ConnectionList.Add(new ConnectionViewModelWithCoordinates(cvm));
            }

            #endregion
        }
        public void TryConnect()
        {
            if (SelectedInputPin == null || SelectedOutputPin == null)
            {
                return;
            }
            if (SelectedInputPin.Pin.Owner == SelectedOutputPin.Pin.Owner)
            {
                SelectedInputPin  = null;
                SelectedOutputPin = null;
                return;
            }
            Connection con = new Connection();

            SelectedInputPin.Pin.AssignConnection(con);
            SelectedOutputPin.Pin.AssignConnection(con);
            ConnectionViewModel cvm = new ConnectionViewModel(con);

            ConnectionList.Add(new ConnectionViewModelWithCoordinates(cvm));
            SelectedInputPin  = null;
            SelectedOutputPin = null;

            return;
        }
            public ConnectionViewModelWithCoordinates(ConnectionViewModel con)
            {
                connectionViewModel = con;

                RecalcCoordinates();
            }
 public void BreakConnection(ConnectionViewModel con)
 {
     Pin.Connections.Remove(con.connection);
     connectionViewMoedels.Remove(con);
 }
 public void AssignConnection(ConnectionViewModel cvm)
 {
     //Pin.AssignConnection(cvm.connection);
     connectionViewMoedels.Add(cvm);
 }