示例#1
0
        private void AddNewLane()
        {
            int index = Lanes.Count;

            LaneViewModel laneViewModel = new LaneViewModel(index, this);

            if (index > 0)
            {
                LaneViewModel previousLane = Lanes[index - 1];
                previousLane.Next = laneViewModel;
            }

            PropertyChanged += laneViewModel.PoolPropertyChanged;
            foreach (LaneViewModel lane in Lanes)
            {
                PropertyChanged -= lane.PoolPropertyChanged;
            }
            MinHeight = CalculateMinHeight();
            if (index == 0)
            {
                laneViewModel.Height = Height;
            }
            else
            {
                Height += laneViewModel.Height;
            }
            Lanes.Add(laneViewModel);
            _poolElement.Lanes.Add(laneViewModel.Lane);
            GenericAddedAction <LaneViewModel> laneAddedAction = new GenericAddedAction <LaneViewModel>(this, laneViewModel);

            NotifyActionPerformed(laneAddedAction);
        }
示例#2
0
        public void SetConnection(ElementsConnectionViewModel connection)
        {
            connection.ElementDeleted += Connection_ElementDeleted;
            GenericAddedAction <BaseElementViewModel> addedAction = new GenericAddedAction <BaseElementViewModel>(Document, connection);
            var addedActionArgs = new ActionPerformedEventArgs(addedAction);

            ActionPerformed?.Invoke(this, addedActionArgs);
            _activeConnections.Add(connection);
        }