Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if ( (uxTxtBox_Hostname.Text == string.Empty) ||
                 (uxTxtBox_Username.Text == string.Empty) ||
                 (uxTxtBox_Password.Text == string.Empty) )
            {
                MessageBox.Show("Hostname, Username and Password must be set to view the namespaces");
            }
            else
            {
            //                try
                {
                    WbemClient tmpWC = new WbemClient(uxTxtBox_Hostname.Text, uxTxtBox_Username.Text, uxTxtBox_Password.Text, "Interop");
                    NamespaceForm nsForm = new NamespaceForm(tmpWC.EnumerateNamespaces());

                    if (nsForm.ShowDialog() == DialogResult.OK)
                    {
                        uxTxtBox_Namespace.Text = nsForm.SelectedNamespace;
                    }
                }
                //catch (Exception ex)
                //{
                //    MessageBox.Show(ex.Message);
                //}
            }
        }
Example #2
0
        private void changeNamespaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NamespaceForm nsForm = new NamespaceForm(mainWbemClient.EnumerateNamespaces());

            if (nsForm.ShowDialog() == DialogResult.OK)
            {
                WbemClient oldwc = mainWbemClient;
                mainWbemClient = new WbemClient(mainWbemClient.Hostname,
                                                mainWbemClient.Username,
                                                mainWbemClient.Password,
                                                nsForm.SelectedNamespace);

                try
                {
                    ResetListViews();

                    DisplayList(mainWbemClient.EnumerateClassHierarchy());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Invalid login");
                    mainWbemClient = oldwc;
                }
            }
        }