Пример #1
0
        //--------------------------------------------------------------------------------
        // Shows the search form to the user.  If the search form has been disposed of,
        // then this method will create a new search form.
        //--------------------------------------------------------------------------------
        private void SearchMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.searchForm == null)
                {
                    this.searchForm = new SearchForm2(this);
                    this.searchForm.AddNamespaces(this.NamespaceList);
                }

                this.searchForm.BringToFront();
                this.searchForm.Visible = true;
            }
            catch (System.ObjectDisposedException)
            {
                this.searchForm = new SearchForm2(this);
                this.searchForm.AddNamespaces(this.NamespaceList);
                this.searchForm.Visible = true;
            }
        }
Пример #2
0
        //-------------------------------------------------------------------------
        // Default constructor for the WMIScripter form.
        //
        //-------------------------------------------------------------------------
        public WMIScripter()
        {
            // Generates the start-up screen.
            StartupScreenForm.ShowStartupScreen();

            InitializeComponent();

            // Creates the window for the target computer information.
            this.TargetWindow = new TargetComputerWindow(this);
            this.TargetWindow.Visible = false;

            this.NamespaceList = new ArrayList();
            this.AddNamespacesToListRecursive("root");
            this.NamespaceList.Sort();

            this.QueryCtrl = new QueryControl2(this);
            this.QueryCtrl.AddNamespaces(this.NamespaceList);
            this.QueryCtrl.SetNamespace("root\\cimv2");

            this.EventCtrl = new EventControl2(this);
            this.EventCtrl.AddNamespaces(this.NamespaceList);

            this.MethodCtrl = new MethodControl2(this);
            this.MethodCtrl.AddNamespaces(this.NamespaceList);

            this.ExploreWmiCtrl = new ExploreWmiControl(this);
            this.ExploreWmiCtrl.AddNamespaces(this.NamespaceList);

            this.searchForm = new SearchForm2(this);
            this.searchForm.AddNamespaces(this.NamespaceList);
            this.searchForm.Visible = false;

            this.Controls.Add(this.QueryCtrl);
            this.Controls[0].Dock = DockStyle.Fill;
            this.Controls.Add(this.MethodCtrl);
            this.Controls[1].Dock = DockStyle.Fill;
            this.Controls.Add(this.EventCtrl);
            this.Controls[2].Dock = DockStyle.Fill;
            this.Controls.Add(this.ExploreWmiCtrl);
            this.Controls[3].Dock = DockStyle.Fill;

            this.Controls["QueryControl2"].Visible = true;
            this.Controls["MethodControl2"].Visible = false;
            this.Controls["EventControl2"].Visible = false;
            this.Controls["ExploreWmiControl"].Visible = false;
            this.QueryMenuItem.Checked = true;

            this.selectedLanguage = VBSCRIPT;

            StartupScreenForm.CloseForm();
        }