/// <summary>
 /// 
 /// </summary>
 /// <param name="message"></param>
 public void AddHistoryItem(TickerMessage message)
 {
     if (message != null && message.Text != null && message.Text.Length > 0)
     {
         this.historyListBox.Invoke(new AddMessageHandler(this.AddMessage), message.Text);
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="message"></param>
 public void AddHistoryItem(TickerMessage message)
 {
     if (message != null && message.Text != null && message.Text.Length > 0)
     {
         this.historyListBox.Invoke(new AddMessageHandler(this.AddMessage), message.Text);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Fired when the current text scrolls off of the bounds.  Increments
        /// the callback and executes it to retrieve the next text.
        /// </summary>
        /// <param name="args">Standard EventArgs</param>
        protected virtual void OnScrollComplete(EventArgs args)
        {
            if (this.messageCallbacks.Count == 0)
            {
                this.currentCallbackIndex = -1;
                this.currentMessage.Text  = "";
            }
            else
            {
                this.currentCallbackIndex++;
                if (this.currentCallbackIndex >= this.messageCallbacks.Count)
                {
                    this.currentCallbackIndex = 0;
                }

                Object callbackObject = this.messageCallbacks[this.currentCallbackIndex];
                if (callbackObject is GetMessageCallback)
                {
                    GetMessageCallback messageCallback = (GetMessageCallback)callbackObject;

                    try
                    {
                        this.currentMessage = messageCallback();
                        this.Invalidate();
                        if (this.currentMessage.RemoveCallback == true)
                        {
                            // Remove the callback
                            this.messageCallbacks.Remove(messageCallback);

                            // Push the index back one so that the next one
                            // won't get skipped
                            this.currentCallbackIndex--;
                        }
                    }
                    catch (Exception ex)
                    {
                        this.currentMessage       = new TickerMessage();
                        this.currentMessage.Text  = "*** TickerMessageCallback Exception: " + messageCallback.Method.Name + " ***";
                        this.currentMessage.Color = Color.Red;
                        Trace.WriteLine(this.currentMessage.Text);
                        Trace.WriteLine(ex.ToString());
                    }
                }
                else
                {
                    this.messageCallbacks.Remove(callbackObject);
                    this.currentMessage      = new TickerMessage();
                    this.currentMessage.Text = "";
                    this.currentCallbackIndex--;
                }
            }

            if (this.ScrollComplete != null)
            {
                this.ScrollComplete(this, args);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Fired when the current text scrolls off of the bounds.  Increments
        /// the callback and executes it to retrieve the next text.
        /// </summary>
        /// <param name="args">Standard EventArgs</param>
        protected virtual void OnScrollComplete(EventArgs args)
        {
            if (this.messages.Count == 0)
            {
                this.currentMessage.Text = "";
            }
            else
            {
                this.currentMessage = this.messages.Dequeue();
            }

            if (this.currentMessage != null)
            {
                this.tickerHistory.AddHistoryItem(this.currentMessage);
            }

            if (this.ScrollComplete != null)
            {
                this.ScrollComplete(this, args);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Fired when the current text scrolls off of the bounds.  Increments
        /// the callback and executes it to retrieve the next text. 
        /// </summary>
        /// <param name="args">Standard EventArgs</param>
        protected virtual void OnScrollComplete( EventArgs args )
        {
            if ( this.messageCallbacks.Count == 0 )
            {
                this.currentCallbackIndex = -1;
                this.currentMessage.Text = "";
            }
            else
            {
                this.currentCallbackIndex++;
                if ( this.currentCallbackIndex >= this.messageCallbacks.Count )
                    this.currentCallbackIndex = 0;

                Object callbackObject = this.messageCallbacks[this.currentCallbackIndex];
                if ( callbackObject is GetMessageCallback )
                {
                    GetMessageCallback messageCallback = (GetMessageCallback)callbackObject;

                    try
                    {
                        this.currentMessage = messageCallback();
                        this.Invalidate();
                        if ( this.currentMessage.RemoveCallback == true )
                        {
                            // Remove the callback
                            this.messageCallbacks.Remove( messageCallback );

                            // Push the index back one so that the next one
                            // won't get skipped
                            this.currentCallbackIndex--;
                        }
                    }
                    catch( Exception ex )
                    {
                        this.currentMessage = new TickerMessage();
                        this.currentMessage.Text = "*** TickerMessageCallback Exception: " + messageCallback.Method.Name + " ***";
                        this.currentMessage.Color = Color.Red;
                        Trace.WriteLine( this.currentMessage.Text );
                        Trace.WriteLine( ex.ToString() );
                    }
                }
                else
                {
                    this.messageCallbacks.Remove( callbackObject );
                    this.currentMessage = new TickerMessage();
                    this.currentMessage.Text = "";
                    this.currentCallbackIndex--;
                }
            }

            if( this.ScrollComplete != null )
            {
                this.ScrollComplete( this, args );
            }
        }