Пример #1
0
        public IEnumerable <WindowInfo> ToCut(WindowInfo windowInfo, VirtualDesktopManager desktopManager)
        {
            var windows = new List <WindowInfo>();

            switch (Hide)
            {
            case ApplicationBehaviorsProcessHideBehaviorDefaultHide.SelectedWindow:
            {
                windows.Add(windowInfo);
                break;
            }

            case ApplicationBehaviorsProcessHideBehaviorDefaultHide.AllProcessWindows:
            {
                var searchWindows = CutHelper.WindowsToSearchIn(desktopManager, ConsiderWindows);

                var processWindows = searchWindows.Where(w =>
                    {
                        Process cutProcess   = windowInfo.GetProcess();
                        Process otherProcess = w.GetProcess();
                        return
                        (cutProcess != null && otherProcess != null &&
                         cutProcess.Id == otherProcess.Id);
                    });
                windows.AddRange(processWindows);
                break;
            }
            }

            return(windows);
        }
Пример #2
0
        public MonitorVdmPipeServer(VirtualDesktopManager desktopManager)
        {
            ChannelServices.RegisterChannel(_channel, false);
            MonitorVdmService monitorVdm = new MonitorVdmService(desktopManager);

            RemotingServices.Marshal(monitorVdm, "MonitorVdmService");
        }
Пример #3
0
        private async void buttonVDesktop_Click(object sender, EventArgs e)
        {
            // Some delay to allow users to switch virtual desktop

            buttonVDesktop.Text = "5...";
            await Task.Delay(1000);

            buttonVDesktop.Text = "4...";
            await Task.Delay(1000);

            buttonVDesktop.Text = "3...";
            await Task.Delay(1000);

            buttonVDesktop.Text = "2...";
            await Task.Delay(1000);

            buttonVDesktop.Text = "1...";
            await Task.Delay(1000);

            buttonVDesktop.Text = "Refresh again?";

            labelVDesktopCurrent.Text = (VirtualDesktopManager.IsWindowOnCurrentVirtualDesktop(this)) ?
                                        "Form is on currently active virtual desktop" :
                                        "Form is NOT on currently active virtual desktop";

            labelVDesktopId.Text = VirtualDesktopManager.GetWindowDesktopId(this).Id.ToString();
        }
Пример #4
0
        public MainForm(Option option)
        {
            this.Option            = option;
            _VirtualDesktopManager = VirtualDesktopManager.CreateInstance();
            _GetCurrentDesktop     = VirtualDesktopManagerInternal._GetCurrentDesktopGetter();

            this.ControlAdded += MainForm_ControlAdded;
            InitializeComponent();
            ResetCounter();

            if (!string.IsNullOrEmpty(AppSettings.Debug.TimerInterval))
            {
                timer1.Interval = int.Parse(AppSettings.Debug.TimerInterval);
            }
        }
Пример #5
0
        public static IEnumerable <WindowInfo> WindowsToSearchIn(VirtualDesktopManager desktopManager, ConsiderWindows selectedDesktops)
        {
            switch (selectedDesktops)
            {
            case ConsiderWindows.AllWindows:
                return(WindowManager.GetWindows());

            case ConsiderWindows.AllDesktopWindows:
                return(desktopManager.Workspaces.SelectMany(d => d.WindowSnapshots.Select(w => w.Info)));

            case ConsiderWindows.CurrentDesktopWindowsOnly:
                return(desktopManager.CurrentWorkspace.WindowSnapshots.Select(w => w.Info));

            default:
                throw new NotSupportedException();
            }
        }
Пример #6
0
 public MonitorVdmService(VirtualDesktopManager desktopManager)
 {
     _desktopManager = desktopManager;
 }
Пример #7
0
 public MonitorVdmService( VirtualDesktopManager desktopManager )
 {
     _desktopManager = desktopManager;
 }
Пример #8
0
        public IEnumerable <WindowInfo> ToCut(WindowInfo windowInfo, VirtualDesktopManager desktopManager)
        {
            var searchWindows = CutHelper.WindowsToSearchIn(desktopManager, ConsiderWindows);

            return(searchWindows.Where(s => Window.Any(w => w.Equals(s))));
        }
Пример #9
0
 public MonitorVdmPipeServer( VirtualDesktopManager desktopManager )
 {
     ChannelServices.RegisterChannel( _channel, false );
     MonitorVdmService monitorVdm = new MonitorVdmService( desktopManager );
     RemotingServices.Marshal( monitorVdm, "MonitorVdmService" );
 }
Пример #10
0
 public static IEnumerable<WindowInfo> WindowsToSearchIn( VirtualDesktopManager desktopManager, ConsiderWindows selectedDesktops )
 {
     switch ( selectedDesktops )
     {
         case ConsiderWindows.AllWindows:
             return WindowManager.GetWindows();
         case ConsiderWindows.AllDesktopWindows:
             return desktopManager.Workspaces.SelectMany( d => d.WindowSnapshots.Select( w => w.Info ) );
         case ConsiderWindows.CurrentDesktopWindowsOnly:
             return desktopManager.CurrentWorkspace.WindowSnapshots.Select( w => w.Info );
         default:
             throw new NotSupportedException();
     }
 }
Пример #11
0
 public IEnumerable<WindowInfo> ToCut( WindowInfo windowInfo, VirtualDesktopManager desktopManager )
 {
     var searchWindows = CutHelper.WindowsToSearchIn( desktopManager, ConsiderWindows );
     return searchWindows.Where( s => Window.Any( w => w.Equals( s ) ) );
 }
Пример #12
0
        public IEnumerable<WindowInfo> ToCut( WindowInfo windowInfo, VirtualDesktopManager desktopManager )
        {
            var windows = new List<WindowInfo>();

            switch ( Hide )
            {
                case ApplicationBehaviorsProcessHideBehaviorDefaultHide.SelectedWindow:
                {
                    windows.Add( windowInfo );
                    break;
                }
                case ApplicationBehaviorsProcessHideBehaviorDefaultHide.AllProcessWindows:
                {
                    var searchWindows = CutHelper.WindowsToSearchIn( desktopManager, ConsiderWindows );

                    var processWindows = searchWindows.Where( w =>
                    {
                        Process cutProcess = windowInfo.GetProcess();
                        Process otherProcess = w.GetProcess();
                        return
                            cutProcess != null && otherProcess != null &&
                            cutProcess.Id == otherProcess.Id;
                    } );
                    windows.AddRange( processWindows );
                    break;
                }
            }

            return windows;
        }