Пример #1
0
        public ExitPath Clone(UcmlObject obj)
        {
            var newObj = new ExitPath();
            var aux    = (ExitPath)obj;

            newObj.Id                  = aux.Id;
            newObj.UcmlName            = aux.UcmlName;
            newObj.Color               = aux.Color;
            newObj.PosTopX             = aux.PosTopX;
            newObj.PosTopY             = aux.PosTopY;
            newObj.Description         = aux.Description;
            newObj.TemplateName        = aux.TemplateName;
            newObj.listNewProp         = aux.listNewProp;
            newObj.UcmlWidth           = aux.UcmlWidth;
            newObj.UcmlHeight          = aux.UcmlHeight;
            newObj.myColor             = aux.myColor;
            newObj.Percentage          = aux.Percentage;
            newObj.StartLine           = aux.StartLine;
            newObj.EndLine             = aux.EndLine;
            newObj.IdObjectStartLine   = aux.IdObjectStartLine;
            newObj.IdObjectEndLine     = aux.IdObjectEndLine;
            newObj.isAbleUserSelection = aux.isAbleUserSelection;

            return(newObj);
        }
Пример #2
0
        private static void ImportExitPath(ref Canvas myCanvas, XmlNodeList listExitPath, ControlTemplate template)
        {
            ExitPath ucmlObject;

            foreach (XmlNode xn in listExitPath)
            {
                ucmlObject = new ExitPath().ImportToXml(xn);
                list[5]++;
                ucmlObject.Template = template;

                // Calling ApplyTemplate enables us to navigate the visual tree right now (important!)
                ucmlObject.ApplyTemplate();

                var d = (TextBlock)ucmlObject.Template.FindName("Description", ucmlObject);
                d.Text = ucmlObject.Description.ToString();


                var p = (TextBlock)ucmlObject.Template.FindName("Percentage", ucmlObject);
                p.Text       = ucmlObject.Percentage.ToString() + "%";
                p.Foreground = ucmlObject.myColor;

                System.Windows.Shapes.Path path = (System.Windows.Shapes.Path)ucmlObject.Template.FindName("Line", ucmlObject);
                Polygon   polygon    = (Polygon)ucmlObject.Template.FindName("Polygon", ucmlObject);
                Border    border     = (Border)ucmlObject.Template.FindName("BorderPercentage", ucmlObject);
                TextBlock tbExitPath = (TextBlock)ucmlObject.Template.FindName("Description", ucmlObject);

                tbExitPath.Foreground = ucmlObject.myColor;
                border.BorderBrush    = ucmlObject.myColor;
                path.Stroke           = ucmlObject.myColor;
                polygon.Stroke        = ucmlObject.myColor;
                polygon.Fill          = ucmlObject.myColor;

                // Add new object as child of canvas to allow get ucmlObjsct's size from it's template
                myCanvas.Children.Add(ucmlObject);
                // Update the layout of the ucml object
                ucmlObject.UpdateLayout();

                // Set position top and left of ucml object on the canvas
                Canvas.SetLeft(ucmlObject, ucmlObject.PosTopX);
                Canvas.SetTop(ucmlObject, ucmlObject.PosTopY);
                // Move our thumb to the front to be over the lines
                Canvas.SetZIndex(ucmlObject, 1);
                // Update the layout of the ucml object
                ucmlObject.UpdateLayout();


                LoadMyUsers(ucmlObject, myCanvas);

                //listConnections.Add(new ConnectionLineShape { startConect = ucmlObject.Id, endConect = ucmlObject.IdObjectStartLine });
            }
        }