/// <summary>
        /// Initializes the specified testable.
        /// </summary>
        /// <param name="testable">if set to <c>true</c> [testable].</param>
        /// <param name="monitorType">The monitor type.</param>
        /// <returns>The current Desktop instance</returns>
        public static Desktop Initialize(bool testable, DesktopMonitorType monitorType = DesktopMonitorType.Default)
        {
            var desktop = Initialize(monitorType);

            desktop.Testable = testable;
            return(desktop);
        }
Exemple #2
0
        /// <summary>
        /// Gets the desktop monitor.
        /// </summary>
        /// <returns>a desktop monitor</returns>
        public IDesktopMonitor GetDesktopMonitor(DesktopMonitorType monitorType)
        {
            switch (monitorType)
            {
            case DesktopMonitorType.Form:
                return(new HiddenFormDesktopMonitor());

            case DesktopMonitorType.NativeWindow:
                return(new DesktopMonitor());

            case DesktopMonitorType.WndProcNativeWindow:
                return(new WndProcDesktopMonitor());
            }

            return(null);
        }
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <param name="monitorType">The monitor.</param>
        /// <returns>
        /// The Desktop singleton
        /// </returns>
        public static Desktop Initialize(DesktopMonitorType monitorType = DesktopMonitorType.Default)
        {
            if (Current == null)
            {
                if (monitorType != DesktopMonitorType.Default)
                {
                    var monitor = Factory.GetDesktopMonitor(monitorType);
                    Current = new Desktop(monitor);
                }
                else
                {
                    Current = new Desktop();
                }
            }

            return(Current);
        }