예제 #1
0
 public void PerformFileTransfersTests(IImSession testSession, System.Windows.Controls.Primitives.TextBoxBase DBT)
 {
     workingSession                = testSession;
     TestsHelper.DebugTextBox      = DBT;
     TestsHelper.CurrentTestNumber = 0;
     testSession.TransfersManager.StartTestMode();
     testSession.TransfersManager.TransferEnded += new EventHandler <TransfersManagerEventArgs>(OnTransferEnded);
     testSession.TransfersManager.TransferError += new EventHandler <TransferErrorEventArgs>(OnTransferError);
     PrepareFileSystem();
     FileTests();
 }
 public static void SetSpellingReform(System.Windows.Controls.Primitives.TextBoxBase textBoxBase, SpellingReform value)
 {
 }
 public static void SetIsEnabled(System.Windows.Controls.Primitives.TextBoxBase textBoxBase, bool value)
 {
 }
 public static bool GetIsEnabled(System.Windows.Controls.Primitives.TextBoxBase textBoxBase)
 {
     return(default(bool));
 }
 public static System.Collections.IList GetCustomDictionaries(System.Windows.Controls.Primitives.TextBoxBase textBoxBase)
 {
     return(default(System.Collections.IList));
 }
예제 #6
0
        private static void SetFocus(DependencyObject parent, object p)
        {
            DependencyObject element = null;
            var propertyName         = p as string;

            // Cas où il s'agit d'une string d'un path complexe d'une grappe d'objet (ex: Model.Property1.SubProperty)
            if (propertyName != null && propertyName.Contains("."))
            {
                int i = 0;
                // Scinde la string pour retrouver tous les "sous path"
                string[] path = propertyName.Split('.');

                // Dans cette méthode anonyme, la variable i évolue dans l'itérateur plus bas
                Predicate <DependencyObject> predicate = d =>
                {
                    string anchor = GetAnchor(d) as string;

                    if (anchor == null)
                    {
                        return(false);
                    }

                    return(anchor == path[i]);
                };

                // Tente de récupérer le premier élément correspondant à la première partie de la chaîne
                element = parent.FindFirstChild(predicate);

                // Parcourt tous les sous éléments
                for (i = 1; i < path.Length; i++)
                {
                    if (element == null)
                    {
                        break;
                    }

                    element = element.FindFirstChild(predicate);
                }
            }
            else
            {
                element = parent.FindFirstChild(d =>
                {
                    object anchor = GetAnchor(d);

                    if (anchor == null)
                    {
                        return(false);
                    }

                    IComparable comparable = p as IComparable;
                    if (comparable != null)
                    {
                        return(comparable.CompareTo(anchor) == 0);
                    }

                    return(anchor == p);
                });
            }

            // Si l'élément correspondant a été trouvé
            if (element != null)
            {
                // Tente de le rendre visible à l'écran
                FrameworkElement frameworkElement = element as FrameworkElement;
                if (frameworkElement != null)
                {
                    frameworkElement.BringIntoView();
                }

                // Si c'est un textboxbase, le sélectionne
                System.Windows.Controls.Primitives.TextBoxBase textBoxBase = element as System.Windows.Controls.Primitives.TextBoxBase;
                if (textBoxBase != null)
                {
                    textBoxBase.SelectAll();
                }

                UIElement uiElement = element as UIElement;
                if (uiElement != null)
                {
                    // Tente de lui donner le focus
                    if (!uiElement.Focus())
                    {
                        // S'il n'est pas focusable, tente de le donner à son premier enfant qui l'est
                        uiElement = uiElement.GetFirstFocusableChild();
                        if (uiElement != null)
                        {
                            uiElement.Focus();
                        }
                    }
                }
            }
        }
예제 #7
0
 public static void ClearUndoHistory(this TextBoxBase textBox)
 {
     textBox.IsUndoEnabled = false;
     textBox.IsUndoEnabled = true;
 }
 /// <summary>
 /// New instance.
 /// </summary>
 /// <param name="tbb">The textbox to highlight</param>
 /// <param name="run">The Run to highlight</param>
 /// <param name="start">The start index of the highlight</param>
 /// <param name="length">The length of the highlight</param>
 /// <param name="horizontalScrollBarHeight">Height of the horizontal scrollbar</param>
 /// <param name="bodyHighlightAdornerBrush">Brush to paint highlight with</param>
 /// <param name="bodyHighlightAdornerPen">Pen to paint highlight border with, specifying a pen can slow down painting when highlights span multiple lines.</param>
 /// <param name="bodyIterativeHighlightAdornerBrush">Brush to paint iterative highlight with</param>
 /// <param name="bodyIterativeHighlightAdornerPen">Pen to draw iterative highlight border with</param>
 public TextBoxBaseHighlightAdorner(System.Windows.Controls.Primitives.TextBoxBase tbb, Run run, int start, int length, double horizontalScrollBarHeight, Brush bodyHighlightAdornerBrush, Pen bodyHighlightAdornerPen, Brush bodyIterativeHighlightAdornerBrush, Pen bodyIterativeHighlightAdornerPen)
     : base(tbb, run, start, length, horizontalScrollBarHeight, bodyHighlightAdornerBrush, bodyHighlightAdornerPen, bodyIterativeHighlightAdornerBrush, bodyIterativeHighlightAdornerPen)
 {
     this.tbb = tbb;
     tbb.AddHandler(ScrollViewer.ScrollChangedEvent, new RoutedEventHandler(scroller_ScrollChanged));
 }