public void SetDigit( int Adress, int value, bool flash = false, bool ExtraVisible = false, bool ExtraFlashing = false, PriorityLevels Prio = PriorityLevels.Normal) { T_BOARD_ADDRESS tableIndex = this.Board.Board_GetTableIndex(0U, (ushort)Adress); uint num = (uint)value; if (flash) { num |= 16U; } if (ExtraVisible) { num |= 32U; } if (ExtraFlashing) { num |= 64U; } tableIndex.priority = 1U; if ((int)tableIndex.datauint != (int)num) { tableIndex.updates = 3U; } tableIndex.datauint = num; }
public void ElevatePriority() { if (Priority.PriorityClassifier((ushort)PriorityLevel) == PriorityLevels.Normal) { PriorityLevel = PriorityLevels.Emergency_MIN; } }
// ===================== Methods ===================== // public Task(string description, PriorityLevels priority, DateTime dateTime) { if (!this.ValidateTaskData(description, priority, dateTime)) { throw new InvalidOperationException("Something went wrong in ValidateTaskData"); } this.Description = description; this.PriorityLevel = priority; this.DateTime = dateTime; }
/// <summary> /// Validates arguments that will later be sent to the Task constructor /// </summary> /// <returns>True if there is no exception</returns> private bool ValidateTaskData(string description, PriorityLevels priority, DateTime dateTime) { if (String.IsNullOrWhiteSpace(description)) { throw new ArgumentNullException("description", "description cannot be empty"); } if (!Enum.IsDefined(typeof(PriorityLevels), priority)) { throw new ArgumentException("priority must be one of those specified in the enum", "priority"); } if (dateTime <= DateTime.Now) { throw new ArgumentException("Date and time must cannot be set to the past"); } return(true); }
public Log(FileInfo fileInfo, PriorityLevels filePriority = PriorityLevels.UltraLow, FileWriteModes writeMode = FileWriteModes.Overwrite, PriorityLevels debugPriority = PriorityLevels.UltraLow, PriorityLevels consolePriority = PriorityLevels.UltraLow, OutputFormats output = OutputFormats.File | OutputFormats.Debugger, bool enable = true) { FileInfo = fileInfo; FilePriority = filePriority; FileWriteMode = writeMode; DebuggerPriority = debugPriority; ConsolePriority = consolePriority; Output = output; IsEnabled = enable; WriteToFileCount = 0; Messages = new ConcurrentBag <LogMessage>(); _logCount++; if (_logCount == 1) { LogToFileBackgroundTask(); } }
public static bool HasAtLeastPriority(PriorityLevels matchingPriority, PriorityLevels messagePriority) { return(messagePriority >= matchingPriority); }
public static bool HasPriority(PriorityLevels matchingPriority, PriorityLevels messagePriority) { return(messagePriority == matchingPriority); }
public List <LogMessage> GetMessagesByAtLeastPriority(PriorityLevels matchingPriority) { return(Messages.ToList().FindAll(m => HasAtLeastPriority(matchingPriority, m.Priority))); }
public Log(PriorityLevels filePriority = PriorityLevels.UltraLow, FileWriteModes writeMode = FileWriteModes.Overwrite, PriorityLevels debugPriority = PriorityLevels.UltraLow, PriorityLevels consolePriority = PriorityLevels.UltraLow, OutputFormats output = OutputFormats.File | OutputFormats.Debugger, bool enable = true) : this(new FileInfo($@"{ AppDomain.CurrentDomain.BaseDirectory }\{ DefaultGlobalLogFilename }"), filePriority, writeMode, debugPriority, consolePriority, output, enable) { }