Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                _service                 = new VimService();
                _service.Url             = vurl;
                _svcRef                  = new ManagedObjectReference();
                _svcRef.type             = "ServiceInstance";
                _svcRef.Value            = "ServiceInstance";
                _service.CookieContainer = new System.Net.CookieContainer();
                CreateServiceRef("ServiceInstance");
                _sic        = _service.RetrieveServiceContent(_svcRef);
                _propCol    = _sic.propertyCollector;
                _rootFolder = _sic.rootFolder;

                Extension ext = new Extension();
                ext.key = "com.virtualizeplanet." + comboBox2.SelectedItem.ToString();
                //sdsd

                if (_sic.sessionManager != null)
                {
                    _service.Login(_sic.sessionManager, vusername, vpassword, null);
                    ManagedObjectReference extMgrMof = _sic.extensionManager;
                    _service.UnregisterExtension(extMgrMof, ext.key);
                }
                int c2index = comboBox2.SelectedIndex;
                comboBox2.Items.RemoveAt(c2index);
                comboBox2.Text = "";
                MessageBox.Show("Done");
            }
            catch
            {
                MessageBox.Show("Something may have gone wrong");
            }
        }