public ApplicationEventFilterControl()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            _filter = new ApplicationEventFilter();

            filterTreeView.ImageList = filterImageList;

            createTreeView(filterTreeView, null);

            filterTreeView.KeyDown += filterTreeView_KeyDown;
            filterTreeView.KeyUp += filterTreeView_KeyUp;

            //filter view
            filterView = new FilterViewControl();
            filterView.Left = filterSplitter.Right;
            filterView.Height = filterPropertyGrid.Top;
            filterView.Width = Width - filterSplitter.Width - filterTreeView.Width;
            filterView.Top = 0;
            filterView.Dock = DockStyle.Fill;
            panel2.Controls.Add(filterView);
        }
        private void parseType(
            Type type,
            string propertyPath,
            TreeNode node,
            ApplicationEventFilter sourceFilter)
        {
            //Type type = parseObject.GetType();
            //TreeNode result = new TreeNode(type.Name);

            string pathRoot = propertyPath;

            foreach (PropertyInfo pi in type.GetProperties())
            {
                var childNode = new TreeNode(pi.Name);

                propertyPath = pathRoot;

                if (!pi.PropertyType.IsValueType && pi.PropertyType != typeof (String) &&
                    pi.PropertyType != typeof (object))
                {
                    propertyPath += pi.Name + ".";
                    parseType(pi.PropertyType, propertyPath, childNode, sourceFilter);
                    // Those are not for filtering onto
                    childNode.ImageIndex = 3;
                }
                else
                {
                    // Those to enable and disable and setup filters

                    // The long way with entry candidate is choosen in order to spare duplicate iteration
                    // via the filters collection.
                    FilterEntry entryCandidate = null;

                    string currentPath = propertyPath + pi.Name;

                    if (sourceFilter != null) entryCandidate = sourceFilter.FilterEntries[currentPath];
                    //
                    if (entryCandidate == null)
                    {
                        entryCandidate = new FilterEntry(currentPath);
                        _filter.FilterEntries.Add(entryCandidate);
                    }

                    childNode.ImageIndex = (entryCandidate.Enabled == false) ? 1 : 2;

                    propertyPath = pathRoot;

                    childNode.Tag = entryCandidate;
                }

                node.Nodes.Add(childNode);
            }
        }
 private void createTreeView(TreeView treeview, ApplicationEventFilter sourceFilter)
 {
     filterTreeView.Nodes.Clear();
     var node = new TreeNode(typeof (TraceEvent).Name);
     node.ImageIndex = 4;
     filterTreeView.Nodes.Add(node);
     parseType(typeof (TraceEvent), typeof (TraceEvent).Name + "::", node, sourceFilter);
     filterTreeView.ExpandAll();
 }
        private void loadFromFileMenuItem_Click(object sender, EventArgs e)
        {
            // Example: "Text files (*.txt)|*.txt|All files (*.*)|*.*"
            openFileDialog1.DefaultExt = "xml";
            openFileDialog1.Filter = "Xml files (*.xml)|*.xml|All files (*.*)|*.*";

            DialogResult dr = openFileDialog1.ShowDialog();
            if (dr == DialogResult.Cancel) return;
            if (openFileDialog1.FileName != null || openFileDialog1.FileName != String.Empty)
            {
                try
                {
                    _filter =
                        (ApplicationEventFilter) SerializationUtility.DeserializeFromFile
                                                     (
                                                     openFileDialog1.FileName,
                                                     typeof (ApplicationEventFilter)
                                                     );
                    // updateConfigurationGui();
                    // temp placement
                    createTreeView(filterTreeView, _filter);
                    textBox1.Text = openFileDialog1.FileName;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Probably not a valid TraceEventFilter Document! " + ex);
                }
            }
        }
Example #5
0
 private void setGuiFromWorkspaceConfiguration()
 {
     reAssignOnChangeHandler(eventFilter, workspaceConfiguration.Filter);
     eventFilter = workspaceConfiguration.Filter;
     observerConnectionsControl.Connections = workspaceConfiguration.ObserverConnections;
     eventTracerControl.TracingOptions = workspaceConfiguration.TracingOptions;
     eventTracerControl.KeyPointers = workspaceConfiguration.KeyPointers;
 }