void Bindings_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.OldItems != null)
            {
                foreach (HeliosBinding binding in e.OldItems)
                {
                    ProfileExplorerTreeItem child = GetChildObject(binding);
                    if (child != null)
                    {
                        child.Disconnect();
                        Children.Remove(child);
                    }
                }
            }

            if (e.NewItems != null)
            {
                foreach (HeliosBinding child in e.NewItems)
                {
                    if (child.Action == ContextItem || child.Trigger == ContextItem)
                    {
                        ProfileExplorerTreeItem childItem = new ProfileExplorerTreeItem(child, this, _includeTypes);
                        if (_includeTypes.HasFlag(ProfileExplorerTreeItemType.Binding))
                        {
                            IsExpanded = true;
                            Children.Add(childItem);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void Triggers_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.OldItems != null)
            {
                foreach (IBindingTrigger trigger in e.OldItems)
                {
                    string deviceName = GetDeviceNameForUserInterface(trigger);
                    if (deviceName.Length > 0)
                    {
                        ProfileExplorerTreeItem folder = GetFolder(deviceName);
                        folder.Children.Remove(folder.GetChildObject(trigger));
                        if (folder.Children.Count == 0)
                        {
                            Children.Remove(folder);
                        }
                    }
                    else
                    {
                        Children.Remove(GetChildObject(trigger));
                    }
                }
            }

            if (e.NewItems != null)
            {
                foreach (IBindingTrigger trigger in e.NewItems)
                {
                    AddTrigger(trigger, _includeTypes);
                }
            }
        }
        void VisualChildren_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.OldItems != null)
            {
                foreach (HeliosVisual visual in e.OldItems)
                {
                    ProfileExplorerTreeItem child = GetChildObject(visual);
                    if (child != null)
                    {
                        child.Disconnect();
                        Children.Remove(child);
                    }
                }
            }

            if (e.NewItems != null)
            {
                foreach (HeliosVisual child in e.NewItems)
                {
                    if ((child is HeliosPanel && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Panel)) ||
                        (child is HeliosVisual && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Visual)))
                    {
                        Children.Add(new ProfileExplorerTreeItem(child, this, _includeTypes));
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public ProfileExplorerTreeItem(HeliosProfile profile, ProfileExplorerTreeItemType includeTypes)
            : this(profile.Name, "", null, includeTypes)
        {
            _item = profile;
            _itemType = ProfileExplorerTreeItemType.Profile;

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Monitor))
            {
                ProfileExplorerTreeItem monitors = new ProfileExplorerTreeItem("Monitors", profile.Monitors, this, includeTypes);
                if (monitors.HasChildren)
                {
                    Children.Add(monitors);
                }
            }

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Interface))
            {
                ProfileExplorerTreeItem interfaces = new ProfileExplorerTreeItem("Interfaces", profile.Interfaces, this, includeTypes);
                if (interfaces.HasChildren)
                {
                    Children.Add(interfaces);
                }
                profile.Interfaces.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Interfaces_CollectionChanged);
            }
        }
        private ProfileExplorerTreeItem(HeliosVisual visual, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(visual.Name, "", parent, includeTypes)
        {
            if (visual.GetType() == typeof(Monitor))
            {
                _itemType = ProfileExplorerTreeItemType.Monitor;
            }
            else if (visual.GetType() == typeof(HeliosPanel))
            {
                _itemType = ProfileExplorerTreeItemType.Panel;
            }
            else
            {
                _itemType = ProfileExplorerTreeItemType.Visual;
            }
            _item = visual;

            AddChild(visual, includeTypes);

            foreach (HeliosVisual child in visual.Children)
            {
                if ((child is HeliosPanel && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Panel)) ||
                    (child is HeliosVisual && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Visual)))
                {
                    Children.Add(new ProfileExplorerTreeItem(child, this, _includeTypes));
                }
            }

            visual.Children.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(VisualChildren_CollectionChanged);
        }
 private ProfileExplorerTreeItem(HeliosBinding item, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
     : this(item.Description, "", parent, includeTypes)
 {
     _item                 = item;
     _itemType             = ProfileExplorerTreeItemType.Binding;
     item.PropertyChanged += Binding_PropertyChanged;
 }
Ejemplo n.º 7
0
        private ProfileExplorerTreeItem(HeliosVisual visual, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(visual.Name, "", parent, includeTypes)
        {
            if (visual.GetType() == typeof(Monitor))
            {
                ItemType = ProfileExplorerTreeItemType.Monitor;
            }
            else if (visual.GetType() == typeof(HeliosPanel))
            {
                ItemType = ProfileExplorerTreeItemType.Panel;
            }
            else
            {
                ItemType = ProfileExplorerTreeItemType.Visual;
            }
            ContextItem = visual;

            AddChild(visual, includeTypes);

            foreach (HeliosVisual child in visual.Children)
            {
                if ((child is HeliosPanel && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Panel)) ||
                    (child != null && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Visual)))
                {
                    Children.Add(new ProfileExplorerTreeItem(child, this, _includeTypes));
                }
            }

            visual.Children.CollectionChanged += VisualChildren_CollectionChanged;
        }
        public ProfileExplorerTreeItem(HeliosProfile profile, ProfileExplorerTreeItemType includeTypes)
            : this(profile.Name, "", null, includeTypes)
        {
            _item     = profile;
            _itemType = ProfileExplorerTreeItemType.Profile;

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Monitor))
            {
                ProfileExplorerTreeItem monitors = new ProfileExplorerTreeItem("Monitors", profile.Monitors, this, includeTypes);
                if (monitors.HasChildren)
                {
                    Children.Add(monitors);
                }
            }

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Interface))
            {
                ProfileExplorerTreeItem interfaces = new ProfileExplorerTreeItem("Interfaces", profile.Interfaces, this, includeTypes);
                if (interfaces.HasChildren)
                {
                    Children.Add(interfaces);
                }
                profile.Interfaces.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Interfaces_CollectionChanged);
            }
        }
        void Actions_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.OldItems != null)
            {
                foreach (IBindingAction action in e.OldItems)
                {
                    if (action.Device.Length > 0)
                    {
                        ProfileExplorerTreeItem folder = GetFolder(action.Device);
                        folder.Children.Remove(GetChildObject(action));
                        if (folder.Children.Count == 0)
                        {
                            Children.Remove(folder);
                        }
                    }
                    else
                    {
                        Children.Remove(GetChildObject(action));
                    }
                }
            }

            if (e.NewItems != null)
            {
                foreach (IBindingAction action in e.NewItems)
                {
                    AddAction(action, _includeTypes);
                }
            }
        }
