Beispiel #1
0
    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;
     }
 }
Beispiel #3
0
        // ===================== 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;
        }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        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();
            }
        }
Beispiel #6
0
 public static bool HasAtLeastPriority(PriorityLevels matchingPriority, PriorityLevels messagePriority)
 {
     return(messagePriority >= matchingPriority);
 }
Beispiel #7
0
 public static bool HasPriority(PriorityLevels matchingPriority, PriorityLevels messagePriority)
 {
     return(messagePriority == matchingPriority);
 }
Beispiel #8
0
 public List <LogMessage> GetMessagesByAtLeastPriority(PriorityLevels matchingPriority)
 {
     return(Messages.ToList().FindAll(m => HasAtLeastPriority(matchingPriority, m.Priority)));
 }
Beispiel #9
0
 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)
 {
 }