Esempio n. 1
0
        public OptionBox Clone(UcmlObject obj)
        {
            var newObj = new OptionBox();
            var aux    = (OptionBox)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.IdObjectStarLine    = aux.IdObjectStarLine;
            newObj.IdObjectEndLine     = aux.IdObjectEndLine;
            newObj.isAbleUserSelection = aux.isAbleUserSelection;

            return(newObj);
        }
Esempio n. 2
0
        private static void ImportOptionBox(ref Canvas myCanvas, XmlNodeList listOptionBox, ControlTemplate template)
        {
            OptionBox ucmlObject;

            foreach (XmlNode xn in listOptionBox)
            {
                ucmlObject = new OptionBox().ImportToXml(xn);
                list[3]++;
                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();

                Polyline  line1 = (Polyline)ucmlObject.Template.FindName("Line1", ucmlObject);
                Polyline  line2 = (Polyline)ucmlObject.Template.FindName("Line2", ucmlObject);
                TextBlock descriptionOptionBox = (TextBlock)ucmlObject.Template.FindName("Description", ucmlObject);
                line1.Stroke = ucmlObject.myColor;
                line2.Stroke = ucmlObject.myColor;
                descriptionOptionBox.Foreground = 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);
            }
        }