public static System.Web.UI.WebControls.Image buildAlertImage(AlertLevel level) { System.Web.UI.WebControls.Image res = new System.Web.UI.WebControls.Image(); switch (level) { case AlertLevel.None: res.ImageUrl = "~/img/ok.png"; res.AlternateText = "OK"; break; case AlertLevel.Warning: res.ImageUrl = "~/img/warning.png"; res.AlternateText = "Warning"; break; case AlertLevel.Critical: default: res.ImageUrl = "~/img/critical.png"; res.AlternateText = "Critical"; break; } res.BorderWidth = 0; res.Style["vertical-align"] = "middle"; return res; }
public AlertMessage(AlertLevel level, AlertDescription description) { SecurityAssert.SAssert((AllowedDescLevels[(int)description] & level) != 0); Level = level; Description = description; }
internal TlsException( AlertLevel level, AlertDescription description, string message) : base (message) { this.alert = new Alert(level, description); }
public Alert(byte[] data) { Level = AlertLevel.Fatal; Description = AlertDescription.IllegalParameter; if (data.Length == 2) { Level = (AlertLevel) data[0]; Description = (AlertDescription) data[1]; } }
public AlertResult( AlertLevel level, double value, DateTime? timestamp, string comment) { _level = level; _value = value; _timestamp = timestamp; Comment = comment; }
public void OnAlert(string m, AlertLevel l) { var at = new AlertTuple(uic.AlertDuration, wr, uic.Buffer, uic.Width, uic.Height, uic.TextHeight); if(lRects.Last != null) { lRects.Last.Value.Base.Parent = at.Base; } lRects.AddLast(at); at.Base.Parent = WidgetBase; at.Text.Text = m; }
public AlertProxy(Alert alert) { Alert = alert; Title = alert.Title; CreatedAt = alert.CreatedAt; Observed = new Observable<bool> {Value = alert.Observed}; Message = alert.Message; AlertLevel = alert.AlertLevel; Observed.PropertyChanged += (sender, args) => { Alert.Observed = Observed.Value; }; }
public void AddNotification(AlertLevel level, string message, string identifer, NotificationRequest notificationCombiner) { Notification not = new Notification() { AlertLevel = level, Message = new List<string>(new []{message}), Identifer = identifer, DuplicateNotificationRequest = notificationCombiner }; if (m_dicNotifications.ContainsKey(identifer)) m_dicNotifications[identifer] = Notification.Combine(m_dicNotifications[identifer], not); else m_dicNotifications[identifer] = not; }
public AlertDto( string name, AlertLevel level, string comments, string chartUrl, DateTime? timestamp, string dashboardUrl) { DashboardUrl = dashboardUrl; Timestamp = GetTimestampString(timestamp); ChartUrl = chartUrl; Comments = comments; Level = level.ToString(); Name = name; }
public void ChildNewState(AlertLevel childPrevious, AlertLevel childCurrent) { AlertLevel state = State; if (state < childPrevious) { // illegal previous state: child alert level was more critical than parent. try to heal! State = ComputeStateFromChildren(childCurrent); return; } if (state < childCurrent) { // rise alert level up to child's State = childCurrent; return; } if (state > childCurrent && state == childPrevious) { // child alert level is lowering, recount State = ComputeStateFromChildren(childCurrent); } }
/// <summary> /// Generates an alert message with an expiration time. /// </summary> /// <param name="category">An alert category</param> /// <param name="level">Alert level</param> /// <param name="source">Name of the source where the alert is raised</param> /// <param name="alertCode">Alert type code</param> /// <param name="contextData">The user-defined application context data</param> /// <param name="expirationTime">Expiration time for the alert</param> /// <param name="message">The alert message or formatted message.</param> /// <param name="args">Paramaters used in the alert message, when specified.</param> public static void Alert(AlertCategory category, AlertLevel level, String source, int alertCode, object contextData, TimeSpan expirationTime, String message, params object[] args) { Platform.CheckForNullReference(source, "source"); Platform.CheckForNullReference(message, "message"); IAlertService service = Platform.GetService<IAlertService>(); if (service != null) { AlertSource src = new AlertSource(source, ServerInstanceId) { Host = ServerInstanceId }; Alert alert = new Alert { Category = category, Level = level, Code = alertCode, ExpirationTime = Platform.Time.Add(expirationTime), Source = src, Message = String.Format(message, args), ContextData = contextData }; service.GenerateAlert(alert); } }
public void AddNotification(AlertLevel level, string message, string identifer) { AddNotification(level, message, identifer, null); }
private void SwitchAlertLevel(AlertLevel alertLevel) { if(alertLevel != enemy.AlertLVL) { switch(enemy.AlertLVL) { case AlertLevel.None: { break; } case AlertLevel.Low: { StopCoroutine("LowAlert"); lowTimer = 0; isLowAlertStarted = false; isWatchDone = false; isSearchDone = false; isReturnDone = false; isFollowDone = false; break; } case AlertLevel.Medium: { StopCoroutine("LowAlert"); isMediumAlertStarted = false; lowTimer = 0; isWatchDone = false; isSearchDone = false; isReturnDone = false; isFollowDone = false; break; } case AlertLevel.High: { isWatchDone = true; isSearchDone = false; isReturnDone = false; isFollowDone = false; break; } } enemy.AlertLVL = alertLevel; } }
public Alert(AlertLevel level, AlertDescription desc) : base(ContentType.Alert) { _level = level; _desc = desc; }
public NodeAlert(string message, Node item, AlertLevel level = AlertLevel.Information) : base(message, item, level) { }
//private Mutex sqlWriteMutex = new Mutex(); #endregion public override void RecordMessage(AlertLevel alertLevel, string collectorType, string category, MonitorStates oldState, MonitorStates newState, CollectorMessage collectorMessage) { string lastStep = ""; try { //sqlWriteMutex.WaitOne(); if (connStr.Length == 0) { lastStep = "Setting up connection string"; connStr = dbSettings.GetConnectionString(); } lastStep = "Opening connection"; using (SqlConnection conn = new SqlConnection(connStr)) { conn.Open(); lastStep = "Inserting test message into database"; string alertParamName = dbSettings.AlertFieldName.Replace("'", "''").Replace("@", ""); string collectorTypeParamName = dbSettings.CollectorTypeFieldName.Replace("'", "''").Replace("@", ""); string categoryParamName = dbSettings.CategoryFieldName.Replace("'", "''").Replace("@", ""); string previousStateParamName = dbSettings.PreviousStateFieldName.Replace("'", "''").Replace("@", ""); string currentStateParamName = dbSettings.CurrentStateFieldName.Replace("'", "''").Replace("@", ""); string detailsParamName = dbSettings.DetailsFieldName.Replace("'", "''").Replace("@", ""); string sql = dbSettings.UseSP ? dbSettings.CmndValue : string.Format("Insert {0} ({1}, {2}, {3}, {4}, {5}, {6}) values(@{1}, @{2}, @{3}, @{4}, @{5}, @{6})", dbSettings.CmndValue, dbSettings.AlertFieldName, collectorTypeParamName, categoryParamName, previousStateParamName, currentStateParamName, detailsParamName); using (SqlCommand cmnd = new SqlCommand(sql, conn)) { SqlParameter[] paramArr = new SqlParameter[] { new SqlParameter("@" + alertParamName, (byte)alertLevel), new SqlParameter("@" + collectorTypeParamName, collectorType), new SqlParameter("@" + categoryParamName, category), new SqlParameter("@" + previousStateParamName, (byte)oldState), new SqlParameter("@" + currentStateParamName, (byte)newState), new SqlParameter("@" + detailsParamName, FormatUtils.N(collectorMessage.PlainText, "No details available")) }; cmnd.Parameters.AddRange(paramArr); if (dbSettings.UseSP) { cmnd.CommandType = CommandType.StoredProcedure; } else { cmnd.CommandType = CommandType.Text; } cmnd.CommandTimeout = dbSettings.CmndTimeOut; cmnd.ExecuteNonQuery(); } } } catch (Exception ex) { throw new Exception("Error recording message in Database notifier\r\nLast step: " + lastStep, ex); } finally { //sqlWriteMutex.ReleaseMutex(); } }
protected override void ShowLaterInternal(string text, string caption, AlertLevel alertLevel) { MessageBoxIcon icon = GetIconForAlertLevel(alertLevel); ProgressUtils.InvokeLaterOnUIThread(() => MessageBox.Show(text, caption, MessageBoxButtons.OK, icon)); }
private void inferAlertLevel() { switch (description) { case AlertDescription.CloseNotify: case AlertDescription.NoRenegotiation: case AlertDescription.UserCancelled: this.level = AlertLevel.Warning; break; case AlertDescription.AccessDenied: case AlertDescription.BadCertificate: case AlertDescription.BadRecordMAC: case AlertDescription.CertificateExpired: case AlertDescription.CertificateRevoked: case AlertDescription.CertificateUnknown: case AlertDescription.DecodeError: case AlertDescription.DecompressionFailure: case AlertDescription.DecryptError: case AlertDescription.DecryptionFailed_RESERVED: case AlertDescription.ExportRestriction: case AlertDescription.HandshakeFailure: case AlertDescription.IlegalParameter: case AlertDescription.InsuficientSecurity: case AlertDescription.InternalError: case AlertDescription.ProtocolVersion: case AlertDescription.RecordOverflow: case AlertDescription.UnexpectedMessage: case AlertDescription.UnknownCA: case AlertDescription.UnsupportedCertificate: case AlertDescription.UnsupportedExtension: default: this.level = AlertLevel.Fatal; break; } }
public LoadAlert(string message, IList <Load> items, AlertLevel level = AlertLevel.Information) : base(message, items, level) { }
public AlertProtocolMessage(byte[] buffer) { level = (AlertLevel)(buffer[0]); desc = (AlertDescription)(buffer[1]); }
/* Length of this message is 2 bytes */ public AlertProtocolMessage(AlertLevel l, AlertDescription d) { level = l; desc = d; }
public void AddNotification(AlertLevel level, string message, string identifer) { throw new NotImplementedException(); }
public void SendAlert(AlertLevel level, AlertDescription description) { this.SendAlert(new Alert(level, description)); }
/// <summary> /// Shows a desktop alert. /// </summary> /// <param name="level">The alert level.</param> /// <param name="message">The message to display.</param> public void ShowAlert(AlertLevel level, string message) { var args = new AlertNotificationArgs(level, message); ShowAlert(args); }
/// <summary> /// Create a new <see cref="Alert"/> with the provided properties. /// </summary> /// <typeparam name="TModel">The type of the model.</typeparam> /// <typeparam name="TProperty"></typeparam> /// <param name="model">The model data object.</param> /// <param name="propSelector">An expression (lambda method) selecting the property which the alert is for.</param> /// <param name="message">The message for the alert.</param> /// <param name="level">The level of the alert.</param> /// <returns>The newly created alert.</returns> public static Alert CreateAlert <TModel, TProperty>(this TModel model, Expression <Func <TModel, TProperty> > propSelector, string message = "", AlertLevel level = AlertLevel.Safe) where TModel : class, IAlertableModel { var memberName = ((MemberExpression)propSelector.Body).Member.Name; var info = model.GetMetadata(propSelector); var value = propSelector.Compile()(model); return(new Alert(memberName, message, level, info, value)); }
/// <summary> /// Initializes a new instance of <see cref="AlertNotificationArgs"/>. /// </summary> /// <param name="level">The alert level.</param> /// <param name="message">The alert message.</param> public AlertNotificationArgs(AlertLevel level, [param : Localizable(true)] string message) { Level = level; Message = message; }
public LoadAlert(string message, Load item, AlertLevel level = AlertLevel.Information) : base(message, item, level) { }
internal TlsException( AlertLevel level, AlertDescription description) : this (level, description, Alert.GetAlertMessage(description)) { }
public LoadAlert(string alertID, IList <Load> items, string message, AlertLevel level = AlertLevel.Information) : base(alertID, items, message, level) { }
internal TlsException( AlertLevel level, AlertDescription description) : this(level, description, Alert.GetAlertMessage(description)) { }
public LoadAlert(string alertID, Load item, string message, AlertLevel level = AlertLevel.Information) : base(alertID, item, message, level) { }
public NodeAlert(string alertID, Node item, string message, AlertLevel level = AlertLevel.Information) : base(alertID, item, message, level) { }
public TabHeaderTemplate(AlertLevel alertLevel, string title, string toolTip) { _al = alertLevel; _title = title; _toolTip = toolTip; }
public NodeAlert(string message, IList <Node> items, AlertLevel level = AlertLevel.Information) : base(message, items, level) { }
/// <summary> /// Queue an alert to be displayed. Displayed immediately if there is currently none. If there is an existing /// alert with the same name, it will be replaced with the latest one. /// </summary> /// <param name="id">Unique ID for the queued alert.</param> /// <param name="level">Level of important of the alert.</param> /// <param name="message">Message to be displayed.</param> /// <param name="button">Info to populate optional button.</param> public void QueueAlert([NotNull] string id, AlertLevel level, [NotNull] string message, (string text, Action action)?button = null)
private static string GetPreformedAlertLevel(AlertLevel alertLevel) => alertLevel switch {
public IconSet GetIcon(AlertLevel level) { return(level.GetIcon()); }
public void AddNotification(AlertLevel level, string message) { AddNotification(level, message, ""); }
public void RaiseAlert(Model.WorkQueue queueItem, AlertLevel level, string message) { if (WorkQueueProperties.AlertFailedWorkQueue || level == AlertLevel.Critical) { ServerPlatform.Alert(AlertCategory.Application, level, queueItem.WorkQueueTypeEnum.ToString(), AlertTypeCodes.UnableToProcess, GetWorkQueueContextData(queueItem), TimeSpan.Zero, "Work Queue item failed: Type={0}, GUID={1}: {2}", queueItem.WorkQueueTypeEnum, queueItem.GetKey(), message); } }
/// <summary> /// Raise an alert regarding a Node, merging it with any previous alerts with the same ID /// </summary> /// <param name="alertID">The identifier for the alert type. Multiple alerts with the same ID will be merged.</param> /// <param name="node">The node to which the alert refers.</param> /// <param name="message">The message to display.</param> /// <param name="level">The level of the alert.</param> public void RaiseAlert(string alertID, Node node, string message, AlertLevel level = AlertLevel.Information) { RaiseAlert(new NodeAlert(alertID, node, message, level)); }
/// <summary> /// Send an alert level (ALER) command. /// </summary> /// <param name="alertLevel">The alert level.</param> /// <returns>The response.</returns> public SnppResponse Alert(AlertLevel alertLevel) { return Send(String.Format(CultureInfo.InvariantCulture, "ALER {0}", (int)alertLevel)); }
public void SendAlert(string message, AlertLevel level) { if(OnAlert != null) OnAlert(message, level); }
/** * Terminate this connection with an alert. * <p/> * Can be used for normal closure too. * * @param alertLevel The level of the alert, an be AlertLevel.fatal or AL_warning. * @param alertDescription The exact alert message. * @throws IOException If alert was fatal. */ private void FailWithError(AlertLevel alertLevel, AlertDescription alertDescription) { /* * Check if the connection is still open. */ if (!closed) { /* * Prepare the message */ this.closed = true; if (alertLevel == AlertLevel.fatal) { /* * This is a fatal message. */ this.failedWithError = true; } SendAlert(alertLevel, alertDescription); rs.Close(); if (alertLevel == AlertLevel.fatal) { throw new IOException(TLS_ERROR_MESSAGE); } } else { throw new IOException(TLS_ERROR_MESSAGE); } }
public Alert( AlertLevel level, AlertDescription description) { this.level = level; this.description = description; }
private void ProcessAlert(AlertLevel alertLevel, AlertDescription alertDesc) { switch (alertLevel) { case AlertLevel.Fatal: throw new TlsException(alertLevel, alertDesc); case AlertLevel.Warning: default: switch (alertDesc) { case AlertDescription.CloseNotify: this.context.ConnectionEnd = true; break; } break; } }
/// <summary> /// Raise an alert regarding an Element, merging it with any previous alerts with the same ID /// </summary> /// <param name="alertID">The identifier for the alert type. Multiple alerts with the same ID will be merged.</param> /// <param name="element">The element to which the alert refers.</param> /// <param name="message">The message to display.</param> /// <param name="level">The level of the alert.</param> public void RaiseAlert(string alertID, Element element, string message, AlertLevel level = AlertLevel.Information) { RaiseAlert(new ElementAlert(alertID, element, message, level)); }
/// <summary> /// Raise a progress alert, merging it with any previous alerts with the same ID /// </summary> /// <param name="alertID">The identifier for the alert type. Multiple alerts with the same ID will be merged.</param> /// <param name="message">The message to display</param> /// <param name="progress">The progress of the operation</param> /// <param name="level">The level of the alert</param> public void RaiseAlert(string alertID, string message, double progress, AlertLevel level = AlertLevel.Information) { RaiseAlert(new ProgressAlert(alertID, message, progress, level)); }
public static DateTime GetAlertTime(DateTime appointment, AlertLevel alertLevel) { throw new NotImplementedException("Please implement the (static) Appointment.GetAlertTime() method"); }
public IProtocolMessage CreateAlertMessage(AlertLevel level, AlertDescription desc) { AlertProtocolMessage apm = new AlertProtocolMessage(level, desc); return(apm); }
// Constructor public KeyFob(BluetoothLEDevice device) { this.device = device; addressString = device.BluetoothAddress.ToString("x012"); try { linkLossService = device.GetGattService(GattServiceUuids.LinkLoss); } catch (Exception) { // e.HResult == 0x80070490 means that the device doesn't have the requested service. // We can still alert on the phone upon disconnection, but cannot ask the device to alert. // linkLossServer will remain equal to null. } if (localSettings.Values.ContainsKey(addressString)) { string[] values = ((string)localSettings.Values[addressString]).Split(','); alertOnPhone = bool.Parse(values[0]); alertOnDevice = bool.Parse(values[1]); alertLevel = (AlertLevel)Enum.Parse(typeof(AlertLevel), values[2]); } }
public CollectorState RefreshStates(bool disablePollingOverrides = false) { AbortPolling = false; IsBusyPolling = true; CollectorState globalState = CollectorState.Good; ResetAllOverrides(); Stopwatch sw = new Stopwatch(); sw.Start(); //First get collectors with no dependancies List <CollectorHost> rootCollectorHosts = (from c in CollectorHosts where c.ParentCollectorId.Length == 0 select c).ToList(); if (ConcurrencyLevel > 1) { ParallelOptions po = new ParallelOptions() { MaxDegreeOfParallelism = ConcurrencyLevel }; ParallelLoopResult parResult = Parallel.ForEach(rootCollectorHosts, po, collectorHost => CollectorHostRefreshCurrentState(collectorHost, disablePollingOverrides)); if (!parResult.IsCompleted) { SendNotifierAlert(AlertLevel.Error, DetailLevel.All, "Error querying collectors in parralel"); } } else //use old single threaded way { //Refresh states foreach (CollectorHost collectorHost in rootCollectorHosts) { CollectorHostRefreshCurrentState(collectorHost, disablePollingOverrides); } } sw.Stop(); PCSetCollectorsQueryTime(sw.ElapsedMilliseconds); LastRefreshDurationMS = sw.ElapsedMilliseconds; #if DEBUG Trace.WriteLine(string.Format("RefreshStates - Global time: {0}ms", sw.ElapsedMilliseconds)); #endif #region Get Global state //All disabled if (CollectorHosts.Count == CollectorHosts.Count(c => c.CurrentState.State == CollectorState.Disabled || c.CurrentState.State == CollectorState.NotInServiceWindow)) { globalState = CollectorState.Disabled; } //All NotAvailable else if (CollectorHosts.Count == CollectorHosts.Count(c => c.CurrentState.State == CollectorState.NotAvailable)) { globalState = CollectorState.NotAvailable; } //All good else if (CollectorHosts.Count == CollectorHosts.Count(c => c.CurrentState.State == CollectorState.Good || c.CurrentState.State == CollectorState.None || c.CurrentState.State == CollectorState.Disabled || c.CurrentState.State == CollectorState.NotInServiceWindow)) { globalState = CollectorState.Good; } //Error state else if (CollectorHosts.Count == CollectorHosts.Count(c => c.CurrentState.State == CollectorState.Error || c.CurrentState.State == CollectorState.ConfigurationError || c.CurrentState.State == CollectorState.Disabled || c.CurrentState.State == CollectorState.NotInServiceWindow)) { globalState = CollectorState.Error; } else { globalState = CollectorState.Warning; } AlertLevel globalAlertLevel = AlertLevel.Info; if (globalState == CollectorState.Error) { globalAlertLevel = AlertLevel.Error; } else if (globalState == CollectorState.Warning) { globalAlertLevel = AlertLevel.Warning; } #endregion sw.Restart(); SendNotifierAlert(globalAlertLevel, DetailLevel.Summary, "GlobalState"); sw.Stop(); PCSetNotifiersSendTime(sw.ElapsedMilliseconds); IsBusyPolling = false; CurrentState = globalState; return(globalState); }
//option to re-try technical failures? #region Async Methods /// <summary> /// Send an alert level (ALER) command asynchronously. /// </summary> /// <param name="alertLevel">The alert level.</param> /// <returns>The response.</returns> public async Task<SnppResponse> AlertAsync(AlertLevel alertLevel) { return await SendAsync(String.Format(CultureInfo.InvariantCulture, "ALER {0}", (int)alertLevel)); }
/// <summary> /// Constructor /// </summary> /// <param name="level"></param> /// <param name="message"></param> public AlertNotificationArgs(AlertLevel level, string message) { this.Level = level; this.Message = message; }
internal Alert(AlertDescription description, AlertLevel level) { this.Level = level; this.Description = description; }
internal List <Record> CreateAlert(AlertLevel level, AlertDescription desc) { IProtocolMessage message = m_ProtocolLayer.CreateAlertMessage(level, desc); return(m_MessageAdapter.ToRecords(message)); }
internal void SendAlert(AlertLevel alertLevel, AlertDescription alertDescription) { byte[] error = new byte[2]; error[0] = (byte)alertLevel; error[1] = (byte)alertDescription; rs.WriteMessage(ContentType.alert, error, 0, 2); }
public static void Print(AlertLevel alertLevel, string groupName, string message, string stacktrace = null, Object obj = null) { instance.Log(alertLevel, groupName, message, stacktrace, obj); }
public void SendAlert( AlertLevel level, AlertDescription description) { this.SendAlert(new Alert(level, description)); }
public void Log(AlertLevel alertLevel, string groupName, string message, string stacktrace = null, Object obj = null) { Output(alertLevel, groupName, message, stacktrace, obj); }