public void ShowMe()
 {
     SimpleLogHelper.Debug("Call shortcut to invoke quick window.");
     _vmSearchBox.DispNameFilter = "";
     if (SystemConfig.Instance.QuickConnect.Enable)
     {
         if (_isHidden == true)
         {
             lock (_closeLocker)
             {
                 if (_isHidden == true)
                 {
                     var p        = ScreenInfoEx.GetMouseSystemPosition();
                     var screenEx = ScreenInfoEx.GetCurrentScreenBySystemPosition(p);
                     this.Top  = screenEx.VirtualWorkingAreaCenter.Y - this.Height / 2;
                     this.Left = screenEx.VirtualWorkingAreaCenter.X - this.Width / 2;
                     this.Show();
                     this.Visibility = Visibility.Visible;
                     this.Activate();
                     this.Topmost = true;  // important
                     this.Topmost = false; // important
                     this.Focus();         // important
                     TbKeyWord.Focus();
                     _isHidden = false;
                     _vmSearchBox.PopupSelectionsIsOpen = false;
                     _vmSearchBox.PopupActionsIsOpen    = false;
                 }
             }
         }
     }
 }
Example #2
0
        public override void GoFullScreen()
        {
            Debug.Assert(this.ParentWindow != null);

            if (_rdpServer.RdpFullScreenFlag == ERdpFullScreenFlag.EnableFullScreen)
            {
                _rdpServer.AutoSetting.FullScreenLastSessionScreenIndex = ScreenInfoEx.GetCurrentScreen(this.ParentWindow).Index;
            }
            else
            {
                _rdpServer.AutoSetting.FullScreenLastSessionScreenIndex = -1;
            }
            Server.AddOrUpdate(_rdpServer);
            _rdp.FullScreen = true;
        }
Example #3
0
 private void WinTitleBar_OnPreviewMouseMove(object sender, MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed && _isDraging)
     {
         if (this.WindowState == WindowState.Maximized)
         {
             var p    = ScreenInfoEx.GetMouseVirtualPosition();
             var top  = p.Y;
             var left = p.X;
             this.Top         = top - 15;
             this.Left        = left - this.Width / 2;
             this.WindowState = WindowState.Normal;
             this.Top         = top - 15;
             this.Left        = left - this.Width / 2;
         }
         this.DragMove();
     }
 }
Example #4
0
        public void MoveProtocolHostToFullScreen(string connectionId)
        {
            if (_protocolHosts.ContainsKey(connectionId))
            {
                var host = _protocolHosts[connectionId];

                // remove from old parent
                TabWindow tab = null;
                {
                    var tabs = _tabWindows.Values.Where(x => x.Vm.Items.Any(y => y.Content == host)).ToArray();
                    if (tabs.Length > 0)
                    {
                        tab = tabs.First();
                        foreach (var t in tabs)
                        {
                            var items = t.Vm.Items.ToArray().Where(x => x.Content == host);
                            foreach (var item in items.ToArray())
                            {
                                t.Vm.Items.Remove(item);
                                if (t.Vm.Items.Count > 0)
                                {
                                    t.Vm.SelectedItem = tab.Vm.Items.First();
                                }
                                SimpleLogHelper.Debug($@"Remove host({host.GetHashCode()}) from tab({t.GetHashCode()})");
                            }
                        }
                    }
                }



                FullScreenWindow full;
                if (_host2FullScreenWindows.ContainsKey(connectionId))
                {
                    full = _host2FullScreenWindows[connectionId];
                    full.LastTabToken = "";
                    // full screen placement
                    if (tab != null)
                    {
                        var screenEx = ScreenInfoEx.GetCurrentScreen(tab);
                        full.Top          = screenEx.VirtualWorkingAreaCenter.Y - full.Height / 2;
                        full.Left         = screenEx.VirtualWorkingAreaCenter.X - full.Width / 2;
                        full.LastTabToken = _lastTabToken;
                    }
                    full.Show();
                    full.SetProtocolHost(host);
                    host.ParentWindow = full;
                    host.GoFullScreen();
                }
                else
                {
                    // move to full
                    full = new FullScreenWindow {
                        LastTabToken = ""
                    };

                    // full screen placement
                    ScreenInfoEx screenEx;
                    if (tab != null)
                    {
                        screenEx          = ScreenInfoEx.GetCurrentScreen(tab);
                        full.LastTabToken = _lastTabToken;
                    }
                    else if (host.ProtocolServer is ProtocolServerRDP rdp &&
                             rdp.RdpFullScreenFlag == ERdpFullScreenFlag.EnableFullScreen &&
                             rdp.AutoSetting.FullScreenLastSessionScreenIndex >= 0 &&
                             rdp.AutoSetting.FullScreenLastSessionScreenIndex < Screen.AllScreens.Length)
                    {
                        screenEx = ScreenInfoEx.GetCurrentScreen(rdp.AutoSetting.FullScreenLastSessionScreenIndex);
                    }
                    else
                    {
                        screenEx = ScreenInfoEx.GetCurrentScreen(App.Window);
                    }
                    full.WindowStartupLocation = WindowStartupLocation.Manual;
                    full.Top  = screenEx.VirtualWorkingAreaCenter.Y - full.Height / 2;
                    full.Left = screenEx.VirtualWorkingAreaCenter.X - full.Width / 2;
                    full.SetProtocolHost(host);
                    host.ParentWindow = full;
                    full.Loaded      += (sender, args) => { host.GoFullScreen(); };
                    full.Show();
                    AddFull(full);
                }