Skip to content

Commit

Permalink
Single Instance Pickers (#412)
Browse files Browse the repository at this point in the history
* get instance vs. textbox update

instead of retrieving the GUID of the chosen SCOM group from the Settings MP and then updating a text/label with the chosen name. The ConsoleContextHelper correctly updates and manages the Single Instance Picker control on the SCOMIntegrationForm.xaml

* remove label, format single instance picker

AdminSettingsWizardData now manages the SingleInstancePicker control. The label is no longer required.

* instance picker update

updating SCSM Announcement Group per previous commit on use of single instance picker and the SCOM Group picker

* remove DisplayName label

SingleInstancePicker now correctly updates per AdminSettingsWizardData

* single instance picker

updating announcement group logic for single instance picker
  • Loading branch information
AdhocAdam committed Sep 28, 2022
1 parent 1d54a01 commit d3642b9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -12,6 +12,7 @@
using Microsoft.EnterpriseManagement.ConnectorFramework;
using System.Xml;
using System.Globalization;
using Microsoft.EnterpriseManagement.UI.Extensions.Shared;

namespace SMLetsExchangeConnectorSettingsUI
{
Expand Down Expand Up @@ -3069,16 +3070,16 @@ internal AdminSettingWizardData(EnterpriseManagementObject emoAdminSetting)
catch { this.IsCiresonAnnouncementsEnabled = false; }

this.SCSMApprovedAnnouncers = emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCSMApprovedAnnouncementUsers"].ToString();
try
if (emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCSMApprovedAnnouncementGroupGUID"].Value != null)
{
this.SCSMApprovedGroupGUID = (Guid)emoAdminSetting[null, "SCSMApprovedAnnouncementGroupGUID"].Value;
EnterpriseManagementObject ScsmApprovedGroupEmoObject;
ScsmApprovedGroupEmoObject = (EnterpriseManagementObject)emg.EntityObjects.GetObject<EnterpriseManagementObject>(this.SCSMApprovedGroupGUID, ObjectQueryOptions.Default);
this.SCSMApprovedGroupDisplayName = "CURRENT ANNOUNCEMENT GROUP: " + ScsmApprovedGroupEmoObject.DisplayName;
}
catch
{
this.SCSMApprovedGroupDisplayName = "NO ANNOUNCEMENT GROUP DEFINED";
try
{
this.SCSMApprovedAnnouncementGroup = ConsoleContextHelper.Instance.GetInstance((Guid)emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCSMApprovedAnnouncementGroupGUID"].Value);
}
catch
{
//"NO ANNOUNCEMENT GROUP DEFINED";
}
}

//SCOM Integration
Expand All @@ -3087,16 +3088,16 @@ internal AdminSettingWizardData(EnterpriseManagementObject emoAdminSetting)
this.SCOMServer = emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMmgmtServer"].ToString();
this.AuthorizedSCOMApproverType = emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedMemberType"].ToString();
this.AuthorizedSCOMUsers = emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedUsers"].ToString();
try
{
this.SCOMApprovedGroupGUID = (Guid)emoAdminSetting[null, "SCOMApprovedGroupGUID"].Value;
EnterpriseManagementObject ScomApprovedGroupEmoObject;
ScomApprovedGroupEmoObject = (EnterpriseManagementObject)emg.EntityObjects.GetObject<EnterpriseManagementObject>(this.SCOMApprovedGroupGUID, ObjectQueryOptions.Default);
this.SCOMApprovedGroupDisplayName = "CURRENT APPROVED GROUP: " + ScomApprovedGroupEmoObject.DisplayName;
}
catch
if (emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedGroupGUID"].Value != null)
{
this.SCOMApprovedGroupDisplayName = "NO SCOM GROUP DEFINED";
try
{
this.SCOMApprovedGroup = ConsoleContextHelper.Instance.GetInstance((Guid)emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedGroupGUID"].Value);
}
catch
{
//"NO SCOM GROUP DEFINED";
}
}

//Artificial Intelligence - Cognitive Services
Expand Down Expand Up @@ -3758,17 +3759,31 @@ public override void AcceptChanges(WizardMode wizardMode)
}
emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCSMApprovedAnnouncementUsers"].Value = this.SCSMApprovedAnnouncers;
//if the Announcement group is set, don't null it
try { emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCSMApprovedAnnouncementGroupGUID"].Value = this.SCSMApprovedAnnouncementGroup["Id"]; }
catch { }
if (this.SCSMApprovedAnnouncementGroup != null)
{
try { emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCSMApprovedAnnouncementGroupGUID"].Value = this.SCSMApprovedAnnouncementGroup["Id"]; }
catch { }
}
else
{
emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCSMApprovedAnnouncementGroupGUID"].Value = null;
}

//SCOM Integration
emoAdminSetting[smletsExchangeConnectorSettingsClass, "EnableSCOMIntegration"].Value = this.IsSCOMIntegrationEnabled;
emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMmgmtServer"].Value = this.SCOMServer;
emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedMemberType"].Value = this.AuthorizedSCOMApproverType;
emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedUsers"].Value = this.AuthorizedSCOMUsers;
//if the SCOM approved group is set, don't null it
try { emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedGroupGUID"].Value = this.SCOMApprovedGroup["Id"]; }
catch { }
if (this.SCOMApprovedGroup != null)
{
try { emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedGroupGUID"].Value = this.SCOMApprovedGroup["Id"]; }
catch { }
}
else
{
emoAdminSetting[smletsExchangeConnectorSettingsClass, "SCOMApprovedGroupGUID"].Value = null;
}

//Artifical Intelligence - enabled/disabled
emoAdminSetting[smletsExchangeConnectorSettingsClass, "EnableArtificialIntelligence"].Value = this.IsArtificialIntelligenceEnabled;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wpfwiz:WizardRegularPageBase x:Class="SMLetsExchangeConnectorSettingsUI.AnnouncementsForm"
<wpfwiz:WizardRegularPageBase x:Class="SMLetsExchangeConnectorSettingsUI.AnnouncementsForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Expand Down Expand Up @@ -55,7 +55,6 @@
<TextBox Height="50" x:Name="txtApprovedMember" Text="{Binding SCSMApprovedAnnouncers}" IsEnabled="{Binding ElementName=chkAnnouncementIntegration, Path=IsChecked}" TextWrapping="Wrap"/>
<Label Margin="0,0,0,0" Content="Select the AD group approved for creating Announcements" />
<Custom:SingleInstancePicker IsEnabled="{Binding ElementName=chkAnnouncementIntegration, Path=IsChecked}" Instance="{Binding SCSMApprovedAnnouncementGroup, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BaseClassId="E2386B9B-5364-E438-A317-93836B979C56" Margin="0,0,10,0" />
<Label Margin="0,0,0,0" Content="{Binding SCSMApprovedGroupDisplayName}" />
</StackPanel>
</Grid>
</wpfwiz:WizardRegularPageBase>
</wpfwiz:WizardRegularPageBase>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wpfwiz:WizardRegularPageBase
<wpfwiz:WizardRegularPageBase
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Expand Down Expand Up @@ -36,9 +36,11 @@
<TextBlock Margin="10,10,0,0" Text="Enter a comma seperated list of individual approvers (email addresses)" TextWrapping="Wrap" />
<TextBox Height="50" x:Name="txtApprovedMember" Text="{Binding AuthorizedSCOMUsers}" IsEnabled="{Binding IsChecked, ElementName=chkSCOMIntegrationEnabled}" TextWrapping="Wrap" Margin="10,0" />
<Label Margin="10,0,0,0" Content="Select the AD group approved for requesting health" />
<Custom:SingleInstancePicker IsEnabled="{Binding IsChecked, ElementName=chkSCOMIntegrationEnabled}" Instance="{Binding SCOMApprovedGroup, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BaseClassId="E2386B9B-5364-E438-A317-93836B979C56" Margin="10,0" />
<Label Margin="0,0,0,0" Content="{Binding SCOMApprovedGroupDisplayName}" Height="24" />
<Custom:SingleInstancePicker Margin="10,0"
IsEnabled="{Binding IsChecked, ElementName=chkSCOMIntegrationEnabled}"
BaseClassId="E2386B9B-5364-E438-A317-93836B979C56"
Instance="{Binding SCOMApprovedGroup, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</ScrollViewer>
</Grid>
</wpfwiz:WizardRegularPageBase>
</wpfwiz:WizardRegularPageBase>

0 comments on commit d3642b9

Please sign in to comment.