示例#1
0
        private bool isLinkedToProcess(LinkStroke linkStroke, CustomInkCanvas canvas)
        {
            CustomStroke fromStroke = new Stroke(new StylusPointCollection {
                new StylusPoint(0, 0)
            }) as CustomStroke;
            CustomStroke toStroke = new Stroke(new StylusPointCollection {
                new StylusPoint(0, 0)
            }) as CustomStroke;

            string from = "";
            string to   = "";

            from = linkStroke.from?.formId;
            to   = linkStroke.to?.formId;
            if (from != null)
            {
                canvas.StrokesDictionary.TryGetValue(from, out fromStroke);
            }
            if (to != null)
            {
                canvas.StrokesDictionary.TryGetValue(to, out toStroke);
            }

            return(fromStroke != null && fromStroke.isProccessStroke() || toStroke != null && toStroke.isProccessStroke());
        }
示例#2
0
        private bool isBetweenTwoClasses(LinkStroke linkStroke, CustomInkCanvas canvas)
        {
            CustomStroke fromStroke = new Stroke(new StylusPointCollection {
                new StylusPoint(0, 0)
            }) as CustomStroke;
            CustomStroke toStroke = new Stroke(new StylusPointCollection {
                new StylusPoint(0, 0)
            }) as CustomStroke;

            string from = "";
            string to   = "";

            from = linkStroke.from?.formId;
            to   = linkStroke.to?.formId;
            if (from != null)
            {
                canvas.StrokesDictionary.TryGetValue(from, out fromStroke);
            }
            if (to != null)
            {
                canvas.StrokesDictionary.TryGetValue(to, out toStroke);
            }

            return(fromStroke is ClassStroke && toStroke is ClassStroke);
        }
示例#3
0
        public void setParameters(LinkStroke linkStroke, CustomInkCanvas canvas)
        {
            var parent = Parent;

            while (!(parent is WindowDrawing))
            {
                parent = LogicalTreeHelper.GetParent(parent);
            }

            windowDrawing = (WindowDrawing)parent;
            if (windowDrawing != null)
            {
                LinkStroke stroke = windowDrawing.surfaceDessin.GetSelectedStrokes()[0] as LinkStroke;
                _label            = stroke.name;
                _selectedColor    = stroke.style.color;
                _multiplicityFrom = stroke.from.multiplicity;
                _multiplicityTo   = stroke.to.multiplicity;

                switch (stroke.linkType)
                {
                case (int)LinkTypes.LINE:
                    _linkType = "Line";
                    break;

                case (int)LinkTypes.HERITAGE:
                    _linkType = "Heritage";
                    break;

                case (int)LinkTypes.ONE_WAY_ASSOCIATION:
                    _linkType = "One way association";
                    break;

                case (int)LinkTypes.TWO_WAY_ASSOCIATION:
                    _linkType = "Two way association";
                    break;

                case (int)LinkTypes.COMPOSITION:
                    _linkType = "Composition";
                    break;

                case (int)LinkTypes.AGGREGATION:
                    _linkType = "Aggregation";
                    break;

                default:
                    _linkType = "Line";
                    break;
                }

                switch (stroke.style.type)
                {
                case (int)LinkStyles.FULL:
                    _linkStyle = "Full";
                    break;

                case (int)LinkStyles.DOTTED:
                    _linkStyle = "Dotted";
                    break;

                default:
                    _linkStyle = "Full";
                    break;
                }

                switch (stroke.style.thickness)
                {
                case (int)LinkThicknesses.THIN:
                    _linkThickness = "Thin";
                    break;

                case (int)LinkThicknesses.NORMAL:
                    _linkThickness = "Normal";
                    break;

                case (int)LinkThicknesses.THICK:
                    _linkThickness = "Thick";
                    break;

                default:
                    _linkThickness = "Thin";
                    break;
                }
            }

            if (isBetweenTwoClasses(linkStroke, canvas))
            {
                _linkTypesList = new List <string> {
                    "Line", "One way association", "Two way association", "Heritage", "Aggregation", "Composition"
                };
            }
            else if (isLinkedToOneClass(linkStroke, canvas))
            {
                _linkTypesList = new List <string> {
                    "Line", "One way association", "Two way association"
                };
            }
            else if (isLinkedToProcess(linkStroke, canvas))
            {
                _linkTypesList = new List <string> {
                    "One way association"
                };
            }
            else
            {
                _linkTypesList = new List <string> {
                    "Line", "One way association", "Two way association"
                };
            }
            _linkStylesList = new List <string> {
                "Full", "Dotted"
            };
            _linkThicknessesList = new List <string> {
                "Thin", "Normal", "Thick"
            };

            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Label"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LinkStyle"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LinkType"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedColor"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LinkThickness"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MultiplicityFrom"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MultiplicityTo"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LinkStylesList"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LinkTypesList"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LinkThicknessesList"));
        }