internal void RaiseTriggeredEvent(object sender, AsyncStatus status) { if (this.Triggered != null) { this.Triggered(sender, new ActionEventArgs(this, status)); } }
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();*/ }
protected override void OnInitialize(AsyncStatus status) { // This is a default column which already exists when the control is created. NameColumn = Columns[0]; NameColumn.Title = "Name"; NameColumn.SetWidth(150); TaskIdColumn = new MmcListViewColumn("Task ID", -1); StartColumn = new MmcListViewColumn("Start Time", -1); EndColumn = new MmcListViewColumn("End Time", -1); DurationColumn = new MmcListViewColumn("Duration", -1); CompletedColumn = new MmcListViewColumn("Completed", -1); Columns.AddRange(new MmcListViewColumn[] { TaskIdColumn, StartColumn, EndColumn, DurationColumn, CompletedColumn }); Refresh(); MMC.Action RefreshAction = new MMC.Action("Refresh", "Refresh the Task List", SnapInShared.Refresh, "Refresh"); ActionsPaneItems.Add(RefreshAction); Mode = MmcListViewMode.Report; InitializeWatchers(); base.OnInitialize(status); }
/// <summary> /// Node plus sign clicked to expand the node. Load in children. /// </summary> /// <param name="status">asynchronous status for updating the console</param> protected override void OnExpand(AsyncStatus status) { int foundChildren = 10; // report progress status.ReportProgress(0, foundChildren, "Loading Sample children..."); // find results for (int child = 1; child < foundChildren; child++) { // The Thread.Sleep statement below is for demo purposes only. When doing your // development you should not block your snap-in thread to service an // async request like OnExpand unless you only use the scope tree and // list view and never show any WinForms views or WinForms property pages. // The reason is that your WinForms views and property pages will be blocked, // and in certain cases that can also block MMC. // Sleep for a second. Thread.Sleep(1000); // add the child ScopeNode childNode = new StatusNode(); childNode.DisplayName = "Added " + System.DateTime.Now.ToLongTimeString(); this.Children.Add(childNode); // update the progress status.ReportProgress(child, foundChildren, "Loading Sample children..."); } // update progress status.Complete("Loading Sample complete.", true); }
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_MemberName"); this.Columns[0].SetWidth(200); this.Columns.AddRange( new MMC.MmcListViewColumn[] { new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_Type"), 100), new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_Description"), 300), new MMC.MmcListViewColumn(Globalization.MultilanguageResource.GetString("ColumnHeader_ItemID"), 100) }); this.Mode = MMC.MmcListViewMode.Report; this.Refresh(); ItemDefinitionScopeNode idSN = this.ScopeNode as ItemDefinitionScopeNode; if (idSN != null) { idSN.ScopeNodeChanged += new ScopeNodeChangedHandler(ItemMembersListView_ScopeNodeChanged); } status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true); /*Application.DoEvents();*/ }
protected override void OnExpand(MMC.AsyncStatus status) { status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Expanding_Msg10")); this.Render(); status.Complete(Globalization.MultilanguageResource.GetString("Done_Msg10"), true); base.OnExpand(status); }
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); }
protected override void OnInitialize(AsyncStatus status) { // handle any basic stuff base.OnInitialize(status); this.UpdateInfoControl = (UpdateInfoControl)this.Control; ((UpgradeScopeNode)this.ScopeNode).UpdateFormView = this; }
protected override void OnRefresh(MMC.AsyncStatus status) { base.OnRefresh(status); status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Refreshing_Msg10")); //Children this.Refresh(); status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true); /*Application.DoEvents();*/ }
/// <summary> /// Called when a scope node is expanded. This method allows the derived classes to provide custom behavior. /// </summary> /// <param name="status">The object that holds the status information.</param> protected override void OnExpand(AsyncStatus status) { if (!IsLoaded) { Refresh(); this.IsLoaded = true; } base.OnExpand(status); }
/// <summary> /// Launch new thread to handle expand tasks /// </summary> /// <param name="status">asynchronous status for updating the console</param> protected override void OnExpand(AsyncStatus status) { // hang onto status expandStatus = status; // mark as expandStatus.EnableManualCompletion(); Thread thread = new Thread(new ThreadStart(Expand)); thread.Start(); }
/// <summary> /// Handle view global action execution /// </summary> protected override void OnAction(Action action, AsyncStatus status) { switch ((string)action.Tag) { case "Refresh": { Refresh(); break; } } }
/// <summary> /// Load in any saved data /// </summary> /// <param name="status">asynchronous status for updating the console</param> /// <param name="persistenceData">binary data stored in the console file</param> protected override void OnLoadCustomData(AsyncStatus status, byte[] persistenceData) { // saved name? then set snap-in to the name if (string.IsNullOrEmpty(Encoding.Unicode.GetString(persistenceData))) { this.RootNode.DisplayName = "Unknown"; } else { this.RootNode.DisplayName = Encoding.Unicode.GetString(persistenceData); } }
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. } }
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); }
protected override void OnRefresh(AsyncStatus status) { base.OnRefresh(status); try { // Refresh CompanySettingsListView if (ServerPropertiesListView != null) ServerPropertiesListView.Refresh(); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex, "ServerProperties.Refresh"); } }
protected override void OnRefresh(AsyncStatus status) { base.OnRefresh(status); try { // Refresh CompanySettingsListView if (LicenseListView != null) LicenseListView.Refresh(); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex, "LicenseScopeNode.Refresh"); } }
/// <summary> /// /// </summary> /// protected override void OnInitialize(AsyncStatus status) { // handle any basic setup base.OnInitialize(status); // define view columns. // 1st column already exists this.Columns[0].Title = "User"; this.Columns[0].SetWidth(300); // add second+ columns this.Columns.Add(new MmcListViewColumn("Birthday", 200)); // populate the list Refresh(); // define actions this.ActionsPaneItems.Add(new Action("Refresh", "refresh", -1, "Refresh")); }
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_ItemName"); 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_ItemID"), 100) }); this.Mode = MMC.MmcListViewMode.Report; status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true); /*Application.DoEvents();*/ }
/// <summary> /// Allows snap-in code to perform custom view initialization. /// </summary> /// <param name="status">The status object to update.</param> protected override void OnInitialize(AsyncStatus status) { base.OnInitialize(status); // Create a set of columns for use in the list view // Define the default column title this.Columns[0].Title = SnapInResources.ServerListView_Column_Name; this.Columns[0].SetWidth(200); // Add detail column this.Columns.Add(new MmcListViewColumn(SnapInResources.ServerListView_Column_Value, 300)); // Set to show all columns this.Mode = MmcListViewMode.Report; // default (set for clarity) this.ServerPropertiesScopeNode.ServerPropertiesListView = this; // Set to show refresh as an option LoadServerProperties(); }
/// <summary> /// Allows snap-in code to perform custom view initialization. /// </summary> /// <param name="status">The status object to update.</param> protected override void OnInitialize(AsyncStatus status) { base.OnInitialize(status); // Create a set of columns for use in the list view // Define the default column title this.Columns[0].Title = SnapInResources.CompanySettingsListView_Column_Key; this.Columns[0].SetWidth(200); // Add detail column this.Columns.Add(new MmcListViewColumn(SnapInResources.CompanySettingsListView_Column_Value, 300)); // Set to show all columns this.Mode = MmcListViewMode.Report; // default (set for clarity) //this.SelectionData.EnabledStandardVerbs = StandardVerbs.Copy;// | StandardVerbs.Paste; this.CompanyScopeNode.CompanySettingsListView = this; LoadCompanySettings(); }
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 (((ApplicationGroupScopeNode)this.ScopeNode).ApplicationGroup.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(); ApplicationGroupScopeNode appSN = this.ScopeNode as ApplicationGroupScopeNode; if (appSN != null) { appSN.ScopeNodeChanged += new ScopeNodeChangedHandler(ApplicationNodeListView_ScopeNodeChanged); } status.Complete(Globalization.MultilanguageResource.GetString("RefreshComplete_Msg10"), true); /*Application.DoEvents();*/ }
protected override void OnInitialize(AsyncStatus status) { base.OnInitialize(status); }
/// <summary> /// Load in any saved data /// </summary> /// <param name="status">asynchronous status for updating the console</param> /// <param name="persistenceData">binary data stored in the console file</param> protected override void OnLoadCustomData(MMC.AsyncStatus status, byte[] persistenceData) { try { this.loadingCustomData = true; /*Application.DoEvents();*/ base.OnLoadCustomData(status, persistenceData); string allSettings = Encoding.Unicode.GetString(persistenceData); string connectionSettingsString = allSettings.Substring(0, allSettings.LastIndexOf('\n') + 1); string savedLanguage = "en"; if (allSettings.Split('\n').Length >= 7) { if (!String.IsNullOrEmpty(allSettings.Split('\n')[6])) { savedLanguage = allSettings.Split('\n')[6]; } } if (!String.IsNullOrEmpty(savedLanguage)) { Globalization.MultilanguageResource.SetCulture(Globalization.MultilanguageResource.cultureName(savedLanguage)); } // saved name? then set snap-in to the name if (string.IsNullOrEmpty(connectionSettingsString) || connectionSettingsString == new String('\n', 6)) { if (this.splash != null && this.splash.Visible) { new System.Threading.Thread(new System.Threading.ThreadStart( delegate() { System.Threading.Thread.Sleep(1500); this.splash.Close(); this.splash.Dispose(); Application.DoEvents(); this.splash = null; })).Start(); } frmStorageConnection frm = new frmStorageConnection(); DialogResult dr = this.Console.ShowDialog(frm); if (dr == DialogResult.OK) { this.dataSource = frm.dataSource; this.initialCatalog = frm.initialCatalog; this.security = frm.security; this.otherSettings = frm.otherSettings; this.userId = frm.userId; this.password = frm.password; this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings)); this.UpdateRootNode(); } else { this.storage = null; } } else { try { this.dataSource = connectionSettingsString.Split('\n')[0]; this.initialCatalog = connectionSettingsString.Split('\n')[1]; this.security = connectionSettingsString.Split('\n')[2]; this.otherSettings = connectionSettingsString.Split('\n')[3]; this.userId = connectionSettingsString.Split('\n')[4]; this.password = connectionSettingsString.Split('\n')[5]; this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings)); this.UpdateRootNode(); } catch (SqlException) { frmStorageConnection frm = new frmStorageConnection(); DialogResult dr = this.Console.ShowDialog(frm); if (dr == DialogResult.OK) { this.dataSource = frm.dataSource; this.initialCatalog = frm.initialCatalog; this.security = frm.security; this.otherSettings = frm.otherSettings; this.userId = frm.userId; this.password = frm.password; this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings)); this.UpdateRootNode(); } else { this.storage = null; } } } } catch (Exception ex) { this.ShowError(String.Format(Globalization.MultilanguageResource.GetString("MMC_Msg30"), ex.Message), Globalization.MultilanguageResource.GetString("MMC_Tit30")); } finally { if (this.splash != null && this.splash.Visible) { new System.Threading.Thread(new System.Threading.ThreadStart( delegate() { System.Threading.Thread.Sleep(2500); this.splash.Close(); this.splash.Dispose(); Application.DoEvents(); })).Start(); } } }
protected override void OnShutdown(MMC.AsyncStatus status) { base.OnShutdown(status); }
/// <summary> /// Called when the standard verb <see cref="F:Microsoft.ManagementConsole.StandardVerbs.Refresh"></see> is triggered. /// </summary> /// <param name="status">The object that holds the status information.</param> protected override void OnRefresh(AsyncStatus status) { this.Refresh(); }
internal void Expand(IRequestStatus requestStatus) { AsyncStatus status = new AsyncStatus(requestStatus); this.OnExpand(status); }
protected override void OnRefresh(AsyncStatus status) { base.OnRefresh(status); try { // Refresh Company Info this.CompanyInfo = this.GetCompanyConfigurator().GetCompanyInfo((string)this.Tag); this.SubItemDisplayNames.Clear(); LoadCompanyInfo(); RefreshCompanyStatus(); // Refresh CompanySettingsListView if (CompanySettingsListView != null) CompanySettingsListView.Refresh(); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex, "CompanyScopeNode.Refresh"); } }
internal virtual void ProcessRequest(Request request) { if (request.RequestInfo is ShutdownRequestInfo) { AsyncStatus status = new AsyncStatus(request.RequestStatus); this.OnShutdown(status); } else { if (!(request.RequestInfo is PropertyPageMessageRequestInfo)) { throw new NotImplementedException(); } this._sheetManager.ProcessRequestMessage((PropertyPageMessageRequestInfo) request.RequestInfo, request.RequestStatus); } }
private void OnSharedDataPropertyChangeRequested(object source, WritableSharedDataChangeRequestEventArgs e) { AsyncStatus status = new AsyncStatus(e.RequestStatus); this.OnSharedDataChangeRequested(e.SharedDataItem, e.GetNewValue(), status); }
/// <summary> /// /// </summary> /// <param name="action"></param> /// <param name="status"></param> protected override void OnAction(Action action, AsyncStatus status) { // remove existing view description and action this.ViewDescriptions.Clear(); this.ActionsPaneItems.Clear(); // new view description and action switch ((string)action.Tag) { case "ShowError": { this.ViewDescriptions.Add(errorMessageViewDescription); this.ActionsPaneItems.Add(changeToNormalAction); break; } case "ShowNormal": { this.ViewDescriptions.Add(normalMessageViewDescription); this.ActionsPaneItems.Add(changeToErrorAction); break; } } // notify any listening views that a change happened RaiseOnChange((string)action.Tag); }
protected virtual void OnSharedDataChangeRequested(WritableSharedDataItem item, byte[] newValue, AsyncStatus status) { }
protected virtual void OnRefresh(AsyncStatus status) { }
protected virtual void OnExpand(AsyncStatus status) { }
protected override void OnRefresh(AsyncStatus status) { base.OnRefresh(status); }
protected override void OnInitialize(MMC.AsyncStatus status) { base.OnInitialize(status); }
protected override void OnRefresh(MMC.AsyncStatus status) { base.OnRefresh(status); this.Render(); }
protected virtual void OnAction(Action action, AsyncStatus status) { }
/// <summary> /// Handle action for selected resultnode /// </summary> /// protected override void OnSelectionAction(Action action, AsyncStatus status) { switch ((string)action.Tag) { case "Properties": { this.SelectionData.ShowPropertySheet("User Properties"); // triggers OnAddPropertyPages break; } } }
protected virtual void OnShutdown(AsyncStatus status) { }
protected virtual void OnCut(AsyncStatus status) { }
internal void DoAction(int actionId, IRequestStatus requestStatus) { ActionsPaneItem itemById = this.ActionsPaneItems.GetItemById(actionId); if (itemById == null) { itemById = this.ActionsPaneHelpItems.GetItemById(actionId); } Action action = itemById as Action; if (action != null) { AsyncStatus status = new AsyncStatus(requestStatus); action.RaiseTriggeredEvent(this, status); this.OnAction(action, status); } else { SyncAction action2 = itemById as SyncAction; if (action2 != null) { SyncStatus status2 = new SyncStatus(requestStatus); action2.RaiseTriggeredEvent(this, status2); this.OnSyncAction(action2, status2); } else { TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Error, 12, "action with Id {0} no longer exists on node with Id {1}", new object[] { actionId, base.Id }); } } }