Beispiel #1
0
        /// <summary>
        /// Sets a warning with the given text to run on the warning system.
        /// If multiple warnings are occurring at once, the text will slide by.
        /// To stop the warning, use the StopWarning() method
        /// </summary>
        /// <param name="text">The warning message teo display</param>
        public void SetWarning(string text, bool fromRobot = false)
        {
            // If it's already being warned of or it's in the ignore list, don't do anything
            if (WarningList.Contains(text) || IgnoreList.Contains(text))
            {
                return;
            }
            // If the warning is being sent from the robot, add it to the robot's list of warnings
            if (fromRobot)
            {
                NtAddedWarnings.Add(text);
            }
            WarningList.Add(text);

            // Set the counter so that this warning is displayed next.
            counter = WarningList.IndexOf(text) - 1;

            if (WarningList.Count > 1)
            {
                // Execute once to start right away
                Execute();

                StartExecuting();
            }
            else
            {
                WarningMessage = text;
                StartExecuting(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Removes the warning with the given text from the warning queue
        /// </summary>
        /// <param name="text">The texr warning to stop.</param>
        public void StopWarning(string text, bool fromRobot = false)
        {
            if (WarningList.Contains(text))
            {
                WarningList.Remove(text);
            }
            // If the warning had been dispatched from the robot, remove it.
            if (fromRobot && NtAddedWarnings.Contains(text))
            {
                NtAddedWarnings.Remove(text);
            }

            // If we have no text to show, stop executing
            if (WarningList.Count <= 0)
            {
                StopAnimation();
            }
            else if (WarningList.Count == 1)
            {
                StopExecuting();
                WarningMessage = WarningList.ElementAt(0);
            }
        }