Ejemplo n.º 10
0
        public ProfileExplorerTreeItem(HeliosProfile profile, ProfileExplorerTreeItemType includeTypes)
            : this(profile.Name, "", null, includeTypes)
        {
            ContextItem = profile;
            ItemType    = ProfileExplorerTreeItemType.Profile;

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Monitor))
            {
                ProfileExplorerTreeItem monitors = new ProfileExplorerTreeItem("Monitors", profile.Monitors, this, includeTypes);
                if (monitors.HasChildren)
                {
                    Children.Add(monitors);
                }
                profile.Monitors.CollectionChanged += Monitors_CollectionChanged;
            }

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Interface))
            {
                ProfileExplorerTreeItem interfaces = new ProfileExplorerTreeItem("Interfaces", profile.Interfaces, this, includeTypes);
                if (interfaces.HasChildren)
                {
                    Children.Add(interfaces);
                }
                profile.Interfaces.CollectionChanged += Interfaces_CollectionChanged;
            }
        }
        private ProfileExplorerTreeItem(HeliosInterface heliosInterface, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(heliosInterface.Name, "", parent, includeTypes)
        {
            _itemType = ProfileExplorerTreeItemType.Interface;
            _item     = heliosInterface;

            AddChild(heliosInterface, includeTypes);
        }
 private ProfileExplorerTreeItem(string name, string description, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
 {
     _parent       = new WeakReference(parent);
     _name         = name;
     _description  = description;
     _itemType     = ProfileExplorerTreeItemType.Folder;
     _includeTypes = includeTypes;
     _children     = new ProfileExplorerTreeItemCollection();
 }
 private ProfileExplorerTreeItem(string name, HeliosInterfaceCollection interfaces, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
     : this(name, "", parent, includeTypes)
 {
     _itemType = ProfileExplorerTreeItemType.Folder;
     foreach (HeliosInterface heliosInterface in interfaces)
     {
         ProfileExplorerTreeItem item = new ProfileExplorerTreeItem(heliosInterface, this, includeTypes);
         Children.Add(item);
     }
 }
 private ProfileExplorerTreeItem(string name, MonitorCollection monitors, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
     : this(name, "", parent, includeTypes)
 {
     _itemType = ProfileExplorerTreeItemType.Folder;
     foreach (Monitor monitor in monitors)
     {
         ProfileExplorerTreeItem monitorItem = new ProfileExplorerTreeItem(monitor, this, includeTypes);
         Children.Add(monitorItem);
     }
 }
Ejemplo n.º 15
0
 private void LoadItems()
 {
     ProfileExplorerItems.Disconnect();
     ProfileExplorerItems.Clear();
     if (Profile != null)
     {                
         ProfileExplorerTreeItemType types = ProfileExplorerTreeItemType.Interface | ProfileExplorerTreeItemType.Monitor | ProfileExplorerTreeItemType.Panel;
         ProfileExplorerTreeItem item = new ProfileExplorerTreeItem(Profile, types);
         item.ExpandAll();
         ProfileExplorerItems = item.Children;
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// common code for handling collection changes to tree item collections that are represented as a named folder
        /// rather than just directly adding children under the current node
        ///
        /// this type of folder is not removed when empty
        /// </summary>
        /// <typeparam name="THeliosObject"></typeparam>
        /// <param name="folderName"></param>
        /// <param name="removedChildren"></param>
        /// <param name="addedChildren"></param>
        /// <param name="factory"></param>
        private void FolderContentsChanged <THeliosObject>(string folderName, IEnumerable removedChildren, IEnumerable addedChildren, Func <THeliosObject, ProfileExplorerTreeItem> factory)
        {
            bool newFolder = false;
            ProfileExplorerTreeItem childrenFolder;

            // lazy create folder
            if (HasFolder(folderName))
            {
                childrenFolder = GetFolder(folderName);
            }
            else
            {
                childrenFolder = new ProfileExplorerTreeItem(folderName, "", this, _includeTypes);
                newFolder      = true;
            }

            if (removedChildren != null)
            {
                foreach (THeliosObject removedChild in removedChildren)
                {
                    ProfileExplorerTreeItem childItem = childrenFolder.GetChildObject(removedChild);
                    if (childItem == null)
                    {
                        // not found
                        continue;
                    }

                    // remove from folder, but never remove the folder itself, as it is considered part of the UI
                    childItem.Disconnect();
                    childrenFolder.Children.Remove(childItem);
                }
            }

            if (addedChildren != null)
            {
                foreach (THeliosObject addedChild in addedChildren)
                {
                    ProfileExplorerTreeItem childItem = factory(addedChild);
                    childrenFolder.Children.Add(childItem);
                }
            }

            if (newFolder && childrenFolder.HasChildren)
            {
                Children.Add(childrenFolder);
            }
        }
        private ProfileExplorerTreeItem(IBindingTrigger item, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(item.TriggerName, item.TriggerDescription, parent, includeTypes)
        {
            _item     = item;
            _itemType = ProfileExplorerTreeItemType.Trigger;

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Binding))
            {
                foreach (HeliosBinding binding in item.Owner.OutputBindings)
                {
                    if (binding.Trigger == item)
                    {
                        Children.Add(new ProfileExplorerTreeItem(binding, this, includeTypes));
                    }
                }
                item.Source.OutputBindings.CollectionChanged += Bindings_CollectionChanged;
            }
        }
        void Interfaces_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            bool newFolder = false;
            ProfileExplorerTreeItem interfaces;

            if (HasFolder("Interfaces"))
            {
                interfaces = GetFolder("Interfaces");
            }
            else
            {
                interfaces = new ProfileExplorerTreeItem("Interfaces", "", this, _includeTypes);
                newFolder  = true;
            }

            if (e.OldItems != null)
            {
                foreach (HeliosInterface heliosInterface in e.OldItems)
                {
                    ProfileExplorerTreeItem child = interfaces.GetChildObject(heliosInterface);
                    if (child != null)
                    {
                        child.Disconnect();
                        interfaces.Children.Remove(child);
                    }
                }
            }

            if (e.NewItems != null)
            {
                foreach (HeliosInterface heliosInterface in e.NewItems)
                {
                    ProfileExplorerTreeItem childItem = new ProfileExplorerTreeItem(heliosInterface, this, _includeTypes);
                    interfaces.Children.Add(childItem);
                }
            }

            if (newFolder && interfaces.HasChildren)
            {
                Children.Add(interfaces);
            }
        }
        private ProfileExplorerTreeItem(IBindingAction item, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(item.ActionName, item.ActionDescription, parent, includeTypes)
        {
            _item     = item;
            _itemType = ProfileExplorerTreeItemType.Action;

            //SortName = item.Name + " " + item.ActionVerb;

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Binding))
            {
                foreach (HeliosBinding binding in item.Owner.InputBindings)
                {
                    if (binding.Action == item)
                    {
                        Children.Add(new ProfileExplorerTreeItem(binding, this, includeTypes));
                    }
                }
                item.Target.InputBindings.CollectionChanged += Bindings_CollectionChanged;
            }
        }
Ejemplo n.º 20
0
        void Interfaces_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            bool newFolder = false;
            ProfileExplorerTreeItem interfaces;
            if (HasFolder("Interfaces"))
            {
                interfaces = GetFolder("Interfaces");
            }
            else
            {
                interfaces = new ProfileExplorerTreeItem("Interfaces", "", this, _includeTypes);
                newFolder = true;
            }

            if (e.OldItems != null)
            {
                foreach (HeliosInterface heliosInterface in e.OldItems)
                {
                    ProfileExplorerTreeItem child = interfaces.GetChildObject(heliosInterface);
                    if (child != null)
                    {
                        child.Disconnect();
                        interfaces.Children.Remove(child);
                    }
                }
            }

            if (e.NewItems != null)
            {
                foreach (HeliosInterface heliosInterface in e.NewItems)
                {
                    ProfileExplorerTreeItem childItem = new ProfileExplorerTreeItem(heliosInterface, this, _includeTypes);
                    interfaces.Children.Add(childItem);
                }
            }

            if (newFolder && interfaces.HasChildren)
            {
                Children.Add(interfaces);
            }
        }
        public void AddAction(IBindingAction action, ProfileExplorerTreeItemType includeTypes)
        {
            ProfileExplorerTreeItem actionItem = new ProfileExplorerTreeItem(action, this, includeTypes);

            if (actionItem.HasChildren || includeTypes.HasFlag(ProfileExplorerTreeItemType.Action))
            {
                if (action.Device.Length > 0)
                {
                    if (!HasFolder(action.Device))
                    {
                        Children.Add(new ProfileExplorerTreeItem(action.Device, "", this, includeTypes));
                    }

                    ProfileExplorerTreeItem deviceItem = GetFolder(action.Device);
                    actionItem.Parent = deviceItem;
                    deviceItem.Children.Add(actionItem);
                }
                else
                {
                    Children.Add(actionItem);
                }
            }
        }
        private void AddTrigger(IBindingTrigger trigger, ProfileExplorerTreeItemType includeTypes)
        {
            ProfileExplorerTreeItem triggerItem = new ProfileExplorerTreeItem(trigger, this, includeTypes);

            if (triggerItem.HasChildren || includeTypes.HasFlag(ProfileExplorerTreeItemType.Trigger))
            {
                if (trigger.Device.Length > 0)
                {
                    if (!HasFolder(trigger.Device))
                    {
                        Children.Add(new ProfileExplorerTreeItem(trigger.Device, "", this, includeTypes));
                    }

                    ProfileExplorerTreeItem deviceItem = GetFolder(trigger.Device);
                    triggerItem.Parent = deviceItem;
                    deviceItem.Children.Add(triggerItem);
                }
                else
                {
                    Children.Add(triggerItem);
                }
            }
        }
Ejemplo n.º 23
0
        private static void LoadBindings(BindingsPanel p)
        {
            if (p.BindingObject != null)
            {
                if (p.BindingItems != null)
                {
                    p.BindingItems.Disconnect();
                }
                p.BindingItems = new ProfileExplorerTreeItemCollection();

                if (p.BindingType == BindingPanelType.Input)
                {
                    ProfileExplorerTreeItem inputBindings = new ProfileExplorerTreeItem(p.BindingObject, ProfileExplorerTreeItemType.Action | ProfileExplorerTreeItemType.Binding);
                    if (inputBindings.HasChildren)
                    {
                        foreach (ProfileExplorerTreeItem item in inputBindings.Children)
                        {
                            p.BindingItems.Add(item);
                        }
                    }
                }
                else if (p.BindingType == BindingPanelType.Output)
                {
                    ProfileExplorerTreeItem outputBindings = new ProfileExplorerTreeItem(p.BindingObject, ProfileExplorerTreeItemType.Trigger | ProfileExplorerTreeItemType.Binding);
                    if (outputBindings.HasChildren)
                    {
                        foreach (ProfileExplorerTreeItem item in outputBindings.Children)
                        {
                            p.BindingItems.Add(item);
                        }
                    }
                }
            }
            else
            {
                p.BindingItems = null;
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// common code for handling collection changes to tree item collections that are represented as folders with items,
        /// where the folder name is dependent on the item (such as devices and their commands/values)
        /// </summary>
        /// <typeparam name="THeliosObject"></typeparam>
        /// <param name="removedChildren"></param>
        /// <param name="addedChildren"></param>
        /// <param name="folderChooser">function that returns null if the item should not be in the tree, a folder name if the item goes in a folder, and an empty string if the item should go directly under the current node</param>
        /// <param name="addItemHandler">function to call for each new item, has to handle the folder creation</param>
        private void StructuredContentsChanged <THeliosObject>(IEnumerable removedChildren, IEnumerable addedChildren,
                                                               Func <THeliosObject, string> folderChooser, Action <THeliosObject, ProfileExplorerTreeItemType> addItemHandler)
        {
            if (removedChildren != null)
            {
                foreach (THeliosObject removedChild in removedChildren)
                {
                    string folderName = folderChooser(removedChild);
                    if (folderName == null)
                    {
                        // should not even be here
                        continue;
                    }

                    ProfileExplorerTreeItem childItem;
                    if (folderName.Length == 0)
                    {
                        childItem = GetChildObject(removedChild);
                        if (childItem == null)
                        {
                            // not found
                            continue;
                        }
                        Children.Remove(childItem);
                    }
                    else
                    {
                        ProfileExplorerTreeItem folder = GetFolder(folderName);
                        if (folder == null)
                        {
                            // folder not found
                            continue;
                        }

                        childItem = folder.GetChildObject(removedChild);
                        if (childItem == null)
                        {
                            // child not in folder
                            continue;
                        }
                        folder.Children.Remove(childItem);

                        if (folder.Children.Count == 0)
                        {
                            // remove empty
                            Children.Remove(folder);
                        }
                    }

                    // now handle child removed
                    childItem.Disconnect();
                }
            }

            if (addedChildren == null)
            {
                return;
            }

            foreach (THeliosObject addedChild in addedChildren)
            {
                // handler will do the folder creation, if any
                addItemHandler(addedChild, _includeTypes);
            }
        }
Ejemplo n.º 25
0
 private ProfileExplorerTreeItem(string name, HeliosInterfaceCollection interfaces, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
     : this(name, "", parent, includeTypes)
 {
     _itemType = ProfileExplorerTreeItemType.Folder;
     foreach (HeliosInterface heliosInterface in interfaces)
     {
         ProfileExplorerTreeItem item = new ProfileExplorerTreeItem(heliosInterface, this, includeTypes);
         Children.Add(item);
     }
 }
Ejemplo n.º 26
0
 private ProfileExplorerTreeItem(string name, string description, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
 {
     _parent = new WeakReference(parent);
     _name = name;
     _description = description;
     _itemType = ProfileExplorerTreeItemType.Folder;
     _includeTypes = includeTypes;
     _children = new ProfileExplorerTreeItemCollection();
 }
Ejemplo n.º 27
0
 private ProfileExplorerTreeItem(string name, MonitorCollection monitors, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
     : this(name, "", parent, includeTypes)
 {
     _itemType = ProfileExplorerTreeItemType.Folder;
     foreach (Monitor monitor in monitors)
     {
         ProfileExplorerTreeItem monitorItem = new ProfileExplorerTreeItem(monitor, this, includeTypes);
         Children.Add(monitorItem);
     }
 }
Ejemplo n.º 28
0
        private ProfileExplorerTreeItem(HeliosInterface heliosInterface, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(heliosInterface.Name, "", parent, includeTypes)
        {
            _itemType = ProfileExplorerTreeItemType.Interface;
            _item = heliosInterface;

            AddChild(heliosInterface, includeTypes);
        }
Ejemplo n.º 29
0
        private ProfileExplorerTreeItem(HeliosVisual visual, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(visual.Name, "", parent, includeTypes)
        {
            if (visual.GetType() == typeof(Monitor))
            {
                _itemType = ProfileExplorerTreeItemType.Monitor;
            }
            else if (visual.GetType() == typeof(HeliosPanel))
            {
                _itemType = ProfileExplorerTreeItemType.Panel;
            }
            else
            {
                _itemType = ProfileExplorerTreeItemType.Visual;
            }
            _item = visual;

            AddChild(visual, includeTypes);

            foreach (HeliosVisual child in visual.Children)
            {
                if ((child is HeliosPanel && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Panel)) ||
                    (child is HeliosVisual && _includeTypes.HasFlag(ProfileExplorerTreeItemType.Visual)))
                {
                    Children.Add(new ProfileExplorerTreeItem(child, this, _includeTypes));
                }
            }

            visual.Children.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(VisualChildren_CollectionChanged);
        }
Ejemplo n.º 30
0
        public void AddAction(IBindingAction action, ProfileExplorerTreeItemType includeTypes)
        {
            ProfileExplorerTreeItem actionItem = new ProfileExplorerTreeItem(action, this, includeTypes);
            if (actionItem.HasChildren || includeTypes.HasFlag(ProfileExplorerTreeItemType.Action))
            {
                if (action.Device.Length > 0)
                {
                    if (!HasFolder(action.Device))
                    {
                        Children.Add(new ProfileExplorerTreeItem(action.Device, "", this, includeTypes));
                    }

                    ProfileExplorerTreeItem deviceItem = GetFolder(action.Device);
                    actionItem.Parent = deviceItem;
                    deviceItem.Children.Add(actionItem);
                }
                else
                {
                    Children.Add(actionItem);
                }
            }
        }
Ejemplo n.º 31
0
        private ProfileExplorerTreeItem(IBindingAction item, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(item.ActionName, item.ActionDescription, parent, includeTypes)
        {
            _item = item;
            _itemType = ProfileExplorerTreeItemType.Action;

            //SortName = item.Name + " " + item.ActionVerb;

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Binding))
            {

                foreach (HeliosBinding binding in item.Owner.InputBindings)
                {
                    if (binding.Action == item)
                    {
                        Children.Add(new ProfileExplorerTreeItem(binding, this, includeTypes));
                    }
                }
                item.Target.InputBindings.CollectionChanged += Bindings_CollectionChanged;                
            }
        }
Ejemplo n.º 32
0
        void Bindings_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.OldItems != null)
            {
                foreach (HeliosBinding binding in e.OldItems)
                {
                    ProfileExplorerTreeItem child = GetChildObject(binding);
                    if (child != null)
                    {
                        child.Disconnect();
                        Children.Remove(child);
                    }
                }
            }

            if (e.NewItems != null)
            {
                foreach (HeliosBinding child in e.NewItems)
                {
                    if (child.Action == ContextItem || child.Trigger == ContextItem)
                    {
                        ProfileExplorerTreeItem childItem = new ProfileExplorerTreeItem(child, this, _includeTypes);
                        if (_includeTypes.HasFlag(ProfileExplorerTreeItemType.Binding))
                        {
                            IsExpanded = true;
                            Children.Add(childItem);
                        }
                    }
                }
            }
        }
Ejemplo n.º 33
0
        private ProfileExplorerTreeItem(IBindingTrigger item, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
            : this(item.TriggerName, item.TriggerDescription, parent, includeTypes)
        {
            _item = item;
            _itemType = ProfileExplorerTreeItemType.Trigger;

            if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Binding))
            {
                foreach (HeliosBinding binding in item.Owner.OutputBindings)
                {
                    if (binding.Trigger == item)
                    {
                        Children.Add(new ProfileExplorerTreeItem(binding, this, includeTypes));
                    }
                }
                item.Source.OutputBindings.CollectionChanged += Bindings_CollectionChanged;
            }
        }
Ejemplo n.º 34
0
 private ProfileExplorerTreeItem(HeliosBinding item, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes)
     : this(item.Description, "", parent, includeTypes)
 {
     _item = item;
     _itemType = ProfileExplorerTreeItemType.Binding;
     item.PropertyChanged += Binding_PropertyChanged;
 }
Ejemplo n.º 35
0
        private void AddTrigger(IBindingTrigger trigger, ProfileExplorerTreeItemType includeTypes)
        {

            ProfileExplorerTreeItem triggerItem = new ProfileExplorerTreeItem(trigger, this, includeTypes);
            if (triggerItem.HasChildren || includeTypes.HasFlag(ProfileExplorerTreeItemType.Trigger))
            {
                if (trigger.Device.Length > 0)
                {
                    if (!HasFolder(trigger.Device))
                    {
                        Children.Add(new ProfileExplorerTreeItem(trigger.Device, "", this, includeTypes));
                    }

                    ProfileExplorerTreeItem deviceItem = GetFolder(trigger.Device);
                    triggerItem.Parent = deviceItem;
                    deviceItem.Children.Add(triggerItem);
                }
                else
                {
                    Children.Add(triggerItem);
                }
            }
        }