private void SetColorByLevel(NotifyLevel level)
        {
            _backupForegroundColor = Console.ForegroundColor;
            var newColor = Console.ForegroundColor;

            switch (level)
            {
            case NotifyLevel.Debug:
                newColor = ConsoleColor.DarkGray;
                break;

            case NotifyLevel.Info:
                newColor = ConsoleColor.White;
                break;

            case NotifyLevel.Warn:
                newColor = ConsoleColor.DarkYellow;
                break;

            case NotifyLevel.Error:
                newColor = ConsoleColor.Red;
                break;

            case NotifyLevel.Fatal:
                newColor = ConsoleColor.DarkRed;
                break;
            }

            Console.ForegroundColor = newColor;
        }
 public void ShowNotifyMessage(string message, NotifyLevel level)
 {
     if (message != null && message.Length > 0) 
     {
         this._notifyViewModel.ShowMessage(message, level);
     }
 }
예제 #3
0
        private static void WriteInfoToLog(NotifyLevel level, string msg)
        {
            switch (level)
            {
            case NotifyLevel.DISPLAY:
                break;

            case NotifyLevel.ALL:
                LogHelper.LogHelper.WriteLog(LogHelper.LogLevel.ALL, msg);
                break;

            case NotifyLevel.FATAL:
                LogHelper.LogHelper.WriteLog(LogHelper.LogLevel.FATAL, msg);
                break;

            case NotifyLevel.ERROR:
                LogHelper.LogHelper.WriteLog(LogHelper.LogLevel.ERROR, msg);
                break;

            case NotifyLevel.WARNING:
                LogHelper.LogHelper.WriteLog(LogHelper.LogLevel.WARNING, msg);
                break;

            case NotifyLevel.DEBUG:
                LogHelper.LogHelper.WriteLog(LogHelper.LogLevel.DEBUG, msg);
                break;

            case NotifyLevel.INFO:
                LogHelper.LogHelper.WriteLog(LogHelper.LogLevel.INFO, msg);
                break;

            default:
                break;
            }
        }
예제 #4
0
 public static void Notify(NotifyLevel level, string info)
 {
     if (isSetNitifyBoard)
     {
         ShowInfo(level, info);
     }
     WriteInfoToLog(level, info);
 }
        public async void Notify(NotifyLevel level, string message)
        {
            _decoratedNotifier?.Notify(level, message);

            SetColorByLevel(level);
            await Console.Out.WriteLineAsync($"{message}");

            ResetColor();
        }
예제 #6
0
        public static void Notify(NotifyLevel level, string info, params object[] args)
        {
            string msg = string.Format(info, args);

            if (isSetNitifyBoard)
            {
                ShowInfo(level, msg);
            }
            WriteInfoToLog(level, msg);
        }
예제 #7
0
        private async Task SendNotification(string referenceId, string message, NotifyLevel level)
        {
            CommandPreservationNotify command = new CommandPreservationNotify();

            command.Message     = message;
            command.NotifyLevel = level;
            command.ReferenceId = referenceId;

            await Mediator.Send(command);
        }
예제 #8
0
        public static void Notify(NotifyLevel level, string info, Exception ex)
        {
            string msg = string.Format("{0}_{1}", info, ex.Message);

            if (isSetNitifyBoard)
            {
                ShowInfo(level, msg);
            }

            WriteInfoToLog(level, info, ex);
        }
        private async Task SendNotification(string referenceId, string message, NotifyLevel level, ICollection <NotificationDetailModel> details, bool isComplete = false)
        {
            CommandPreservationNotify command = new CommandPreservationNotify();

            command.Message     = message;
            command.NotifyLevel = level;
            command.ReferenceId = referenceId;
            command.Complete    = isComplete;
            command.Details     = details;

            await Mediator.Send(command);
        }
예제 #10
0
        private static void ReportInvoke(string msg, Exception excp, NotifyLevel level)
        {
            if (excp != null)
            {
                System.Diagnostics.Debug.WriteLine("Reported:Exception " + excp.ToString());
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Reported: " + msg + " / lv " + level.ToString());
            }

            reports.Add(new Tuple<string, Exception, NotifyLevel, DateTime>(msg, excp, level, DateTime.Now));
            ReportRegistered(msg, excp, level);
        }
 private async Task SendNotification(string referenceId, string message, NotifyLevel level, bool isComplete = false)
 {
     await SendNotification(referenceId, message, level, null, isComplete);
 }
예제 #12
0
        private static void ShowInfo(NotifyLevel level, string msg)
        {
            NotifyItem notifyItem = new NotifyItem(level, msg);

            notifyBoard.DisplayNitifyItemInfo(notifyItem);
        }
예제 #13
0
 public static void Notify(NotifyLevel level, string message)
 {
     _defaultNotifier?.Notify(level, message);
 }
예제 #14
0
 public NotifyItem(NotifyItem othre)
 {
     notifyLevel = othre.notifyLevel;
     message     = othre.message;
 }
예제 #15
0
 public NotifyItem(NotifyLevel level, string msg)
 {
     level   = notifyLevel;
     message = msg;
 }
예제 #16
0
 public static void Report(string s, NotifyLevel level = NotifyLevel.Notify)
 {
     ReportInvoke(s, null, level);
 }
예제 #17
0
 public async void Notify(NotifyLevel level, string message)
 {
     _decoratedNotifier?.Notify(level, message);
     await Console.Out.WriteLineAsync($"{level.ToString()}:{message}");
 }