예제 #1
0
        public WizardResult EditProjectConnector(IDataItem item)
        {
            try
            {
                WizardStory wizard = new WizardStory();
                wizard.WizardWindowTitle = ServiceManagerLocalization.GetStringFromManagementPack("strEditConnector");
                ProjectConnectorData data = new ProjectConnectorData(item);

                //setup wizard
                data.WizardMode   = WizardMode.Wizard;
                wizard.WizardData = data;

                //add the wizard pages here...
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strGeneral"), typeof(GeneralWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strPWAConnectionPage"), typeof(PWAWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strSchedulePage"), typeof(ScheduleWizardPage), wizard.WizardData));

                PropertySheetDialog psd = new PropertySheetDialog(wizard);

                //window properties
                psd.ShowInTaskbar         = true;
                psd.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
                psd.Icon = BitmapFrame.Create(System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Microsoft.EnterpriseManagement.ServiceManager.ProjectServer.ConsoleTasks;component/Icons/Image.Cireson.16x16.ico", UriKind.RelativeOrAbsolute)).Stream);
                psd.ShowDialog();
                return(data.WizardResult);
            }
            catch (Exception ex)
            {
                ConsoleContextHelper.Instance.ShowErrorDialog(ex, string.Empty, ConsoleJobExceptionSeverity.Error);
                return(WizardResult.Failed);
            }
        }
        public override void ExecuteCommand(IList <NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection <string> parameters)
        {
            /*
             * This GUID is generated automatically when  you import the Management Pack with the singleton admin setting class in it.
             * You can get this GUID by running a query like:
             * Select BaseManagedEntityID, FullName from BaseManagedEntity where FullName like '%<enter your class ID here>%'
             * where the GUID you want is returned in the BaseManagedEntityID column in the result set
             */
            String strSingletonBaseManagedObjectID = "4AD8DC00-2333-93D6-5EB4-D372A42DEA7B";

            //Get the server name to connect to and connect to the server
            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 Object using the GUID from above - since this is a singleton object we can get it by GUID
            EnterpriseManagementObject emoIncidentSLASettings = emg.EntityObjects.GetObject <EnterpriseManagementObject>(new Guid(strSingletonBaseManagedObjectID), ObjectQueryOptions.Default);

            //Create a new "wizard" (also used for property dialogs as in this case), set the title bar, create the data, and add the pages
            WizardStory wizard = new WizardStory();

            wizard.WizardWindowTitle = "Edit Incident SLA Settings";
            WizardData data = new IncidentSLASettingsWizardData(emoIncidentSLASettings, emg);

            wizard.WizardData = data;
            wizard.AddLast(new WizardStep("Configuration", typeof(Settings), wizard.WizardData));

            //Show the property page
            PropertySheetDialog wizardWindow = new PropertySheetDialog(wizard);

            wizardWindow.ShowDialog();
        }
예제 #3
0
 public override void ExecuteCommand(IList <NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection <string> parameters)
 {
     try
     {
         EnterpriseManagementGroup emg = ConsoleContext.GetConsoleEMG();
         // (Cireson.ProjectAutomation.Library) (Microsoft.SystemCenter.Connector.ProjectServer.Settings) (5a49b80c-4c34-d189-ca94-a591580f1995)
         ManagementPackClass        mpcSettings = emg.EntityTypes.GetClass(new Guid("5a49b80c-4c34-d189-ca94-a591580f1995"));                           //get the settings class.
         EnterpriseManagementObject emoSettings = emg.EntityObjects.GetObject <EnterpriseManagementObject>(mpcSettings.Id, ObjectQueryOptions.Default); //get the settings class instance.
         //somewhere here we will have a container for our class data to feed the consoleWizard obj.
         AdminSettingsData admData       = new AdminSettingsData(emoSettings);
         WizardStory       consoleWizard = new WizardStory();
         consoleWizard.WizardData = admData;
         consoleWizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strGroomingSettings"), typeof(AdminSettingsGroomingForm), admData));
         consoleWizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strStatusSettings"), typeof(AdminSettingsStatusForm), admData));
         consoleWizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strProjectTasksSettings"), typeof(AdminSettingsProjectTasksForm), admData));
         consoleWizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strProjectLicensingSettings"), typeof(AdminSettingsLicensingForm), admData));
         PropertySheetDialog propertyDialog = new PropertySheetDialog(consoleWizard);
         propertyDialog.Width  = 800;
         propertyDialog.Height = 700;
         propertyDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         propertyDialog.Title         = ServiceManagerLocalization.GetStringFromManagementPack("strSettings");
         propertyDialog.ShowInTaskbar = true;
         propertyDialog.Icon          = BitmapFrame.Create(System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Microsoft.EnterpriseManagement.ServiceManager.ProjectServer.ConsoleTasks;component/Icons/Image.Cireson.16x16.ico", UriKind.RelativeOrAbsolute)).Stream);
         propertyDialog.ShowDialog();
     }
     catch (Exception ex)
     {
         ConsoleContextHelper.Instance.ShowErrorDialog(ex, string.Empty, ConsoleJobExceptionSeverity.Error);
     }
 }
예제 #4
0
        public static bool?LaunchDialog(String strWindowTitle, ref IDataItem dataitemMessageType, ref IDataItem dataItemIncidentStatus, out String strMessage, out Boolean boolAddToActionLog)
        {
            WizardStory         wizardStory = new WizardStory();
            SendEmailWizardData wizardData  = new SendEmailWizardData();

            wizardStory.WizardData = wizardData;
            wizardStory.AddLast(new WizardStep(strWindowTitle, typeof(SendEmailForm), wizardStory.WizardData));
            TabbedPropertySheetDialog propertyDialog = new TabbedPropertySheetDialog(wizardStory);

            propertyDialog.Width     = 350;
            propertyDialog.Height    = 350;
            propertyDialog.MinWidth  = 350;
            propertyDialog.MinHeight = 350;

            propertyDialog.ResizeMode = ResizeMode.CanResizeWithGrip;
            propertyDialog.Title      = strWindowTitle;
            wizardData.IncidentStatus = dataItemIncidentStatus;
            wizardData.AddToActionLog = true;
            bool?result = propertyDialog.ShowDialog();

            strMessage             = wizardData.Message;
            dataitemMessageType    = wizardData.MessageType;
            dataItemIncidentStatus = wizardData.IncidentStatus;
            boolAddToActionLog     = wizardData.AddToActionLog;
            return(result);
        }
예제 #5
0
        public override void ExecuteCommand(IList <NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection <string> parameters)
        {
            /*
             * This GUID is generated automatically when you import the Management Pack with the singleton admin setting class in it.
             * You can get this GUID by running a query like:
             * Select BaseManagedEntityID, FullName where FullName like ‘%<enter your class ID here>%’
             * where the GUID you want is returned in the BaseManagedEntityID column in the result set
             */
            /*In this above example I imported the MP, and then used:
             *  Select BaseManagedEntityID, FullName
             *  From BaseManagedEntity
             *  where FullName like 'AdhocAdam%'
             * against the ServiceManager DB to figure out the following strSingletonBaseManagedObjectID. Per
             * https://blogs.technet.microsoft.com/servicemanager/2011/05/26/getting-management-pack-elements-using-the-sdk/
             * the id is always unique and never changes as its based on the MP ID, Element Names, and the key token.
             */

            String strSingletonBaseManagedObjectID = "49a053e7-6080-e211-fd79-ca3607eecce7";

            //Get the server name to connect to and connect to the server
            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 Object using the GUID from above – since this is a singleton object we can get it by GUID
            EnterpriseManagementObject emoAdminSetting = emg.EntityObjects.GetObject <EnterpriseManagementObject>(new Guid(strSingletonBaseManagedObjectID), ObjectQueryOptions.Default);

            //Create a new "wizard" (also used for property dialogs as in this case), set the title bar, create the data, and add the pages
            WizardStory wizard = new WizardStory();

            wizard.WizardWindowTitle = "AdhocAdam - Advanced Action Log Notifier";
            WizardData data = new AdminSettingWizardData(emoAdminSetting);

            wizard.WizardData = data;
            wizard.AddLast(new WizardStep("General", typeof(AdminSettingsForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("Azure", typeof(AzureSettingsForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("About", typeof(AboutForm), wizard.WizardData));

            //Show the property page
            PropertySheetDialog wizardWindow = new PropertySheetDialog(wizard);

            //Update the view when done so the new values are shown
            bool?dialogResult = wizardWindow.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value)
            {
                RequestViewRefresh();
            }
        }
예제 #6
0
        public ProjectConnectorData CreateProjectConnector()
        {
            try
            {
                WizardStory wizard = new WizardStory();
                //set the SCSM default connector icon here...
                wizard.WizardWindowTitle = ServiceManagerLocalization.GetStringFromManagementPack("strCreateConnector");
                ProjectConnectorData data = new ProjectConnectorData();

                //set the data.
                data.WizardMode   = WizardMode.Wizard;
                wizard.WizardData = data;

                //pages
                //add the connector setup pages here.
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strGeneral"), typeof(GeneralWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strPWAConnectionPage"), typeof(PWAWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strSchedulePage"), typeof(ScheduleWizardPage), wizard.WizardData));
                wizard.AddLast(new WizardStep(ServiceManagerLocalization.GetStringFromManagementPack("strResults"), typeof(ResultsWizardPage), wizard.WizardData));

                WizardWindow wizardWindow = new WizardWindow(wizard);
                ElementHost.EnableModelessKeyboardInterop(wizardWindow);

                //window properties
                wizardWindow.ShowInTaskbar         = true;
                wizardWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
                wizardWindow.Icon = BitmapFrame.Create(System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Microsoft.EnterpriseManagement.ServiceManager.ProjectServer.ConsoleTasks;component/Icons/Image.Cireson.16x16.ico", UriKind.RelativeOrAbsolute)).Stream);
                wizardWindow.ShowDialog();
                return(data);
            }
            catch (Exception ex)
            {
                ConsoleContextHelper.Instance.ShowErrorDialog(ex, string.Empty, ConsoleJobExceptionSeverity.Error);
                return(null);
            }
        }
        public override void ExecuteCommand(IList<NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection<string> parameters)
        {
            if (parameters.Contains("Create"))
            {
                WizardStory wizard = new WizardStory();

                //set the icon and title bar
                ResourceManager rm = new ResourceManager("SCSM.Azureautomation.WPF.Connector.Resources", typeof(Resources).Assembly);
                Bitmap bitmap = (Bitmap)rm.GetObject("AzureAutomation2x32");
                IntPtr ptr = bitmap.GetHbitmap();
                BitmapSource bitmapsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                wizard.StoryImage = bitmapsource;
                wizard.WizardWindowTitle = "Create Azure Automation Connector";

                WizardData data = new AzureAutomationWizardData();
                wizard.WizardData = data;

                //add th pages
                wizard.AddLast(new WizardStep("Welcome", typeof(AzureAutomationWelcomePage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Summary", typeof(AzureAutomationSummaryPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Results", typeof(AzureAutomationResultPage), wizard.WizardData));

                //Create a wizard window and show it
                WizardWindow wizardwindow = new WizardWindow(wizard);
                // this is needed so that WinForms will pass messages on to the hosted WPF control
                System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(wizardwindow);
                wizardwindow.ShowDialog();

                //Update the view when done with the wizard so that the new connector shows
                if (data.WizardResult == WizardResult.Success)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Edit"))
            {
                //Get the server name to connect to and connect to the server
                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 object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject<EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                //Create a new "wizard" (also used for property dialogs as in this case), set the title bar, create the data, and add the pages
                WizardStory wizard = new WizardStory();
                wizard.WizardWindowTitle = "Edit Azure Automation Connector";
                WizardData data = new AzureAutomationWizardData(emoAAConnector);
                wizard.WizardData = data;
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));

                //Show the property page
                PropertySheetDialog wizardWindow = new PropertySheetDialog(wizard);

                //Update the view when done so the new values are shown
                bool? dialogResult = wizardWindow.ShowDialog();
                if (dialogResult.HasValue && dialogResult.Value)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Delete") || parameters.Contains("Disable") || parameters.Contains("Enable"))
            {
                //Get the server name to connect to and create a connection
                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 object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject<EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                if (parameters.Contains("Delete"))
                {
                    //Remove the object from the database
                    IncrementalDiscoveryData idd = new IncrementalDiscoveryData();
                    idd.Remove(emoAAConnector);
                    idd.Commit(emg);
                }

                //Get the rule using the connector ID
                ManagementPack mpConnectors = emg.GetManagementPack("SCSM.AzureAutomation", null, new Version("1.0.0.0"));
                ManagementPackClass classAAConnector = mpConnectors.GetClass("SCSM.AzureAutomation.Connector");
                String strConnectorID = emoAAConnector[classAAConnector, "Id"].ToString();
                ManagementPackRule ruleConnector = mpConnectors.GetRule(strConnectorID);

                //Update the Enabled property or delete as appropriate
                if (parameters.Contains("Delete"))
                {
                    ruleConnector.Status = ManagementPackElementStatus.PendingDelete;
                }
                else if (parameters.Contains("Disable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = false;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@false;
                    ruleConnector.Status = ManagementPackElementStatus.PendingUpdate;
                }
                else if (parameters.Contains("Enable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = true;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@true;
                    ruleConnector.Status = ManagementPackElementStatus.PendingUpdate;
                }

                //Commit the changes to the connector object and rule
                emoAAConnector.Commit();
                mpConnectors.AcceptChanges();

                //Update the view when done so the item is either removed or the updated Enabled value shows
                RequestViewRefresh();
            }
        }
        public override void ExecuteCommand(IList <NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection <string> parameters)
        {
            /*
             * This GUID is generated automatically when you import the Management Pack with the singleton admin setting class in it.
             * You can get this GUID by running a query like:
             * Select BaseManagedEntityID, FullName where FullName like ‘%<enter your class ID here>%’
             * where the GUID you want is returned in the BaseManagedEntityID column in the result set
             */
            /*In this above example I imported the MP, and then used:
             *  Select BaseManagedEntityID, FullName
             *  From BaseManagedEntity
             *  where FullName like 'SMLets%'
             * against the ServiceManager DB to figure out the following strSingletonBaseManagedObjectID. Per
             * https://blogs.technet.microsoft.com/servicemanager/2011/05/26/getting-management-pack-elements-using-the-sdk/
             * the id is always unique and never changes as its based on the MP ID, Element Names, and the key token.
             */

            String strSingletonBaseManagedObjectID = "a0022e87-75a8-65ee-4581-d923ff06a564";

            //Get the server name to connect to and connect to the server
            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 Object using the GUID from above – since this is a singleton object we can get it by GUID
            EnterpriseManagementObject emoAdminSetting = emg.EntityObjects.GetObject <EnterpriseManagementObject>(new Guid(strSingletonBaseManagedObjectID), ObjectQueryOptions.Default);

            //Get the SMLets Exchange Connector MP
            ManagementPack smletsMP = emg.ManagementPacks.GetManagementPack(new Guid("15d8b765-a2f8-b63e-ad14-472f9b3c12f0"));

            //Create a new "wizard" (also used for property dialogs as in this case), set the title bar, create the data, and add the pages
            WizardStory wizard = new WizardStory();

            wizard.WizardWindowTitle = "SMLets Exchange Connector Settings v" + smletsMP.Version.ToString();
            WizardData data = new AdminSettingWizardData(emoAdminSetting);

            wizard.WizardData = data;
            wizard.AddLast(new WizardStep("General", typeof(GeneralSettingsForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("DLL", typeof(DLLForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("Processing Logic", typeof(ProcessingLogicForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("File Attachments", typeof(FileAttachmentForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("Templates", typeof(TemplateForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("Multi-Mailbox", typeof(MultipleMailboxes), wizard.WizardData));
            wizard.AddLast(new WizardStep("Custom Rules", typeof(CustomRules), wizard.WizardData));
            wizard.AddLast(new WizardStep("Parsing Keywords", typeof(KeywordsForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("Cireson", typeof(CiresonIntegrationForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("Announcements", typeof(AnnouncementsForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("SCOM", typeof(SCOMIntegrationForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("A.I.", typeof(ArtificialIntelligence), wizard.WizardData));
            wizard.AddLast(new WizardStep("Translation", typeof(AzureTranslate), wizard.WizardData));
            wizard.AddLast(new WizardStep("Vision", typeof(AzureVision), wizard.WizardData));
            wizard.AddLast(new WizardStep("Transcription", typeof(AzureSpeech), wizard.WizardData));
            wizard.AddLast(new WizardStep("Workflow", typeof(WorkflowSettings), wizard.WizardData));
            wizard.AddLast(new WizardStep("Logging", typeof(Logging), wizard.WizardData));
            wizard.AddLast(new WizardStep("History", typeof(HistoryForm), wizard.WizardData));
            wizard.AddLast(new WizardStep("About", typeof(AboutForm), wizard.WizardData));

            //Show the property page
            PropertySheetDialog wizardWindow = new PropertySheetDialog(wizard);

            wizardWindow.Width  = 1100;
            wizardWindow.Height = 750;

            //Update the view when done so the new values are shown
            bool?dialogResult = wizardWindow.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value)
            {
                RequestViewRefresh();
            }
        }
        public override void ExecuteCommand(IList <NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection <string> parameters)
        {
            if (parameters.Contains("Create"))
            {
                WizardStory wizard = new WizardStory();

                //set the icon and title bar
                ResourceManager rm           = new ResourceManager("SCSM.AzureAutomation.WPF.Connector.Resources", typeof(Resources).Assembly);
                Bitmap          bitmap       = (Bitmap)rm.GetObject("AzureAutomation2x24");
                IntPtr          ptr          = bitmap.GetHbitmap();
                BitmapSource    bitmapsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                wizard.StoryImage        = bitmapsource;
                wizard.WizardWindowTitle = "Create Azure Automation Connector";

                WizardData data = new AzureAutomationWizardData();
                wizard.WizardData = data;

                //add th pages
                wizard.AddLast(new WizardStep("Welcome", typeof(AzureAutomationWelcomePage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Summary", typeof(AzureAutomationSummaryPage), wizard.WizardData));
                wizard.AddLast(new WizardStep("Results", typeof(AzureAutomationResultPage), wizard.WizardData));

                //Create a wizard window and show it
                WizardWindow wizardwindow = new WizardWindow(wizard);
                // this is needed so that WinForms will pass messages on to the hosted WPF control
                System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(wizardwindow);
                wizardwindow.ShowDialog();

                //Update the view when done with the wizard so that the new connector shows
                if (data.WizardResult == WizardResult.Success)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Edit"))
            {
                //Get the server name to connect to and connect to the server
                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 object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject <EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                //Create a new "wizard" (also used for property dialogs as in this case), set the title bar, create the data, and add the pages
                WizardStory wizard = new WizardStory();
                wizard.WizardWindowTitle = "Edit Azure Automation Connector";
                WizardData data = new AzureAutomationWizardData(emoAAConnector);
                wizard.WizardData = data;
                wizard.AddLast(new WizardStep("Configuration", typeof(AzureAutomationConfigurationPage), wizard.WizardData));

                //Show the property page
                PropertySheetDialog wizardWindow = new PropertySheetDialog(wizard);

                //Update the view when done so the new values are shown
                bool?dialogResult = wizardWindow.ShowDialog();
                if (dialogResult.HasValue && dialogResult.Value)
                {
                    RequestViewRefresh();
                }
            }
            else if (parameters.Contains("Delete") || parameters.Contains("Disable") || parameters.Contains("Enable"))
            {
                //Get the server name to connect to and create a connection
                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 object using the selected node ID
                String strID = String.Empty;
                foreach (NavigationModelNodeBase node in nodes)
                {
                    strID = node["$Id$"].ToString();
                }
                EnterpriseManagementObject emoAAConnector = emg.EntityObjects.GetObject <EnterpriseManagementObject>(new Guid(strID), ObjectQueryOptions.Default);

                if (parameters.Contains("Delete"))
                {
                    //Remove the object from the database
                    IncrementalDiscoveryData idd = new IncrementalDiscoveryData();
                    idd.Remove(emoAAConnector);
                    idd.Commit(emg);
                }

                //Get the rule using the connector ID
                ManagementPack      mpConnectors           = emg.GetManagementPack("SCSM.AzureAutomation", "ac1fe0583b6c84af", new Version("1.0.0.0"));
                ManagementPack      mpAAConnectorWorkflows = emg.GetManagementPack("SCSM.AzureAutomation.Workflows", null, new Version("1.0.0.0"));
                ManagementPackClass classAAConnector       = mpConnectors.GetClass("SCSM.AzureAutomation.Connector");
                String             strConnectorID          = emoAAConnector[classAAConnector, "Id"].ToString();
                ManagementPackRule ruleConnector           = mpAAConnectorWorkflows.GetRule(strConnectorID);

                //Update the Enabled property or delete as appropriate
                if (parameters.Contains("Delete"))
                {
                    ruleConnector.Status = ManagementPackElementStatus.PendingDelete;
                }
                else if (parameters.Contains("Disable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = false;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@false;
                    ruleConnector.Status  = ManagementPackElementStatus.PendingUpdate;
                }
                else if (parameters.Contains("Enable"))
                {
                    emoAAConnector[classAAConnector, "Enabled"].Value = true;
                    ruleConnector.Enabled = ManagementPackMonitoringLevel.@true;
                    ruleConnector.Status  = ManagementPackElementStatus.PendingUpdate;
                }

                //Commit the changes to the connector object and rule
                emoAAConnector.Commit();
                mpAAConnectorWorkflows.AcceptChanges();

                //Update the view when done so the item is either removed or the updated Enabled value shows
                RequestViewRefresh();
            }
        }