Exemplo n.º 1
0
        public QuantityCircle Clone(UcmlObject obj)
        {
            var newObj = new QuantityCircle();
            var aux    = (QuantityCircle)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.IsSelected          = aux.IsSelected;
            newObj.IdObjectStarLine    = aux.IdObjectStarLine;
            newObj.isAbleUserSelection = aux.isAbleUserSelection;
            newObj.UsedAtDestination   = aux.UsedAtDestination;

            return(newObj);
        }
Exemplo n.º 2
0
        public static List <object> VerifyListObject(List <object> users, List <object> usersFromDestiny = null)
        {
            List <object> returnList = new List <object>();

            foreach (QuantityCircle item in users)
            {
                if (item.IsSelected)
                {
                    QuantityCircle qcAux = new QuantityCircle();
                    QuantityCircle aux   = item;
                    qcAux.IsSelected          = true;
                    qcAux.Percentage          = aux.Percentage;
                    qcAux.isAbleUserSelection = aux.isAbleUserSelection;
                    qcAux.Description         = aux.Description;
                    qcAux.Id      = aux.Id;
                    qcAux.myColor = aux.myColor;

                    returnList.Add(qcAux);
                }
            }

            if (usersFromDestiny != null)
            {
                foreach (QuantityCircle item in returnList)
                {
                    foreach (QuantityCircle item2 in usersFromDestiny)
                    {
                        if (item.Id != item2.Id)
                        {
                            item.IsSelected = false;
                        }
                        else
                        {
                            item.IsSelected = item2.IsSelected;
                            break;
                        }
                    }
                }
            }

            if (returnList.Count == 1)
            {
                (returnList[0] as QuantityCircle).IsSelected = true;
            }

            return(returnList);
        }
Exemplo n.º 3
0
        private static void ImportQuantityCircles(ref Canvas myCanvas, XmlNodeList listQuantityCircle, ControlTemplate template)
        {
            QuantityCircle ucmlObject;

            foreach (XmlNode xn in listQuantityCircle)
            {
                ucmlObject = new QuantityCircle().ImportToXml(xn);
                list[0]++;
                ucmlObject.Template = template;

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

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

                // Set value
                if (ucmlObject.iterationProperty == "Iteration")
                {
                    p.Text = ucmlObject.Percentage.ToString();
                }
                else
                {
                    p.Text = ucmlObject.Percentage.ToString() + "%";
                }

                Border b = (Border)ucmlObject.Template.FindName("circle", ucmlObject);
                b.BorderBrush = 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);
            }
        }
Exemplo n.º 4
0
        public void ChangeColor(SolidColorBrush color, UcmlObject selectedObj)
        {
            UcmlObject selectedObjUCML;
            Border     border;
            TextBlock  percentage;

            if (selectedObj == null)
            {
                selectedObjUCML = this;
            }
            else
            {
                selectedObjUCML = selectedObj;
            }

            border                = (Border)selectedObjUCML.Template.FindName("circle", selectedObjUCML);
            border.BorderBrush    = color;
            percentage            = (TextBlock)selectedObjUCML.Template.FindName("Percentage", selectedObjUCML);
            percentage.Foreground = color;

            System.Windows.Shapes.Path ph = new System.Windows.Shapes.Path();
            PathFigure   pf = new PathFigure();
            PathGeometry pg = new PathGeometry();

            border                = (Border)selectedObjUCML.Template.FindName("circle", selectedObjUCML);
            border.BorderBrush    = color;
            percentage            = (TextBlock)selectedObjUCML.Template.FindName("Percentage", selectedObjUCML);
            percentage.Foreground = color;

            QuantityCircle lqc = selectedObjUCML as QuantityCircle;

            lqc.myColor = color;
            lqc.LoopReference.bezierCurve.Stroke = color;
            lqc.LoopReference.myColor            = color;
            lqc.LoopReference.myArrow.Stroke     = color;
            lqc.LoopReference.myArrow.Fill       = color;
            lqc.LoopReference.myColor            = color;
        }