Beispiel #1
0
        internal override void LoadDataFromXml(XmlElement element)
        {
            base.LoadDataFromXml(element);

            XmlElement tagetObjectsElement = element["TargetObjects"];

            if (tagetObjectsElement != null && tagetObjectsElement.ChildNodes.Count > 0)
            {
                XmlNodeList childList = tagetObjectsElement.ChildNodes;
                foreach (XmlElement childElement in childList)
                {
                    try
                    {
                        ShowHideActionTarget target = new ShowHideActionTarget(Guid.Empty);
                        target.LoadDataFromXml(childElement);
                        _targetObjects.Add(target.Guid, target);
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message.ToString());
                        continue;
                    }
                }
            }
        }
Beispiel #2
0
        public IShowHideActionTarget AddTargetObject(Guid widgetGuid)
        {
            ShowHideActionTarget target = new ShowHideActionTarget(widgetGuid);

            _targetObjects[widgetGuid] = target;
            return(target);
        }
Beispiel #3
0
        internal ShowHideActionTarget Clone()
        {
            ShowHideActionTarget newTarget = new ShowHideActionTarget(_guid);

            newTarget._visibilityType = _visibilityType;
            newTarget._animateType    = _animateType;
            newTarget._animateTime    = _animateTime;
            return(newTarget);
        }
Beispiel #4
0
        internal override void Update(Dictionary <Guid, IObjectContainer> newTargets)
        {
            Dictionary <Guid, ShowHideActionTarget> newTargetObjects = new Dictionary <Guid, ShowHideActionTarget>();

            foreach (ShowHideActionTarget target in _targetObjects.Values)
            {
                if (newTargets.ContainsKey(target.Guid))
                {
                    IObjectContainer objects = newTargets[target.Guid];

                    // Add top group as the target first.
                    foreach (Group group in objects.GroupList)
                    {
                        if (group.ParentGroupGuid == Guid.Empty)
                        {
                            ShowHideActionTarget newTarget = target.Clone();
                            newTarget.Guid = group.Guid;
                            newTargetObjects.Add(newTarget.Guid, newTarget);
                        }
                    }

                    // Then add the widgets which are not in a group.
                    foreach (Widget widget in objects.WidgetList)
                    {
                        if (widget.ParentGroupGuid == Guid.Empty)
                        {
                            ShowHideActionTarget newTarget = target.Clone();
                            newTarget.Guid = widget.Guid;
                            newTargetObjects.Add(newTarget.Guid, newTarget);
                        }
                    }
                }
                else
                {
                    newTargetObjects.Add(target.Guid, target);
                }
            }

            _targetObjects = newTargetObjects;
        }