public void DropElement(SymbolBaseViewModel symbolBaseViewModel) { if (symbolBaseViewModel is BlockViewModel) { var blockViewModel = (BlockViewModel)symbolBaseViewModel; var blockSymbol = _sheet.CreateBlockSymbol(); blockSymbol.PositionX = blockViewModel.X; blockSymbol.PositionY = blockViewModel.Y; SymbolVms.Remove(_ghost); _ghost = null; _sheet.Add(blockSymbol, _client); } else if (symbolBaseViewModel is ConnectorViewModel) { var connectorViewModel = (ConnectorViewModel)symbolBaseViewModel; var connector = _sheet.CreateConnector(); connector.PositionX = connectorViewModel.X; connector.PositionY = connectorViewModel.Y; SymbolVms.Remove(_ghost); _ghost = null; _sheet.AddConnector(connector, _client); } }
private void OnBlockSymbolsRemoveAtEventHandler(int indexAt, BlockSymbol blockSymbol) { var toBeRemoved = _symbolVms.OfType <BlockViewModel>().FirstOrDefault(b => b.Id == blockSymbol.Id); if (toBeRemoved != null) { SymbolVms.Remove(toBeRemoved); } }
private void OnConnectorRemoveAtEventHandler(int pos, Connector connector) { var toBeRemoved = _symbolVms.FirstOrDefault(b => b.Id == connector.Id); if (toBeRemoved != null) { //Connectors.Remove(toBeRemoved); SymbolVms.Remove(toBeRemoved); } }