private void BrowseBTN_Click(object sender, EventArgs e)
        {
            try
            {
                Browser browser = new Browser(m_browser.Session);

                browser.BrowseDirection = BrowseDirection.Forward;
                browser.NodeClassMask   = (int)NodeClass.View | (int)NodeClass.Object;
                browser.ReferenceTypeId = ReferenceTypeIds.Organizes;
                browser.IncludeSubtypes = true;

                ReferenceDescription reference = new SelectNodeDlg().ShowDialog(browser, Objects.ViewsFolder);

                if (reference != null)
                {
                    if (reference.NodeClass != NodeClass.View)
                    {
                        MessageBox.Show("Please select a valid view node id.", this.Text);
                        return;
                    }

                    ViewIdTB.Text = Utils.Format("{0}", reference.NodeId);
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
        private void SelectNodeMI_Click(object sender, EventArgs e)
        {
            try
            {
                ReferenceDescription reference = new SelectNodeDlg().ShowDialog(m_browser, ObjectTypes.BaseEventType);

                if (reference != null)
                {
                    Node node = m_session.NodeCache.Find(reference.NodeId) as Node;

                    if (node == null)
                    {
                        return;
                    }

                    ContentFilterElement element = null;

                    // build the relative path.
                    QualifiedNameCollection browsePath = new QualifiedNameCollection();
                    NodeId typeId = m_session.NodeCache.BuildBrowsePath(node, browsePath);

                    switch (node.NodeClass)
                    {
                    case NodeClass.Variable:
                    {
                        IVariable variable = node as IVariable;

                        if (variable == null)
                        {
                            break;
                        }

                        // create attribute operand.
                        SimpleAttributeOperand attribute = new SimpleAttributeOperand(
                            m_session.FilterContext,
                            typeId,
                            browsePath);

                        // create default value.
                        object value = GuiUtils.GetDefaultValue(variable.DataType, variable.ValueRank);

                        // create attribute filter.
                        element = m_filter.Push(FilterOperator.Equals, attribute, value);
                        break;
                    }

                    case NodeClass.Object:
                    {
                        // create attribute operand.
                        SimpleAttributeOperand attribute = new SimpleAttributeOperand(
                            m_session.FilterContext,
                            typeId,
                            browsePath);

                        attribute.AttributeId = Attributes.NodeId;

                        // create attribute filter.
                        element = m_filter.Push(FilterOperator.IsNull, attribute);
                        break;
                    }

                    case NodeClass.ObjectType:
                    {
                        element = m_filter.Push(FilterOperator.OfType, node.NodeId);
                        break;
                    }

                    default:
                    {
                        throw new ArgumentException("Selected an invalid node.");
                    }
                    }

                    // add element.
                    if (element != null)
                    {
                        AddItem(element);
                        AdjustColumns();
                    }
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }