/// <summary> /// ServersStatusChanged method implementation /// </summary> private void ServersStatusChanged(ADFSServiceManager mgr, ServiceOperationStatus status, string servername, Exception Ex = null) { if ((servername.ToLower() == _host.FQDN.ToLower()) || (servername.ToLower() == _host.MachineName.ToLower())) { switch (status) { case ServiceOperationStatus.OperationInError: _panel.BackColor = Color.DarkRed; break; case ServiceOperationStatus.OperationPending: _panel.BackColor = Color.Orange; break; case ServiceOperationStatus.OperationRunning: _panel.BackColor = Color.Green; break; case ServiceOperationStatus.OperationStopped: _panel.BackColor = Color.Red; break; default: _panel.BackColor = Color.Yellow; break; } UpdateLabels(status); this._panel.Refresh(); } }
/// <summary> /// Initialize method implementation /// </summary> internal static void Initialize(PSHost host = null, bool loadconfig = false) { if (ADFSManager == null) { ADFSManager = new ADFSServiceManager(); ADFSManager.Initialize(); } if (MailslotServer == null) { MailslotServer = new MailSlotServer("MGT"); MailslotServer.MailSlotMessageArrived += MailSlotMessageArrived; MailslotServer.AllowToSelf = true; MailslotServer.Start(); } if (loadconfig) { try { ADFSManager.EnsureLocalConfiguration(host); } catch (CmdletInvocationException cm) { EventLog.WriteEntry(EventLogSource, SErrors.ErrorMFAUnAuthorized + "\r\r" + cm.Message, EventLogEntryType.Error, 30901); throw cm; } catch (Exception ex) { EventLog.WriteEntry(EventLogSource, string.Format(SErrors.ErrorLoadingMFAConfiguration, ex.Message), EventLogEntryType.Error, 30900); throw ex; } } }
/// <summary> /// Initialize method implementation /// </summary> public static void Initialize(PSHost host = null, bool loadconfig = false) { if (_manager == null) { _manager = new ADFSServiceManager(); _manager.Initialize(); } if (loadconfig) { try { _manager.EnsureLocalConfiguration(host); } catch (CmdletInvocationException cm) { EventLog.WriteEntry(EventLogSource, errors_strings.ErrorMFAUnAuthorized +"\r\r"+ cm.Message, EventLogEntryType.Error, 30901); throw cm; } catch (Exception ex) { EventLog.WriteEntry(EventLogSource, string.Format(errors_strings.ErrorLoadingMFAConfiguration, ex.Message), EventLogEntryType.Error, 30900); throw ex; } } }
/// <summary> /// OnInitialize method /// </summary> protected virtual void OnInitialize() { this.Cursor = Cursors.WaitCursor; this.SuspendLayout(); try { ADFSServiceManager mgr = ManagementAdminService.ADFSManager; bool isconfigured = mgr.IsFarmConfigured(); bool isactive = mgr.IsMFAProviderEnabled(null); this.tableLayoutPanel.Controls.Add(new ConfigurationControl(mgr.Config, isconfigured, isactive), 0, 1); this.tableLayoutPanel.Controls.Add(new ConfigurationFooterControl(), 0, 2); if (isconfigured) { int i = 3; foreach (ADFSServerHost srv in ManagementAdminService.ADFSManager.ADFSFarm.Servers) { bool isok = ManagementAdminService.ADFSManager.IsRunning(srv.FQDN); this.tableLayoutPanel.Controls.Add(new ADFSServerControl(srv, isok), 0, i); i++; } this.tableLayoutPanel.Controls.Add(new ADFSServersFooterControl(), 0, i); } } finally { this.ResumeLayout(true); this.Cursor = Cursors.Default; } }
private void ConfigurationStatusChanged(ADFSServiceManager mgr, ConfigOperationStatus status, Exception ex = null) { if (IsNotifsEnabled()) { if (this.InvokeRequired) { ReloadData(); } } }
/// <summary> /// RefreshData method implementation /// </summary> internal void RefreshData() { this.Cursor = Cursors.WaitCursor; this.SuspendLayout(); try { for (int j = this.tableLayoutPanel.Controls.Count - 1; j >= 0; j--) { Control ctrl = this.tableLayoutPanel.Controls[j]; if (ctrl is ADFSServerControl) { this.tableLayoutPanel.Controls.RemoveAt(j); } else if (ctrl is ConfigurationControl) { this.tableLayoutPanel.Controls.RemoveAt(j); } else if (ctrl is ConfigurationFooterControl) { this.tableLayoutPanel.Controls.RemoveAt(j); } else if (ctrl is ADFSServersFooterControl) { this.tableLayoutPanel.Controls.RemoveAt(j); } } ADFSServiceManager mgr = ManagementAdminService.ADFSManager; bool isconfigured = mgr.IsFarmConfigured(); bool isactive = mgr.IsMFAProviderEnabled(null); this.tableLayoutPanel.Controls.Add(new ConfigurationControl(mgr.Config, isconfigured, isactive), 0, 1); this.tableLayoutPanel.Controls.Add(new ConfigurationFooterControl(), 0, 2); if (isconfigured) { int i = 3; foreach (ADFSServerHost srv in ManagementAdminService.ADFSManager.ADFSFarm.Servers) { bool isok = ManagementAdminService.ADFSManager.IsRunning(srv.FQDN); this.tableLayoutPanel.Controls.Add(new ADFSServerControl(srv, isok), 0, i); i++; } this.tableLayoutPanel.Controls.Add(new ADFSServersFooterControl(), 0, i); } } finally { this.ResumeLayout(true); this.Cursor = Cursors.Default; } }
/// <summary> /// OnInitialize method /// </summary> protected virtual void OnInitialize() { this.SuspendLayout(); try { ADFSServiceManager mgr = ManagementAdminService.ADFSManager; bool isconfigured = mgr.IsFarmConfigured(); bool isactive = mgr.IsMFAProviderEnabled(null); this.tableLayoutPanel.Controls.Add(new GeneralConfigurationControl(mgr.Config, isconfigured, isactive), 0, 1); } finally { this.ResumeLayout(true); } }
/// <summary> /// RefreshData method implementation /// </summary> internal void RefreshData() { this.SuspendLayout(); try { for (int j = this.tableLayoutPanel.Controls.Count - 1; j >= 0; j--) { Control ctrl = this.tableLayoutPanel.Controls[j]; if (ctrl is GeneralConfigurationControl) { this.tableLayoutPanel.Controls.RemoveAt(j); } } ADFSServiceManager mgr = ManagementAdminService.ADFSManager; bool isconfigured = mgr.IsFarmConfigured(); bool isactive = mgr.IsMFAProviderEnabled(null); this.tableLayoutPanel.Controls.Add(new GeneralConfigurationControl(mgr.Config, isconfigured, isactive), 0, 1); } finally { this.ResumeLayout(true); } }
/// <summary> /// ServersStatusChanged method implementation /// </summary> private void ConfigurationStatusChanged(ADFSServiceManager mgr, ConfigOperationStatus status, Exception ex = null) { switch (status) { case ConfigOperationStatus.ConfigInError: _panel.BackColor = Color.DarkRed; break; case ConfigOperationStatus.ConfigSaved: _panel.BackColor = Color.Orange; break; case ConfigOperationStatus.ConfigLoaded: bool isactive = ManagementAdminService.ADFSManager.IsMFAProviderEnabled(null); if (isactive) { _panel.BackColor = Color.Green; } else { _panel.BackColor = Color.Yellow; } lblFarmActive.Tag = isactive; break; case ConfigOperationStatus.ConfigIsDirty: _panel.BackColor = Color.Red; break; default: _panel.BackColor = Color.Yellow; break; } UpdateLabels(status); this._panel.Refresh(); }
private void mgr_BroadcastStatusChanged(ADFSServiceManager mgr, ServiceOperationStatus status, string servername, Exception Ex = null) { }
private void mgr_ConfigurationStatusChanged(ADFSServiceManager mgr, ConfigOperationStatus status, Exception ex = null) { }