Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            _shell   = (IServiceProvider10)Activator.CreateInstance(Type.GetTypeFromCLSID(Guids.ImmersiveShell));
            _manager = (IVirtualDesktopManagerInternal)_shell.QueryService(Guids.VirtualDesktopManagerInternal, Guids.IVirtualDesktopManagerInternal);

            GoToDesktop(int.Parse(args[0]));
        }
        public WindowsShellAdapter(IConfigurationFactory factory)
        {
            _factory = factory;

            try
            {
                _desktop = CreateInstance <IDesktopWallpaper>(CLSID.DesktopWallpaper);

                _manager = CreateInstance <IVirtualDesktopManager>(CLSID.VirtualDesktopManager);

                var shell = CreateInstance <uIServiceProvider>(CLSID.ImmersiveShell);

                object managerResult;
                shell.QueryService(
                    IID.VirtualDesktopAPIUnknown,
                    typeof(IVirtualDesktopManagerInternal).GUID,
                    out managerResult);

                _managerInternal = (IVirtualDesktopManagerInternal)managerResult;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Ejemplo n.º 3
0
        static DesktopManager()
        {
            var shell = (IServiceProvider10)Activator.CreateInstance(Type.GetTypeFromCLSID(Guids.CLSID_ImmersiveShell));

            VirtualDesktopManagerInternal = (IVirtualDesktopManagerInternal)shell.QueryService(Guids.CLSID_VirtualDesktopManagerInternal, typeof(IVirtualDesktopManagerInternal).GUID);
            VirtualDesktopManager         = (IVirtualDesktopManager)Activator.CreateInstance(Type.GetTypeFromCLSID(Guids.CLSID_VirtualDesktopManager));
            ApplicationViewCollection     = (IApplicationViewCollection)shell.QueryService(typeof(IApplicationViewCollection).GUID, typeof(IApplicationViewCollection).GUID);
            VirtualDesktopPinnedApps      = (IVirtualDesktopPinnedApps)shell.QueryService(Guids.CLSID_VirtualDesktopPinnedApps, typeof(IVirtualDesktopPinnedApps).GUID);
        }
Ejemplo n.º 4
0
        static DesktopManager()
        {
            var shell = (IServiceProvider10)Activator.CreateInstance(
                Type.GetTypeFromCLSID(Guids.CLSID_ImmersiveShell));

            VirtualDesktopManagerInternal =
                (IVirtualDesktopManagerInternal)shell.QueryService(Guids.CLSID_VirtualDesktopManagerInternal,
                                                                   typeof(IVirtualDesktopManagerInternal).GUID);
        }
Ejemplo n.º 5
0
        public static void SetWallpaper(string imagePath)
        {
            for (int attempts = 0; attempts < 2; attempts++)
            {
                if (manager == null || attempts > 0)
                {
                    manager = ImmersiveShellWrapper.GetVirtualDesktopManager();
                }

                try
                {
                    UnsafeSetWallpaper(imagePath);
                    break;
                }
                catch (COMException)
                {
                    continue;
                }
            }
        }
Ejemplo n.º 6
0
 static DesktopManager()
 {
     var shell = (IServiceProvider10)Activator.CreateInstance(Type.GetTypeFromCLSID(Guids.CLSID_ImmersiveShell));
     Manager = (IVirtualDesktopManagerInternal)shell.QueryService(Guids.CLSID_VirtualDesktopManagerInternal, Guids.IID_IVirtualDesktopManagerInternal);
     WManager = (IVirtualDesktopManager)Activator.CreateInstance(Type.GetTypeFromCLSID(Guids.CLSID_VirtualDesktopManager));
 }