public ProcessingLogicForm(WizardData wizardData) { //2. Turn the blank instance of AdminSettingsWizardData into the one being used when the form was loaded settings = wizardData as AdminSettingWizardData; InitializeComponent(); this.DataContext = wizardData; this.adminSettingWizardData = this.DataContext as ProcessingLogicForm; //enable Cireson specific controls if the MP is imported per the AdminSettingsWizardData if (settings.IsCiresonPortalMPImported == false) { chkTakeRequiresCiresonGroupMembership.IsEnabled = false; } //set default values within the statically defined drop downs within the WPF form if (settings.ExternalIRCommentType == "(null)") { CBExternalIRCommentType.SelectedIndex = 1; } if (settings.ExternalSRCommentType == "(null)") { CBExternalSRCommentType.SelectedIndex = 1; } if (settings.ExternalIRCommentPrivate == "(null)") { CBExternalIRCommentTypePrivate.SelectedIndex = 0; } if (settings.ExternalSRCommentPrivate == "(null)") { CBExternalSRCommentTypePrivate.SelectedIndex = 0; } }
public CustomRules(WizardData wizardData) { //2. Turn the blank instance of AdminSettingsWizardData into the one being used when the form was loaded settings = wizardData as AdminSettingWizardData; InitializeComponent(); this.DataContext = wizardData; this.adminSettingWizardData = this.DataContext as CustomRules; //load any custom rules try { foreach (var rule in settings.CustomRules) { CustomRulesListViewControl.Items.Add(new AdditionalCustomRule() { CustomRuleID = rule.Id, CustomRuleDisplayName = (String)rule.Values[1].ToString(), CustomRuleMessageClassEnum = (ManagementPackEnumeration)rule.Values[2].Value, CustomRuleMessageClasses = settings.MessageClassEnums, CustomRuleMessagePart = (String)rule.Values[3].ToString(), CustomRuleRegex = (String)rule.Values[4].ToString(), CustomRuleItemType = (String)rule.Values[5].ToString(), CustomRuleRegexMatchProperty = (String)rule.Values[6].ToString() }); } } catch { } }
public HistoryForm(WizardData wizardData) { InitializeComponent(); this.DataContext = wizardData; this.adminSettingWizardData = this.DataContext as HistoryForm; //retrieve smlets exchange connector settings settings = wizardData as AdminSettingWizardData; //build a custom list based on SMexco configuration history //Based on SMlets Get-SCSMObjectHistory - https://github.com/SMLets/SMLets/blob/795242d4a44cf8857957a7628cca67655e2e4252/SMLets.Shared/Code/EntityObjects.cs#L1181-L1216 List <CustomHistoryObject> smexcoConfigHistory = new List <CustomHistoryObject>(); foreach (EnterpriseManagementObjectHistoryTransaction historyItem in settings.SMExcoSettingsHistory) { string propertyName = null; string oldVal = null; string newVal = null; foreach (KeyValuePair <Guid, EnterpriseManagementObjectHistory> h in historyItem.ObjectHistory) { foreach (EnterpriseManagementObjectClassHistory ch in h.Value.ClassHistory) { foreach (KeyValuePair <ManagementPackProperty, Microsoft.EnterpriseManagement.Common.Pair <EnterpriseManagementSimpleObject, EnterpriseManagementSimpleObject> > hpc in ch.PropertyChanges) { //Simplify properties to variables propertyName = hpc.Key.Name; // propertyName = hpc.Key.DisplayName; try { oldVal = hpc.Value.First.Value.ToString(); } catch { oldVal = ""; } try { newVal = hpc.Value.Second.Value.ToString(); } catch { newVal = ""; } //Create a new custom history object smexcoConfigHistory.Add(new CustomHistoryObject() { UserName = historyItem.UserName, Property = propertyName, OldValue = oldVal, NewValue = newVal, DateOccured = historyItem.DateOccurred.ToLocalTime(), DateAndUser = historyItem.DateOccurred.ToLocalTime().ToString() + " " + historyItem.UserName }); } } } } //With the Custom History Objects created, update the list to all of them. Then define a grouping property for the XAML dgHistory.ItemsSource = smexcoConfigHistory; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(dgHistory.ItemsSource); view.SortDescriptions.Add(new System.ComponentModel.SortDescription("DateOccured", System.ComponentModel.ListSortDirection.Descending)); PropertyGroupDescription groupDescription = new PropertyGroupDescription("DateAndUser"); view.GroupDescriptions.Add(groupDescription); }
public AnnouncementsForm(WizardData wizardData) { //2. Turn the blank instance of AdminSettingsWizardData into the one being used when the form was loaded settings = wizardData as AdminSettingWizardData; InitializeComponent(); this.DataContext = wizardData; this.adminSettingWizardData = this.DataContext as AnnouncementsForm; //enable Cireson specific controls if the MP is imported per the AdminSettingsWizardData if (settings.IsCiresonPortalMPImported == false) { chkPostAnnouncementToCiresonPortal.IsEnabled = false; } }
public TemplateForm(WizardData wizardData) { //2. Turn the blank instance of AdminSettingsWizardData into the one being used when the form was loaded settings = wizardData as AdminSettingWizardData; InitializeComponent(); this.DataContext = wizardData; this.adminSettingWizardData = this.DataContext as TemplateForm; //set default values within the statically defined drop downs within the WPF form if (settings.DefaultWorkItem == "(null)") { cbDefaultWorkItemType.SelectedIndex = 3; } }
public Logging(WizardData wizardData) { //2. Turn the blank instance of AdminSettingsWizardData into the one being used when the form was loaded settings = wizardData as AdminSettingWizardData; InitializeComponent(); this.DataContext = wizardData; this.adminSettingWizardData = this.DataContext as Logging; //set default values within the statically defined drop downs within the WPF form if (settings.LoggingLevel == "(null)") { cbLoggingLevel.SelectedIndex = 0; } if (settings.LoggingType == "(null)") { cbLoggingType.SelectedIndex = 0; } }
public MultipleMailboxes(WizardData wizardData) { //2. Turn the blank instance of AdminSettingsWizardData into the one being used when the form was loaded settings = wizardData as AdminSettingWizardData; InitializeComponent(); this.DataContext = wizardData; this.adminSettingWizardData = this.DataContext as MultipleMailboxes; //This is less than ideal as it means two connections are made to SCSM when loading the form, this was done so the returned GUID from //the Additional Mailbox could be looked up and then set as the Selected Item within the drop down //Get the server name to connect to and then 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); try { foreach (var mb in settings.AdditionalMailboxes) { MailboxListViewControl.Items.Add(new AdditionalMailbox() { MailboxID = mb.Id, MailboxAddress = (String)mb.Values[1].ToString(), MailboxWorkItemType = (String)mb.Values[2].ToString(), MailboxIRTemplate = emg.Templates.GetObjectTemplate(new Guid(mb.Values[4].ToString())), MailboxIRTemplates = settings.IncidentTemplates, MailboxSRTemplate = emg.Templates.GetObjectTemplate(new Guid(mb.Values[6].ToString())), MailboxSRTemplates = settings.ServiceRequestTemplates, MailboxCRTemplate = emg.Templates.GetObjectTemplate(new Guid(mb.Values[8].ToString())), MailboxCRTemplates = settings.ChangeRequestTemplates, MailboxPRTemplate = emg.Templates.GetObjectTemplate(new Guid(mb.Values[10].ToString())), MailboxPRTemplates = settings.ProblemTemplates }); } } catch { } }
public ArtificialIntelligence(WizardData wizardData) { //2. Turn the blank instance of AdminSettingsWizardData into the one being used when the form was loaded settings = wizardData as AdminSettingWizardData; InitializeComponent(); this.DataContext = wizardData; this.azureCognitiveServicesWizardData = this.DataContext as ArtificialIntelligence; //This is less than ideal as it means two connections are made to SCSM when loading the form, this was done so the returned GUID from //the Additional Mailbox could be looked up and then set as the Selected Item within the drop down //Get the server name to connect to and then 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); //enable Cireson specific controls if these Cireson features are checked off on the Cireson integration form if (settings.IsCiresonKBSearchEnabled == true) { chkImproveCiresonKASuggestion.IsEnabled = true; chkImproveCiresonKASuggestionAML.IsEnabled = true; } else { chkImproveCiresonKASuggestion.IsEnabled = false; chkImproveCiresonKASuggestionAML.IsEnabled = false; } if (settings.IsCiresonROSearchEnabled == true) { chkImproveCiresonROSuggestion.IsEnabled = true; chkImproveCiresonROSuggestionAML.IsEnabled = true; } else { chkImproveCiresonROSuggestion.IsEnabled = false; chkImproveCiresonROSuggestionAML.IsEnabled = false; } //parse ACS Boundary XML back into the Listview try { string xmlBoundaries = settings.AzureCognitiveServicesBoundaries; XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlBoundaries); foreach (XmlNode node in doc.DocumentElement) { if (node.ChildNodes[0].InnerText == "IR") { ACSBoundaryListViewControl.Items.Add(new ACSPriorityBoundary() { WorkItemType = node.ChildNodes[0].InnerText, MinBoundary = node.ChildNodes[1].InnerText, MaxBoundary = node.ChildNodes[2].InnerText, IRImpactSRUrgency = emg.EntityTypes.GetEnumeration(new Guid(node.ChildNodes[3].InnerText)), IRImpactSRUrgencyEnums = settings.IncidentImpactEnums, IRUrgencySRPriority = emg.EntityTypes.GetEnumeration(new Guid(node.ChildNodes[4].InnerText)), IRUrgencySRPriorityEnums = settings.IncidentUrgencyEnums }); } else { ACSBoundaryListViewControl.Items.Add(new ACSPriorityBoundary() { WorkItemType = node.ChildNodes[0].InnerText, MinBoundary = node.ChildNodes[1].InnerText, MaxBoundary = node.ChildNodes[2].InnerText, IRImpactSRUrgency = emg.EntityTypes.GetEnumeration(new Guid(node.ChildNodes[3].InnerText)), IRImpactSRUrgencyEnums = settings.ServiceRequestUrgencyEnums, IRUrgencySRPriority = emg.EntityTypes.GetEnumeration(new Guid(node.ChildNodes[4].InnerText)), IRUrgencySRPriorityEnums = settings.ServiceRequestPriorityEnums }); } } } catch { } }
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(); } }