Esempio n. 1
0
        private static AutomationElement OpenSoundControlPanelWindow()
        {
            //this doesn't work: window process seems to enter idle state
            // before the actual AutomationElement window can be found
            //Dim windowProcess = Process.Start("control", "mmsys.cpl,,0")
            //Dim idleState As Boolean = windowProcess.WaitForInputIdle(5000)

            SoundWindow.StartControlPanelProcess();

            AutomationElement result = null;

            if ((!SoundWindow.TryFindSoundWindow(ref result)))
            {
                throw new ElementNotAvailableException("Could not open Sound control panel window.");
            }

            return(result);
        }
Esempio n. 2
0
        // IDisposable
        protected virtual void Dispose(bool disposing)
        {
            if (!myDisposedValue)
            {
                if (disposing)
                {
                    // free other state (managed objects)
                    if (((myWindow != null) && (!myWindow.WasAlreadyOpen)))
                    {
                        myWindow.Close();
                    }
                }

                // TODO: free your own state (unmanaged objects)
                // set large fields to null
                myWindow = null;
            }
            myDisposedValue = true;
        }
Esempio n. 3
0
        public static SoundWindow Open()
        {
            //assume the Sound control panel window is already open
            bool soundWindowIsOpen = true;

            //use existing Sound window if it is open
            AutomationElement window = FindFirstSoundWindow();

            //Sound control panel window is not open, so open it
            if ((window == null))
            {
                //Sound control panel window was not already open
                soundWindowIsOpen = false;

                window = SoundWindow.OpenSoundControlPanelWindow();
            }

            return(new SoundWindow(window, soundWindowIsOpen));
        }