private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            lock (callbackMutex) {
                var newDesktop = desktopIdLookup[VirtualDesktop.Current];
                Debug.WriteLine("Switched to " + newDesktop);

                _current = newDesktop;
                sysTrayProcess.ShowIconForDesktop(Current);

                MoveStickyWindows(_current);

                var fgHwnd           = WinAPI.GetForegroundWindow();
                var lastActiveWindow = activeWindows[Current];

                var browserInfo = settings.GetBrowserToActivateInfo();
                if (browserInfo != null)
                {
                    if (lastActiveBrowserWindows[Current] != activeWindows[Current])
                    {
                        FindActivateBrowserWindow(lastActiveBrowserWindows[Current], browserInfo);
                    }
                }

                if (!ActivateWindow(lastActiveWindow))
                {
                    Debug.WriteLine("Reactivate " + Current + " " + fgHwnd);
                    WinAPI.SetForegroundWindow(fgHwnd);
                }

                movingWindow = IntPtr.Zero;

                SendSwitchedDesktopMessage();
            }
        }
コード例 #2
0
            private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
            {
                // 0 == first
                int currentDesktopIndex = getCurrentDesktopIndex();

                changeTrayIcon(currentDesktopIndex);
            }
コード例 #3
0
ファイル: Form1.cs プロジェクト: vivlim/VirtualDesktopManager
        private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            int currentDesktopIndex = getCurrentDesktopIndex();

            restoreApplicationFocus(currentDesktopIndex);
            changeTrayIcon(currentDesktopIndex);
        }
コード例 #4
0
ファイル: WallpaperService.cs プロジェクト: sk8tz/SylphyHorn
        private static void VirtualDesktopOnCurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            Task.Run(() =>
                     //VisualHelper.InvokeOnUIDispatcher(() =>
            {
                if (!Settings.General.ChangeBackgroundEachDesktop)
                {
                    return;
                }

                var desktops = VirtualDesktop.GetDesktops();
                var newIndex = Array.IndexOf(desktops, e.NewDesktop) + 1;

                var dirPath = Settings.General.DesktopBackgroundFolderPath.Value ?? "";
                if (Directory.Exists(dirPath))
                {
                    foreach (var extension in _supportedExtensions)
                    {
                        var filePath  = Path.Combine(dirPath, newIndex + extension);
                        var wallpaper = new FileInfo(filePath);
                        if (wallpaper.Exists)
                        {
                            Set(wallpaper.FullName);
                            break;
                        }
                    }
                }
            });
        }
コード例 #5
0
        private void VirtualDesktopOnCurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            Task.Run(() =>
            {
                if (!Settings.General.ChangeBackgroundEachDesktop)
                {
                    return;
                }

                var desktops  = VirtualDesktop.GetDesktops();
                var newNumber = Array.IndexOf(desktops, e.NewDesktop) + 1;

                var wallpapers = this.GetWallpaperFiles(Settings.General.DesktopBackgroundFolderPath);
                var files      = wallpapers.Where(x => x.DesktopNumber == newNumber).ToArray();
                if (files.Length == 0)
                {
                    var file = wallpapers.SingleOrDefault(x => x.Number == 0);
                    if (file != null)
                    {
                        files = new[] { file }
                    }
                    ;
                }
                if (files.Length != 0)
                {
                    this.Set(files);
                }
            });
        }
コード例 #6
0
        public static void DesktopSwitchedHandler(object sender, VirtualDesktopChangedEventArgs args)
        {
            var tDesktops = VirtualDesktop.GetDesktops();

            CachedPreviousNumber = Array.IndexOf(tDesktops, args.OldDesktop) + 1;
            CachedNumber         = Array.IndexOf(tDesktops, args.NewDesktop) + 1;
        }
コード例 #7
0
 private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() =>
     {
         try
         {
             this.MoveToDesktop(VirtualDesktop.Current);
         }
         catch (InvalidOperationException) { }
     }));
 }
コード例 #8
0
        private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            // 0 == first
            int currentDesktopIndex = getCurrentDesktopIndex();

            string pictureFile = PickNthFile(currentDesktopIndex);

            if (pictureFile != null)
            {
                Native.SetBackground(pictureFile);
            }

            restoreApplicationFocus(currentDesktopIndex);
            changeTrayIcon(currentDesktopIndex);
        }
コード例 #9
0
        private void VirtualDesktopOnCurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            if (!Settings.General.NotificationWhenSwitchedDesktop)
            {
                return;
            }

            VisualHelper.InvokeOnUIDispatcher(() =>
            {
                var desktops = VirtualDesktop.GetDesktops();
                var newIndex = Array.IndexOf(desktops, e.NewDesktop) + 1;

                this._notificationWindow.Disposable = ShowDesktopWindow(newIndex);
            });
        }
コード例 #10
0
        private void VirtualDesktopOnCurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            Task.Run(() =>
            {
                if (!Settings.General.ChangeBackgroundEachDesktop)
                {
                    return;
                }

                var desktops = VirtualDesktop.GetDesktops();
                var newIndex = Array.IndexOf(desktops, e.NewDesktop) + 1;

                var file = this.GetWallpaperFiles(Settings.General.DesktopBackgroundFolderPath).FirstOrDefault(x => x.Number == newIndex);
                if (file != null)
                {
                    this.Set(file.Filepath);
                }
            });
        }
コード例 #11
0
        private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
        {
            var newDesktop = desktopNumberLookup[e.NewDesktop.Id];

            Debug.WriteLine("Switched to " + newDesktop);

            lock (callbackMutex) {
                this._current = newDesktop;
                sysTrayProcess.ShowIconForDesktop(Current);

                if (VirtualDesktop.Current == e.NewDesktop)
                {
                    DoActivateBrowser(newDesktop);
                }
                else
                {
                    Debug.WriteLine("Skipped OnDesktopChanged()");
                }
            }
        }
コード例 #12
0
 private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
 {
     UpdateDisplay(e.NewDesktop);
 }
コード例 #13
0
ファイル: WindowManager.cs プロジェクト: vbarrancos/Topaz
 private void VirtualDesktopOnCurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
 {
     Utility.Log("Virtual desktop changed!");
 }
コード例 #14
0
 private void vDeskChanged(object sender, VirtualDesktopChangedEventArgs e)
 {
     setNotificationIcon();
 }
コード例 #15
0
 private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
 {
     DWM.GetWindows();
     DWM.Draw();
     App_Refresh();
 }
コード例 #16
0
            void IVirtualDesktopNotification.CurrentVirtualDesktopChanged(IVirtualDesktop pDesktopOld, IVirtualDesktop pDesktopNew)
            {
                var args = new VirtualDesktopChangedEventArgs(FromComObject(pDesktopOld), FromComObject(pDesktopNew));

                CurrentChanged?.Invoke(this, args);
            }
コード例 #17
0
 private void VirtualDesktop_CurrentChanged(object sender, VirtualDesktopChangedEventArgs e)
 {
 }
コード例 #18
0
ファイル: TaskTrayIcon.cs プロジェクト: ViRb3/SylphyHornEx
 private void OnCurrentDesktopChanged(object sender, VirtualDesktopChangedEventArgs e)
 {
     this.Reload(e.NewDesktop);
 }