Example #1
0
        private void DrawAction(Point point)
        {
            ActionTool actionTool = FlowManager.Instance.ActionTool;

            if (actionTool.SelectedAction != null)
            {
                Type          actionType    = actionTool.SelectedAction.GetType();
                FlowComponent flowComponent = null;
                FWProcess     fwProcess     = null;

                if (actionType.Equals(typeof(ActionInputValue)))
                {
                    fwProcess = new ActionInputValue();
                }
                else if (actionType.Equals(typeof(ActionCodeInjection)))
                {
                    fwProcess = new ActionCodeInjection();
                }
                else if (actionType.Equals(typeof(ActionMessageBox)))
                {
                    fwProcess = new ActionMessageBox();
                }
                else if (actionType.Equals(typeof(ActionListBoxAdd)))
                {
                    fwProcess = new ActionListBoxAdd();
                }
                else if (actionType.Equals(typeof(ActionListBoxRemove)))
                {
                    fwProcess = new ActionListBoxRemove();
                }
                // 앞으로 추가.
                else if (false)
                {
                }

                if (fwProcess != null)
                {
                    fwProcess.Left   = Math.Round(point.X);
                    fwProcess.Top    = Math.Round(point.Y);
                    fwProcess.Width  = 100;
                    fwProcess.Height = 30;

                    if (!FWSymbolList.Contains(fwProcess))
                    {
                        FWSymbolList.Add(fwProcess);
                    }

                    flowComponent = new FlowComponent(fwProcess, this);

                    flowComponent.PropertyChanged  += FlowComponent_PropertyChanged;
                    flowComponent.PreviewMouseDown += FlowComponent_PreviewMouseDown;
                    flowComponent.PreviewMouseUp   += FlowComponent_PreviewMouseUp;

                    canvasArea.Children.Add(flowComponent);

                    FlowManager.Instance.ActionTool.DeselectListBox();
                }
            }
        }
Example #2
0
        private void DrawSymbol(Type type, Point point)
        {
            FlowComponent flowComponent = null;
            FWSymbol      fwSymbol      = null;

            if (type.Equals(typeof(FWTerminal)))
            {
                fwSymbol = new FWTerminal();
            }
            else if (type.Equals(typeof(FWReady)))
            {
                fwSymbol = new FWReady();
            }
            else if (type.Equals(typeof(FWProcess)))
            {
                fwSymbol = new FWProcess();
            }
            else if (type.Equals(typeof(FWDecision)))
            {
                fwSymbol = new FWDecision();
            }

            if (fwSymbol != null)
            {
                fwSymbol.Left   = Math.Round(point.X);
                fwSymbol.Top    = Math.Round(point.Y);
                fwSymbol.Width  = 100;
                fwSymbol.Height = 30;

                if (!FWSymbolList.Contains(fwSymbol))
                {
                    FWSymbolList.Add(fwSymbol);
                }

                flowComponent = new FlowComponent(fwSymbol, this);

                flowComponent.PropertyChanged  += FlowComponent_PropertyChanged;
                flowComponent.PreviewMouseDown += FlowComponent_PreviewMouseDown;
                flowComponent.PreviewMouseUp   += FlowComponent_PreviewMouseUp;

                canvasArea.Children.Add(flowComponent);

                FlowManager.Instance.FlowTool.Deselection();
            }
        }
Example #3
0
        private void ConnectLine(FWSymbol startConnector, FWSymbol endConnector)
        {
            if (startConnector.EndConnector != null)
            {
                return;
            }

            FWLine fwLine = new FWLine
            {
                StartConnector = startConnector,
                EndConnector   = endConnector
            };

            if (startConnector is FWDecision fwDecision)
            {
                if (fwDecision.EndConnector[0] == null)
                {
                    fwDecision.EndConnector[0] = fwLine;
                }
                else if (fwDecision.EndConnector[1] == null)
                {
                    fwDecision.EndConnector[1] = fwLine;
                }
                else
                {
                    return;
                }

                endConnector.StartConnector = fwLine;
            }
            else
            {
                startConnector.EndConnector = fwLine;
                endConnector.StartConnector = fwLine;
            }

            FWSymbolList.Add(fwLine);

            DrawFlowPath(fwLine, startConnector, endConnector);

            FlowComponent flowComponent = new FlowComponent(fwLine, this);

            canvasArea.Children.Add(flowComponent);
        }