本文整理汇总了C#中Microsoft.ManagementConsole类的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.ManagementConsole类的具体用法?C# Microsoft.ManagementConsole怎么用?C# Microsoft.ManagementConsole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Microsoft.ManagementConsole类属于命名空间,在下文中一共展示了Microsoft.ManagementConsole类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: deleteApplicationGroupsAction_Triggered
void deleteApplicationGroupsAction_Triggered(object sender, MMC.SyncActionEventArgs e)
{
MessageBoxParameters mbp = new MessageBoxParameters();
mbp.Buttons = MessageBoxButtons.YesNo;
mbp.Caption = e.Action.DisplayName;
mbp.DefaultButton = MessageBoxDefaultButton.Button2;
mbp.Icon = MessageBoxIcon.Question;
mbp.Text = String.Format(Globalization.MultilanguageResource.GetString("ApplicationGroupsListView_Msg10"));
DialogResult dr = this.SnapIn.Console.ShowDialog(mbp);
if (dr == DialogResult.Yes)
{
try
{
foreach (ApplicationGroupScopeNode applicationGroupScopeNode in this.SelectedNodes)
{
applicationGroupScopeNode.ApplicationGroup.Delete();
this.ScopeNode.Children.Remove(applicationGroupScopeNode);
}
}
catch (Exception ex)
{
this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("ApplicationGroupsListView_Msg20"));
}
}
}
示例2: OnInitialize
protected override void OnInitialize(MMC.AsyncStatus status)
{
base.OnInitialize(status);
status.Title = Globalization.MultilanguageResource.GetString("Refreshing_Msg10");
status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Refreshing_Msg10"));
/*Application.DoEvents();*/
base.OnInitialize(status);
this.Columns.Clear();
if (((StoreGroupScopeNode)this.ScopeNode).StoreGroup.GroupType == GroupType.Basic)
{
this.Columns[0].Title = Globalization.MultilanguageResource.GetString("ColumnHeader_Name");
this.Columns[0].SetWidth(200);
this.Columns.AddRange(
new MMC.MmcListViewColumn[] {
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_WhereDefined"),100),
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_MemberNonMember"), 150),
new MMC.MmcListViewColumn("Sid", 300)});
}
else
{
this.Columns[0].Title = Globalization.MultilanguageResource.GetString("ColumnHeader_Name");
this.Columns[0].SetWidth(200);
this.Columns.AddRange(
new MMC.MmcListViewColumn[] {
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_Description"),250),
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_LDAPQuery"), 400)});
}
this.Mode = MMC.MmcListViewMode.Report;
this.Refresh();
StoreGroupScopeNode sgSN = this.ScopeNode as StoreGroupScopeNode;
if (sgSN != null)
sgSN.ScopeNodeChanged += new ScopeNodeChangedHandler(StoreNodeListView_ScopeNodeChanged);
status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true);
/*Application.DoEvents();*/
}
示例3: OnSelectionChanged
protected override void OnSelectionChanged(MMC.SyncStatus status)
{
base.OnSelectionChanged(status);
//Multiple delete
if (this.SelectedNodes.Count > 1)
{
//Prepare actions
this.SelectionData.ActionsPaneItems.Clear();
this.SelectionData.Update(this.SelectedNodes, true, null, null);
//Export - MMC.SyncAction
MMC.SyncAction exportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg130"), Globalization.MultilanguageResource.GetString("Menu_Tit130"));
exportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(exportAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(exportAction);
//MMC.SyncAction - Delete Stores
MMC.SyncAction deleteStoresAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg140"), Globalization.MultilanguageResource.GetString("Menu_Tit140"));
bool canDelete = true;
foreach (StoreScopeNode ssn in this.SelectedNodes)
{
if (!ssn.Store.IAmAdmin)
{
canDelete = false;
break;
}
}
deleteStoresAction.Enabled = canDelete;
deleteStoresAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteStoresAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(deleteStoresAction);
}
}
示例4: OnRefresh
protected override void OnRefresh(MMC.AsyncStatus status)
{
status.Title = Globalization.MultilanguageResource.GetString("Refreshing_Msg10");
base.OnRefresh(status);
this.Render();
status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true);
}
示例5: OnInitialize
protected override void OnInitialize(MMC.AsyncStatus status)
{
base.OnInitialize(status);
status.Title = Globalization.MultilanguageResource.GetString("Refreshing_Msg10");
status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Refreshing_Msg10"));
/*Application.DoEvents();*/
base.OnInitialize(status);
this.Columns.Clear();
this.Columns[0].Title = Globalization.MultilanguageResource.GetString("ColumnHeader_Name");
this.Columns[0].SetWidth(250);
this.Columns.AddRange(
new MMC.MmcListViewColumn[] {
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_AuthorizationType"),150),
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_WhereDefined"),100),
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_Owner"),250),
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_ValidFrom"), 180),
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_ValidTo"), 180),
new MMC.MmcListViewColumn("Sid",300)});
this.Mode = MMC.MmcListViewMode.Report;
this.Refresh();
ItemAuthorizationScopeNode itSN = this.ScopeNode as ItemAuthorizationScopeNode;
if (itSN != null)
itSN.ScopeNodeChanged += new ScopeNodeChangedHandler(AuthorizationsListView_ScopeNodeChanged);
status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true);
/*Application.DoEvents();*/
}
示例6: OnExpand
protected override void OnExpand(MMC.AsyncStatus status)
{
status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Expanding_Msg10"));
this.Render();
status.Complete("Done.", true);
base.OnExpand(status);
}
示例7: OnExpandFromLoad
protected override bool OnExpandFromLoad(MMC.SyncStatus status)
{
status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Refreshing_Msg10"));
this.Render();
status.Complete(Globalization.MultilanguageResource.GetString("Done_Msg10"), true);
return base.OnExpandFromLoad(status);
}
示例8: OnSelectionChanged
protected override void OnSelectionChanged(MMC.SyncStatus status)
{
base.OnSelectionChanged(status);
if (this.SelectedNodes.Count > 1)
{
//Prepare actions
this.SelectionData.ActionsPaneItems.Clear();
bool allApplications = true;
foreach (MMC.ScopeNode scopeNode in this.SelectedNodes)
{
if (scopeNode as ApplicationScopeNode==null)
{
allApplications = false;
}
}
if (allApplications)
{
this.SelectionData.Update(this.SelectedNodes, true, null, null);
//Items Hierarchy View - MMC.SyncAction
MMC.SyncAction ItemsHVAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_ItemsHierarchicalView"), Globalization.MultilanguageResource.GetString("Menu_ItemsHierarchicalViewDescription"));
ItemsHVAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(ItemsHVAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(ItemsHVAction);
//Line MMC.SyncAction
MMC.ActionSeparator lineAction1 = new MMC.ActionSeparator();
this.SelectionData.ActionsPaneItems.Add(lineAction1);
//Report Group
MMC.ActionGroup reportAction = new MMC.ActionGroup(Globalization.MultilanguageResource.GetString("rptTitle"), Globalization.MultilanguageResource.GetString("rptDescription"));
this.SelectionData.ActionsPaneItems.Add(reportAction);
//Items Hierarchy Report - MMC.SyncAction
MMC.SyncAction ItemsHReportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("rptMsg10"), Globalization.MultilanguageResource.GetString("rptTit10"));
ItemsHReportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(ItemsHReportAction_Triggered);
reportAction.Items.Add(ItemsHReportAction);
//Authorizations Report - MMC.SyncAction
MMC.SyncAction AuthorizationsReportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("rptMsg20"), Globalization.MultilanguageResource.GetString("rptTit20"));
AuthorizationsReportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(AuthorizationsReportAction_Triggered);
reportAction.Items.Add(AuthorizationsReportAction);
//Effective Permissions Report Report - MMC.SyncAction
MMC.SyncAction EffectivePermissionsReportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("rptMsg30"), Globalization.MultilanguageResource.GetString("rptTit30"));
EffectivePermissionsReportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(EffectivePermissionsReportAction_Triggered);
reportAction.Items.Add(EffectivePermissionsReportAction);
//Line MMC.SyncAction
MMC.ActionSeparator lineAction5 = new MMC.ActionSeparator();
this.SelectionData.ActionsPaneItems.Add(lineAction5);
//Export - MMC.SyncAction
MMC.SyncAction exportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg80"), Globalization.MultilanguageResource.GetString("Menu_Tit80"));
exportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(exportAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(exportAction);
//Line MMC.SyncAction
MMC.ActionSeparator lineAction2 = new MMC.ActionSeparator();
this.SelectionData.ActionsPaneItems.Add(lineAction2);
//MMC.SyncAction - Delete Applications
MMC.SyncAction deleteApplicationsAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg90"), Globalization.MultilanguageResource.GetString("Menu_Tit90"));
if (!(((ApplicationScopeNode)this.SelectedNodes[0]).Application.Store.IAmManager))
deleteApplicationsAction.Enabled = false;
deleteApplicationsAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteApplicationsAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(deleteApplicationsAction);
}
}
}
示例9: OnRefresh
protected override void OnRefresh(MMC.AsyncStatus status)
{
status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Refreshing_Msg10"));
base.OnRefresh(status);
//Children
this.Refresh();
status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true);
/*Application.DoEvents();*/
}
示例10: OnSelectionChanged
protected override void OnSelectionChanged(MMC.SyncStatus status)
{
base.OnSelectionChanged(status);
//Multiple delete
if (this.SelectedNodes.Count >= 1)
{
//Prepare actions
this.SelectionData.ActionsPaneItems.Clear();
this.SelectionData.Update(this.SelectedNodes, this.SelectedNodes.Count > 1, null, null);
//Authorizations - MMC.SyncAction
MMC.ActionGroup authorizationsActionGroup = new MMC.ActionGroup(Globalization.MultilanguageResource.GetString("Menu_Msg30"), Globalization.MultilanguageResource.GetString("Menu_Tit30"));
this.SelectionData.ActionsPaneItems.Add(authorizationsActionGroup);
//Allow with delegation
MMC.SyncAction allowWithDelegationAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_AllowWithDelegation"), Globalization.MultilanguageResource.GetString("Domain_AllowWithDelegationDescription"));
if (this.ScopeNode as ItemAuthorizationScopeNode!=null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
this.ScopeNode as ItemDefinitionScopeNode!=null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
allowWithDelegationAction.Enabled = false;
allowWithDelegationAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(allowWithDelegationAction_Triggered);
authorizationsActionGroup.Items.Add(allowWithDelegationAction);
//Allow
MMC.SyncAction allowAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_Allow"), Globalization.MultilanguageResource.GetString("Domain_AllowDescription"));
if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
allowAction.Enabled = false;
allowAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(allowAction_Triggered);
authorizationsActionGroup.Items.Add(allowAction);
//Deny
MMC.SyncAction denyAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_Deny"), Globalization.MultilanguageResource.GetString("Domain_DenyDescription"));
if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
denyAction.Enabled = false;
denyAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(denyAction_Triggered);
authorizationsActionGroup.Items.Add(denyAction);
//Neutral
MMC.SyncAction neutralAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_Neutral"), Globalization.MultilanguageResource.GetString("Domain_NeutralDescription"));
if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
neutralAction.Enabled = false;
neutralAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(neutralAction_Triggered);
authorizationsActionGroup.Items.Add(neutralAction);
//Line separator
MMC.ActionSeparator lineAction = new MMC.ActionSeparator();
this.SelectionData.ActionsPaneItems.Add(lineAction);
//MMC.SyncAction - Delete Authorizations
MMC.SyncAction deleteAuthorizationsAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg40"), Globalization.MultilanguageResource.GetString("Menu_Tit40"));
if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
deleteAuthorizationsAction.Enabled = false;
deleteAuthorizationsAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteAuthorizationsAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(deleteAuthorizationsAction);
}
}
示例11: OnRefresh
protected override void OnRefresh(MMC.AsyncStatus status)
{
try
{
status.ReportProgress(50, 100, "");
this.NotifyChanged();
/*Application.DoEvents();*/
}
catch
{
//ignore ... because viewDescription List can be shutting down.
}
}
示例12: OnAction
protected override void OnAction(MMC.Action action, AsyncStatus status)
{
string actionString = action.Tag as string;
if (actionString != null)
{
switch (actionString)
{
case "Refresh":
Refresh();
break;
}
}
base.OnAction(action, status);
}
示例13: OnInitialize
protected override void OnInitialize(MMC.AsyncStatus status)
{
base.OnInitialize(status);
status.Title = Globalization.MultilanguageResource.GetString("Refreshing_Msg10");
status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Refreshing_Msg10"));
/*Application.DoEvents();*/
base.OnInitialize(status);
this.Columns.Clear();
this.Columns[0].Title = Globalization.MultilanguageResource.GetString("ColumnHeader_ApplicationName");
this.Columns[0].SetWidth(200);
this.Columns.AddRange(
new MMC.MmcListViewColumn[] {
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_Description"),300),
new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_ApplicationID"), 100)});
this.Mode = MMC.MmcListViewMode.Report;
status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true);
/*Application.DoEvents();*/
}
示例14: OnSelectionChanged
protected override void OnSelectionChanged(MMC.SyncStatus status)
{
base.OnSelectionChanged(status);
//Multiple delete
if (this.SelectedNodes.Count > 1)
{
//Prepare actions
this.SelectionData.ActionsPaneItems.Clear();
this.SelectionData.Update(this.SelectedNodes, true, null, null);
//Export - MMC.SyncAction
MMC.SyncAction exportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg10"), Globalization.MultilanguageResource.GetString("Menu_Tit10"));
exportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(exportAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(exportAction);
//MMC.SyncAction - Delete Stores
MMC.SyncAction deleteApplicationGroupsAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg20"), Globalization.MultilanguageResource.GetString("Menu_Tit20"));
if (!(((ApplicationGroupScopeNode)this.SelectedNodes[0]).ApplicationGroup.Application.IAmManager))
deleteApplicationGroupsAction.Enabled = false;
deleteApplicationGroupsAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteApplicationGroupsAction_Triggered);
this.SelectionData.ActionsPaneItems.Add(deleteApplicationGroupsAction);
}
}
示例15: LoadImages
internal static void LoadImages(MMC.SnapInImageList smallImages, MMC.SnapInImageList largeImages)
{
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Application_16x16); //0
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Folder_16x16); //1
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.ItemAuthorization_16x16); //2
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.NetSqlAzMan_16x16); //3
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Operation_16x16); //4
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.SIDNotFound_16x16); //5
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Store_16x16); //6
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.StoreApplicationGroup_16x16); //7
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.WindowsBasicGroup_16x16); //8
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.WindowsQueryLDAPGroup_16x16); //9
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.WindowsUser_16x16); //10
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.AuthorizationAttribute_16x16); //11
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Role_16x16); //12
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Task_16x16); //13
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Operation_16x16); //14
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Hierarchy_16x16); //15
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Options_16x16); //16
smallImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.DBUser_16x16); //17
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Application_32x32); //0
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Folder_32x32); //1
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.ItemAuthorization_32x32); //2
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.NetSqlAzMan_32x32); //3
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Operation_32x32); //4
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.SIDNotFound_32x32); //5
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Store_32x32); //6
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.StoreApplicationGroup_32x32); //7
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.WindowsBasicGroup_32x32); //8
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.WindowsQueryLDAPGroup_32x32); //9
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.WindowsUser_32x32); //10
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.AuthorizationAttribute_32x32); //11
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Role_32x32); //12
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Task_32x32); //13
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Operation_32x32); //14
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Hierarchy_32x32); //15
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.Options_32x32); //16
largeImages.Add(NetSqlAzMan.SnapIn.Properties.Resources.DBUser_32x32); //17
}