/// <summary>
 /// Notification that the tab has been switched.  We may need to check if the scrollbar is visible
 /// </summary>
 private void FucoFilterAndFind_TabSwitched(object sender, TUcoFilterAndFind.TContextEventArgs e)
 {
     FPnlFilterFind_Resize(sender, null);
 }
Example #2
0
        void MultiEventHandler(object sender, EventArgs e, string AEventName)
        {
            TUcoFilterAndFind.TContextEventArgs ContextArgs = e as TUcoFilterAndFind.TContextEventArgs;

            txtEventsLog.Text += DateTime.Now.ToLongTimeString() + "   Event: '" + AEventName + "'";

            if (ContextArgs == null)
            {
                txtEventsLog.Text += "." + Environment.NewLine;
            }
            else
            {
                if (ContextArgs is TUcoFilterAndFind.TContextEventExtButtonDepressedArgs)
                {
                    txtEventsLog.Text += "  (Context: '" + ContextArgs.Context.ToString("G") + "' - Button is " +
                                         (((TUcoFilterAndFind.TContextEventExtButtonDepressedArgs)ContextArgs).ButtonIsDepressed ? "depressed" :
                                          "not depressed") + ")." +
                                         Environment.NewLine;
                }
                else if (ContextArgs is TUcoFilterAndFind.TContextEventExtSearchDirectionArgs)
                {
                    txtEventsLog.Text += "  (Context: '" + ContextArgs.Context.ToString("G") + "' - search direction is " +
                                         (((TUcoFilterAndFind.TContextEventExtSearchDirectionArgs)ContextArgs).SearchUpwards ? "upwards" :
                                          "downwards") +
                                         ")." +
                                         Environment.NewLine;
                }
                else if (ContextArgs is TUcoFilterAndFind.TContextEventExtControlValueArgs)
                {
                    txtEventsLog.Text += "  (Context: '" + ContextArgs.Context.ToString("G") + "' - Control: '" +
                                         ((TUcoFilterAndFind.TContextEventExtControlValueArgs)ContextArgs).AffectedControl.Name +
                                         "'. Changed Value: " +
                                         ((TUcoFilterAndFind.TContextEventExtControlValueArgs)ContextArgs).Value.ToString() + " (Type: " +
                                         ((TUcoFilterAndFind.TContextEventExtControlValueArgs)ContextArgs).TypeOfValue.FullName + ")" +
                                         Environment.NewLine;
                }
                else if (ContextArgs is TUcoFilterAndFind.TContextEventExtControlArgs)
                {
                    txtEventsLog.Text += "  (Context: '" + ContextArgs.Context.ToString("G") + "' - associated Control: '" +
                                         ((TUcoFilterAndFind.TContextEventExtControlArgs)ContextArgs).AffectedControl.Name + "'." +
                                         Environment.NewLine;
                    Application.DoEvents();

                    if (ContextArgs.Action != null)
                    {
                        ContextArgs.Action(((TUcoFilterAndFind.TContextEventExtControlArgs)ContextArgs).AffectedControl);
                    }

                    if (ContextArgs.ResetAction != null)
                    {
                        System.Threading.Thread.Sleep(1000);

                        ContextArgs.ResetAction(((TUcoFilterAndFind.TContextEventExtControlArgs)ContextArgs).AffectedControl);
                    }
                }
                else
                {
                    txtEventsLog.Text += "  (Context: '" + ContextArgs.Context.ToString("G") + "')." + Environment.NewLine;
                }
            }

            // Scroll to the last line in the TextBox
            txtEventsLog.SelectionStart  = txtEventsLog.Text.Length;
            txtEventsLog.SelectionLength = 0;
            txtEventsLog.ScrollToCaret();
        }