예제 #1
0
        public ConfigurationTreeItem(string name, Func<IConfigurationControl> controlFactory, ConfigurationTreeItem parent, ConfigurationManager configManager)
        {
            Name = name;
            ControlFactory = controlFactory;
            Parent = parent;
            ConfigManager = configManager;
            InternalChildren = new List<ConfigurationTreeItem>();
            Children = new ReadOnlyCollection<ConfigurationTreeItem>(InternalChildren);

            if (Parent != null) {
                Parent.InternalChildren.Add(this);
            }

            if (ControlFactory != null) {
                CreateConfigurationControl();
            }
        }
예제 #2
0
        public ConfigurationTreeItem CreateConfigurationTreeRoot()
        {
            ConfigurationTreeItem rootItem = new ConfigurationTreeItem("Configuration", null, null, this);

            // NOTE: get names of the first gateway and processor component
            // as we assume there is only one gateway and one processor
            string gatewayName = Configuration.GetComponentElements(ComponentType.Gateway)
                .Element("gateway").Attribute("name").Value;
            string processorName = Configuration.GetComponentElements(ComponentType.Processor)
                .Element("processor").Attribute("name").Value;

            ConfigurationTreeItem gatewayItem = new ConfigurationTreeItem("Gateway",
                () => new GatewayConfigurationControl(gatewayName), rootItem, this);
            ConfigurationTreeItem processorItem = new ConfigurationTreeItem("Processor",
                () => new ProcessorConfigurationControl(processorName), rootItem, this);
            ConfigurationTreeItem mesageflowItem = new ConfigurationTreeItem("Message flow",
                () => new MessageflowConfigurationControl(), rootItem, this);

            return rootItem;
        }
예제 #3
0
        private void uiConfigurationTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            uiConfigurationContainer.Content = null;
            currentConfigurationControl = null;
            if (e.NewValue == null)
            {
                return;
            }

            currentConfigurationTreeItem = (ConfigurationTreeItem)((TreeViewItem)e.NewValue).Tag;
            currentConfigurationControl = currentConfigurationTreeItem.ConfigurationControl;
            uiConfigurationContainer.Content = currentConfigurationControl;
        }
예제 #4
0
 private TreeViewItem CreateUIItem(ConfigurationTreeItem item)
 {
     TreeViewItem uiItem = new TreeViewItem
     {
         Tag = item,
         Header = item.Name
     };
     foreach (var child in item.Children)
     {
         TreeViewItem uiChild = CreateUIItem(child);
         uiItem.Items.Add(uiChild);
     }
     return uiItem;
 }