예제 #1
0
            public StatusMessage(string?message, Colour32?colour, TimeSpan?ttl)
            {
                m_sb     = new StringBuilder(message ?? string.Empty);
                m_colour = colour ?? DefaultStatusColour;

                // Add the status message to the stack
                lock (MessageStack)
                    MessageStack.Add(this);

                // Notify of new status
                ValueChanged?.Invoke(this, EventArgs.Empty);

                // If the status expires after a time, set a timer to remove it
                if (ttl != null)
                {
                    m_expire_timer = new Timer(HandleExpire, this, (int)ttl.Value.TotalMilliseconds, -1);
                    void HandleExpire(object?state)
                    {
                        m_expire_timer?.Dispose();
                        if (state is StatusMessage sm)
                        {
                            sm.Dispose();
                        }
                    }
                }
            }
예제 #2
0
 internal static void UpdateMessageBox(string mess = "")
 {
     if (mess != "")
     {
         _mess.Add(mess);
     }
     Redraw(_mess, _sysmess, _topLabel);
 }