Example #1
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            Queue <string> localmsgs = new Queue <string>();

            lock (msglocker)
            {
                while (msgs.Count > 0 && localmsgs.Count < 6)
                {
                    localmsgs.Enqueue(msgs.Dequeue());
                }
            }

            if (localmsgs.Count > 0)
            {
                Messager.Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() =>
                {
                    while (localmsgs.Count > 0)
                    {
                        Messager.AppendText(localmsgs.Dequeue());
                    }
                    Messager.ScrollToEnd();
                }));
            }
        }