Exemplo n.º 1
0
        /// <summary>
        /// Send File/New command.
        /// </summary>
        internal void New()
        {
            ContextMenu subMenu = MainMenu.OpenSubMenu("MenuFile");

            subMenu.InvokeMenuItem("MenuFileNew");

            Thread.Sleep(300);

            AutomationElement child = this.FindChildWindow("Save Changes", 1);

            if (child != null)
            {
                MessageBoxWrapper msg = new MessageBoxWrapper(child);
                msg.ClickNo();
                Thread.Sleep(300);
            }

            child = this.FindChildWindow("New Database", 1);
            if (child != null)
            {
                MessageBoxWrapper msg = new MessageBoxWrapper(child);
                msg.ClickOk();
                Thread.Sleep(300);
            }
        }
Exemplo n.º 2
0
        private void ClickOkIfExists()
        {
            // if database exists, click "yes"...
            MainWindowWrapper main = MainWindowWrapper.FindMainWindow(window.Current.ProcessId);
            bool found             = true;

            do
            {
                found = false;
                foreach (string title in new string[] { "Database Exists", "Need to Elevate" })
                {
                    AutomationElement child = main.FindChildWindow(title, 2);
                    if (child != null)
                    {
                        MessageBoxWrapper msg = new MessageBoxWrapper(child);
                        if (msg != null)
                        {
                            msg.ClickOk();
                        }
                        found = true;
                    }
                }
            }while (found);
        }