Пример #1
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;
        }
Пример #2
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);
                }