/// <summary>
        /// Creates a debug utility.
        /// </summary>
        public NSFDebugUtility()
            : base("DebugUtility")
        {
            eventHandler            = new NSFEventHandler(Name, new NSFEventThread(Name, NSFOSThread.LowestPriority));
            writeToConsoleEvent     = new NSFDataEvent <NSFString>("WriteToConsole", eventHandler);
            writeLineToConsoleEvent = new NSFDataEvent <NSFString>("WriteLineToConsole", eventHandler);

            eventHandler.LoggingEnabled = false;
            eventHandler.addEventReaction(writeToConsoleEvent, performWriteToConsole);
            eventHandler.addEventReaction(writeLineToConsoleEvent, performWriteLineToConsole);
            eventHandler.startEventHandler();
        }
        /// <summary>
        /// Creates a debug utility.
        /// </summary>
        public NSFDebugUtility()
            : base("DebugUtility")
        {
            eventHandler = new NSFEventHandler(Name, new NSFEventThread(Name, NSFOSThread.LowestPriority));
            writeToConsoleEvent = new NSFDataEvent<NSFString>("WriteToConsole", eventHandler);
            writeLineToConsoleEvent = new NSFDataEvent<NSFString>("WriteLineToConsole", eventHandler);

            eventHandler.LoggingEnabled = false;
            eventHandler.addEventReaction(writeToConsoleEvent, performWriteToConsole);
            eventHandler.addEventReaction(writeLineToConsoleEvent, performWriteLineToConsole);
            eventHandler.startEventHandler();
        }
        /// <summary>
        /// Creates a trace log
        /// </summary>
        /// <param name="name">The name of the log.</param>
        /// <remarks>
        /// By default, thread priority is set to lowest.
        /// </remarks>
        public NSFTraceLog(NSFString name)
            : base(name)
        {
            eventHandler = new NSFEventHandler(Name, new NSFEventThread(Name, NSFOSThread.LowestPriority));
            eventHandler.LoggingEnabled = false;

            traceAddEvent = new NSFDataEvent<NSFXMLElement>(TraceAddString, eventHandler);
            traceSaveEvent = new NSFDataEvent<NSFString>(TraceSaveString, eventHandler);

            eventHandler.addEventReaction(traceAddEvent, addTraceToLog);
            eventHandler.addEventReaction(traceSaveEvent, saveTrace);

            eventHandler.startEventHandler();

            addTrace(NSFTraceTags.InformationalTag, NSFTraceTags.NameTag, "TraceStart");
        }
        /// <summary>
        /// Creates a trace log
        /// </summary>
        /// <param name="name">The name of the log.</param>
        /// <remarks>
        /// By default, thread priority is set to lowest.
        /// </remarks>
        public NSFTraceLog(NSFString name)
            : base(name)
        {
            eventHandler = new NSFEventHandler(Name, new NSFEventThread(Name, NSFOSThread.LowestPriority));
            eventHandler.LoggingEnabled = false;

            traceAddEvent  = new NSFDataEvent <NSFXMLElement>(TraceAddString, eventHandler);
            traceSaveEvent = new NSFDataEvent <NSFString>(TraceSaveString, eventHandler);

            eventHandler.addEventReaction(traceAddEvent, addTraceToLog);
            eventHandler.addEventReaction(traceSaveEvent, saveTrace);

            eventHandler.startEventHandler();

            addTrace(NSFTraceTags.InformationalTag, NSFTraceTags.NameTag, "TraceStart");
        }
示例#5
0
        /// <summary>
        /// Creates a scheduled action.
        /// </summary>
        /// <param name="name">The name of the scheduled action.</param>
        /// <param name="action">The action to execute.</param>
        /// <param name="eventThread">The thread on which the action will execute.</param>
        /// <remarks>
        /// Use null or String.Empty for the name if no name is desired.
        /// The action will be logged in the trace if the name is anything other than null or String.Empty.
        /// </remarks>
        public NSFScheduledAction(NSFString name, NSFVoidAction <NSFContext> action, NSFEventThread eventThread)
            : base(name)
        {
            Actions += action;
            Actions.setExceptionAction(handleActionException);

            eventHandler        = new NSFEventHandler(Name, eventThread);
            executeActionsEvent = new NSFEvent(Name, this, eventHandler);

            eventHandler.LoggingEnabled = false;
            eventHandler.addEventReaction(executeActionsEvent, executeActions);

            eventHandler.startEventHandler();
        }