Exemple #1
0
        public Settings(WizardData wizardData)
        {
            InitializeComponent();

            this.DataContext = wizardData;
            this.incidentSLASettingsWizardData = this.DataContext as IncidentSLASettingsWizardData;
        }
        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();
        }