Exemple #1
0
        public static bool SelectAll()
        {
            bool res = Execute(OnSelectAll);

            if (!res)
            {
                Control activeControl = Application.ActiveControl;
                if (activeControl == null)
                {
                    return(false);
                }

                System.Windows.Forms.TextBoxBase active = activeControl as System.Windows.Forms.TextBoxBase;
                res = active != null;
                if (res)
                {
                    active.SelectAll();
                }

                if (!res)
                {
                    System.Windows.Forms.WebBrowser webbrowser = activeControl as System.Windows.Forms.WebBrowser;
                    if (webbrowser != null)
                    {
                        WebBrowserHelper.ExecSelectAll(webbrowser);
                        ///TODO: don't work in unix
                        res = true;
                    }
                }

                if (!res)
                {
                    MethodInfo method = activeControl.GetType().GetMethod("SelectAll");
                    if (method != null)
                    {
                        Clipboard.FunctionWithoutReturn getMethod = (Clipboard.FunctionWithoutReturn)Delegate.CreateDelegate
                                                                        (typeof(Clipboard.FunctionWithoutReturn), activeControl, method);

                        getMethod();
                        res = true;
                    }
                }
            }
            return(res);
        }