Esempio n. 1
0
        /// <summary>
        /// Creates a new Desktop object with the same desktop open.
        /// </summary>
        /// <returns>Cloned desktop object.</returns>
        public object Clone()
        {
            // make sure object isnt disposed.

            var desktop = new Desktop();

            // if a desktop is open, make the clone open it.
            if (IsOpen)
            {
                desktop.Open(DesktopName);
            }

            return(desktop);
        }
Esempio n. 2
0
        /// <summary>
        /// Opens a desktop.
        /// </summary>
        /// <param name="name">The name of the desktop to open.</param>
        /// <returns>If successful, a Desktop object, otherwise, null.</returns>
        public static Desktop OpenDesktop(string name)
        {
            // open the desktop.
            var desktop = new Desktop();
            var result  = desktop.Open(name);

            // somethng went wrong.
            if (!result)
            {
                return(null);
            }

            return(desktop);
        }
Esempio n. 3
0
        /// <summary>
        /// Switches to the specified desktop.
        /// </summary>
        /// <param name="name">Name of desktop to switch input to.</param>
        /// <returns>True if desktops were successfully switched.</returns>
        public static bool Show(string name)
        {
            // attmempt to open desktop.
            bool result;

            using (var d = new Desktop()) {
                result = d.Open(name);

                // something went wrong.
                if (!result)
                {
                    return(false);
                }

                // attempt to switch desktops.
                result = d.Show();
            }

            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new Desktop object with the same desktop open.
        /// </summary>
        /// <returns>Cloned desktop object.</returns>
        public object Clone()
        {
            // make sure object isnt disposed.

            var desktop = new Desktop();

            // if a desktop is open, make the clone open it.
            if (IsOpen) desktop.Open(DesktopName);

            return desktop;
        }
Esempio n. 5
0
        /// <summary>
        /// Switches to the specified desktop.
        /// </summary>
        /// <param name="name">Name of desktop to switch input to.</param>
        /// <returns>True if desktops were successfully switched.</returns>
        public static bool Show(string name)
        {
            // attmempt to open desktop.
            bool result;

            using (var d = new Desktop()) {
                result = d.Open(name);

                // something went wrong.
                if (!result) return false;

                // attempt to switch desktops.
                result = d.Show();
            }

            return result;
        }
Esempio n. 6
0
        /// <summary>
        /// Opens a desktop.
        /// </summary>
        /// <param name="name">The name of the desktop to open.</param>
        /// <returns>If successful, a Desktop object, otherwise, null.</returns>
        public static Desktop OpenDesktop(string name)
        {
            // open the desktop.
            var desktop = new Desktop();
            var result = desktop.Open(name);

            // somethng went wrong.
            if (!result) return null;

            return desktop;
        }