Esempio n. 1
0
        private void ExecuteActions(LogEvent le)
        {
            Txt.SelectionStart = int.MaxValue - 1;
            int selectionStart = Txt.SelectionStart;

            Txt.SelectedText = le.Message + Environment.NewLine;
            //txt.AppendText(le.Message + Environment.NewLine);

            foreach (Action action in le.Actions)
            {
                switch (action.ActionType)
                {
                case ActionTypes.Highlight:
                    ExecHighlight(action, le, selectionStart);
                    break;

                case ActionTypes.HighlightMatch:
                    ExecHighlightMatch(action, le, selectionStart);
                    break;

                case ActionTypes.PopUp:
                    ViewerUtils.ExecuteNonViewerAction(action, le.Message);
                    break;

                case ActionTypes.PlaySound:
                    ViewerUtils.ExecuteNonViewerAction(action, le.Message);
                    break;

                case ActionTypes.Execute:
                    ViewerUtils.ExecuteNonViewerAction(action, le.Message);
                    break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Contructor
        /// </summary>
        /// <param name="message"></param>
        /// <param name="actions"></param>
        /// <param name="getActions"></param>
        /// <param name="structure"></param>
        public LogEvent(string message, List <Action> actions, bool getActions, string structure)
        {
            Structure = structure;

            Message = message;
            if (getActions)
            {
                Actions = ViewerUtils.GetActions(actions, Message);
            }
            else
            {
                Actions = actions;
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Adds the event.
        /// </summary>
        private void InvokedAddEvent(LogEvent le, bool forceShow)
        {
            if (RemoveWhitespace)
            {
                le.Message = le.Message.Trim();
            }

            if (CacheIfPuased(le))
            {
                return;
            }

            try
            {
                var reason        = ViewerUtils.IgnoreReasons.DoNotIgnore;
                var ignoreMessage = false;
                if (!forceShow)
                {
                    ignoreMessage = ViewerUtils.IgnoreEvent(le, out reason);
                }

                if (AddIgnoreMessage(ignoreMessage, reason))
                {
                    return;
                }


                if (le.Actions.Count > 0)
                {
                    ExecuteActions(le);
                }
                else
                {
                    Txt.SelectionStart = int.MaxValue - 1;
                    Txt.SelectedText   = le.Message + Environment.NewLine;
                }

                EnforceBufferSize();

                RaiseHasHiddenMessages(HasHiddenMessages());
            }
            catch (ObjectDisposedException ex)
            {
                _log.Warn(GetHashCode(), ex.ToString(), ex);
            }
            catch (Exception ex)
            {
                throw ExceptionManager.HandleException(GetHashCode(), ex);
            }
        }