Esempio n. 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();
                }
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 3
0
        public void DeleteSymbol(FlowComponent flowComponent)
        {
            FWSymbol fwSymbol = flowComponent.FWSymbol;

            if (fwSymbol.StartConnector != null)
            {
                fwSymbol.StartConnector.EndConnector = null;
            }

            if (fwSymbol.EndConnector != null)
            {
                fwSymbol.EndConnector.StartConnector = null;
            }

            FWSymbolList.Remove(fwSymbol);

            canvasArea.Children.Remove(flowComponent);
        }
Esempio n. 4
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);
        }