Exemple #1
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            #if DEBUG

            var fileInputComponent = new FileInputComponent {Name = "Input File"};
            var fileInputDesignerItem = new DesignerItemViewModel(ViewModel.DiagramViewModel, fileInputComponent)
            {
                Width = 150,
                Height = 100,
                Left = 50,
                Top = 250
            };
            ViewModel.DiagramViewModel.Items.Add(fileInputDesignerItem);

            var textCapitalizerComponent = new TextCapitalizerComponent {Name = "Capser"};
            var capserDesignerItem = new DesignerItemViewModel(ViewModel.DiagramViewModel, textCapitalizerComponent)
            {
                Width = 150,
                Height = 100,
                Left = 300,
                Top = 275
            };
            ViewModel.DiagramViewModel.Items.Add(capserDesignerItem);

            var connection1 = new ConnectionViewModel(ViewModel.DiagramViewModel, fileInputComponent.FileContentsOutputConnector,
                textCapitalizerComponent.StringInputConnector);
            ViewModel.DiagramViewModel.Items.Add(connection1);
            #endif
        }
Exemple #2
0
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            //if (IsMouseCaptured)
            //	ReleaseMouseCapture();

            if (SourceConnector != null)
                SourceConnector.IsBuildingConnection = false;

            if (SinkConnector != null)
                SinkConnector.IsBuildingConnection = false;

            //if (SourceConnector != null && SinkConnector != null && SinkConnector.ConnectorInfo.CanEndConnection)
            //{
            //	var fullyCreatedSourceInfo = SourceConnector.ConnectorInfo;

            //	var diagram = fullyCreatedSourceInfo.DesignerItem.Diagram;

            //	var newConnection = new ConnectionViewModel(fullyCreatedSourceInfo.DesignerItem.Diagram,
            //		SourceConnector.ConnectorInfo, SinkConnector.ConnectorInfo);

            //	diagram.AddItemCommand.Execute(newConnection);
            //}

            if (SourceConnector != null && _partialConnection != null)
            {
                var sourceConnectorInfo = (FullyCreatedConnectorInfo) SourceConnector.DataContext;
                sourceConnectorInfo.DesignerItem.Diagram.RemoveItemCommand.Execute(_partialConnection);
            }

            _partialConnection = null;
            SourceConnector = null;
            SinkConnector = null;
        }
Exemple #3
0
        public void ResetPartialConnection()
        {
            if (_partialConnection != null)
            {
                var diagram = _partialConnection.SourceConnectorInfo.DesignerItem.Diagram;
                diagram.RemoveItemCommand.Execute(_partialConnection);
            }

            _partialConnection = null;

            if (SourceConnector != null)
                SourceConnector.IsBuildingConnection = false;

            if (SinkConnector != null)
                SinkConnector.IsBuildingConnection = false;

            SourceConnector = null;
            SinkConnector = null;
        }
Exemple #4
0
        protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            if (DesignerCanvas == null)
                return;

            if (ConnectorInfo.CanEndConnection)
            {
                var fullyCreatedSourceInfo = (FullyCreatedConnectorInfo)DesignerCanvas.SourceConnector.DataContext;

                var diagram = fullyCreatedSourceInfo.DesignerItem.Diagram;

                var newConnection = new ConnectionViewModel(fullyCreatedSourceInfo.DesignerItem.Diagram,
                    DesignerCanvas.SourceConnector.ConnectorInfo, ConnectorInfo);

                diagram.AddItemCommand.Execute(newConnection);
            }

            DesignerCanvas.ResetPartialConnection();

            e.Handled = true;
        }