SCSM.AzureAutomation.WPF.Connector.AzureAutomationWizardData.UpdateConnectorInstance C# (CSharp) Method

UpdateConnectorInstance() private method

private UpdateConnectorInstance ( ) : void
return void
        private void UpdateConnectorInstance()
        {
            //Get the server name to connect to and connect
            String strServerName = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\System Center\\2010\\Service Manager\\Console\\User Settings", "SDKServiceMachine", "localhost").ToString();
            EnterpriseManagementGroup emg = new EnterpriseManagementGroup(strServerName);

            //Get the Connectors MP and AA Connector Class
            ManagementPack mpConnectors = emg.GetManagementPack("SCSM.AzureAutomation", null, new Version("1.0.0.0"));
            ManagementPackClass classAAConnector = mpConnectors.GetClass("SCSM.AzureAutomation.Connector");

            //Get the Connector object using the object ID
            EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject<EnterpriseManagementObject>(this.EnterpriseManagementObjectID, ObjectQueryOptions.Default);

            //Set the property values to the new values
            emoAAConnector[classAAConnector, "DisplayName"].Value = this.DisplayName;
            emoAAConnector[classAAConnector, "AutomationAccount"].Value = this.AutomationAccount;
            emoAAConnector[classAAConnector, "SubscriptionID"].Value = this.SubscriptionID;
            emoAAConnector[classAAConnector, "ResourceGroup"].Value = this.ResourceGroup;
            emoAAConnector[classAAConnector, "RunAsAccountName"].Value = this.RunAsAccountName;
            emoAAConnector[classAAConnector, "RunAsAccountPassword"].Value = this.RunAsAccountPassword;

            //Update Connector instance
            emoAAConnector.Commit();

            mpConnectors.AcceptChanges();
        }