Ejemplo n.º 1
0
        public static string DesktopNameFromDesktop(Desktop desktop)
        {         // return name of desktop or "Desktop n" if it has no name
            Guid guid = desktop.ivd.GetId();

            // read desktop name in registry
            string desktopName = null;

            try {
                desktopName = (string)Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VirtualDesktops\\Desktops\\{" + guid.ToString() + "}", "Name", null);
            }
            catch { }

            // no name found, generate generic name
            if (string.IsNullOrEmpty(desktopName))
            {             // create name "Desktop n" (n = number starting with 1)
                desktopName = "Desktop " + (DesktopManager.GetDesktopIndex(desktop.ivd) + 1).ToString();
            }
            return(desktopName);
        }
Ejemplo n.º 2
0
 public static int FromDesktop(Desktop desktop)
 {         // return index of desktop object or -1 if not found
     return(DesktopManager.GetDesktopIndex(desktop.ivd));
 }