diff --git a/AGENTS.md b/AGENTS.md index 3b928c6..5788aeb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,6 +63,8 @@ RDP scale wire format (`Services/RdpDpiScale.cs`, `native/CxRdpBridge/cxrdp_brid RDP clipboard (CLIPRDR): the managed side (`Services/RdpBridgeClient.cs`, `Services/RdpClipboardImageHelper.cs`) talks through `cxrdp_set_clipboard_text` / `_rich_text` / `_image` / `_files` and receives remote content through the text, image and files callbacks. Every one of those entry points is gated on `cxrdp_get_api_version() >= 14` PLUS its own capability bit (`CX_RDP_CAPABILITY_CLIPBOARD_IMAGE/FILES/RICH_TEXT/LOCK`), because older bridges declared the prototypes in `cxrdp_bridge.h` without defining them — calling an unimplemented symbol throws `EntryPointNotFoundException`, so never add a `DllImport` call that is not behind a capability check. Format ids beyond the CF_* range are local conventions (`CX_CLIPRDR_FORMAT_PNG 0xC001`, `FILE_GROUP_DESCRIPTOR_W 0xC002`, `HTML 0xC003`, `RTF 0xC004`, `FILE_CONTENTS 0xC005`, `PREFERRED_DROP_EFFECT 0xC006`) and the bridge advertises them by name (`PNG`, `FileGroupDescriptorW`, `FileContents`, `Preferred DropEffect`, `HTML Format`, `Rich Text Format`), so remote format matching keys off `formatName` and falls back to the numeric `formatId`. Files copied on the RDP side are staged into `%TEMP%/CxShell-RdpClip/` in 64 KiB stream chunks before the paths are handed to the host, and a local copy is enumerated recursively (directories become a leading entry plus `root\relative` names) so pasting a folder recreates the tree. Capabilities advertise `CB_STREAM_FILECLIP_ENABLED`, `CB_FILECLIP_NO_FILE_PATHS`, `CB_HUGE_FILE_SUPPORT_ENABLED` and, when `SessionInfo.RdpEnableClipboardLock` is on, `CB_CAN_LOCK_CLIPDATA`; a lock request snapshots the offered text/files under its `clipDataId` so a later local copy cannot abort an in-flight transfer. `RdpClipboardImageHelper` opens the Windows clipboard with the session window's HWND as owner — passing `IntPtr.Zero` made the data disappear when another app polled the clipboard. Local clipboard content is one of three mutually exclusive kinds (text/rich text, image, files); switching kind bumps `local_clipboard_revision` and only the matching format list is offered. +RDP keyboard scancodes (`Views/RdpView.axaml.cs`, `Services/RdpKeyboardScancodes.cs`): the numeric keypad's PS/2 set-1 scancodes are a physical grid, NOT a linear range - only NumPad0 sits at 0x52 while digits 1-9 occupy 0x47-0x51 (they share their codes with the non-extended navigation keys: 7=Home 0x47, 8=Up 0x48, 9=PgUp 0x49, 4=Left 0x4B, 6=Right 0x4D, 1=End 0x4F, 2=Down 0x50, 3=PgDn 0x51). Never derive them from the Key enum order (`0x52 + digit` sent NumPad1 as the keypad decimal 0x53 and NumPad5/NumPad6 as F11/F12, which made the numpad unusable in RDP); always go through `RdpKeyboardScancodes.NumPadDigitScancode`. The remote decides digits versus navigation from its own NumLock state, so `RdpView` re-asserts the local toggle state through a synchronize event (`SyncLocalLockKeysToRemote`) at connect, on focus and after each NumLock/CapsLock/ScrollLock key-up to keep both sides aligned. + RDP connect latency: the bridge tries security profiles in the order `negotiate` (standard X.224 negotiation, what modern servers want) then `nla`, `tls`, `rdp`. Never put the single-layer profiles first — each one costs a complete failed TCP/TLS handshake. `RdpBridgeClient` persists the winning profile per `host:port` in `Services/RdpSecurityProfileCache.cs` (`%LOCALAPPDATA%/CxShell/rdp-security-profiles.json`) after the bridge reports `RDP security profile selected mode=...`, and passes it back through `cxrdp_set_security_profile` (API 7 / `CX_RDP_CAPABILITY_FAST_CONNECT`). A clipboard-triggered retry re-runs only the profile that already worked. Credential/account errors (`ERRCONNECT_LOGON_FAILURE`, `ERRCONNECT_ACCOUNT_LOCKED_OUT`, ...) stop the fallback loop immediately so retries cannot lock an account. `FreeRDP_TcpConnectTimeout`/`TcpAckTimeout` bound each handshake, `cx_retry_dialog` returns -1 during the initial connect (only ARC gets a backoff), and `RdpViewModel` adds a 45 s connect watchdog (`CXSHELL_RDP_CONNECT_TIMEOUT_SECONDS`, 0 disables). Per-profile failures, queued display updates and clipboard retries are classified as transient by `ViewModels/RdpReconnectStatus.cs` — the UI must not treat them as a disconnect; the bridge emits one terminal `RDP connection failed.` line when the loop is exhausted. `SessionInfo.RdpClipboardEnabled` (session edit dialog, default true) maps to `cxrdp_set_clipboard_channel`; `CXSHELL_RDP_CLIPBOARD_CHANNEL=0` remains a global kill switch. Session throughput uses `FreeRDP_CompressionEnabled`, `BitmapCacheEnabled`, `NetworkAutoDetect`, `CONNECTION_TYPE_AUTODETECT` and font smoothing; `SoftwareGdi=TRUE` is required by the GDI frame callback; EGFX (see frame presentation below) is its front end, not an alternative. `SessionInfo.RdpDisableWallpaper` (session edit dialog, default true) maps to `cxrdp_set_disable_wallpaper` (API 9 / `CX_RDP_CAPABILITY_PERFORMANCE_FLAGS`): the bridge sets `FreeRDP_DisableWallpaper` and calls `freerdp_performance_flags_make` so `PERF_DISABLE_WALLPAPER` is folded into `FreeRDP_PerformanceFlags` before the client core data is sent; older bridges lack the bit and the managed side skips the call. The worker keeps a resize queued for 2 s after connect so the `disp` channel can negotiate before a layout is sent; `RdpViewModel` retries an in-place resize once after 1200 ms before falling back to a full reconnect. RDP H.264 / AVC444 and dirty-rect copies (merged from PR #6 on 2026-11-28): `SessionInfo.RdpH264Enabled` (session edit dialog, default off, checkbox disabled while EGFX is off) maps to `cxrdp_set_h264_enabled` (capability `CX_RDP_CAPABILITY_GFX_H264` = 0x00080000). The bridge only honours it when `FreeRDP_SupportGraphicsPipeline` is on: it then sets `FreeRDP_GfxH264`, `FreeRDP_GfxAVC444` and `FreeRDP_GfxAVC444v2`, and forces all three off when the graphics pipeline is disabled or failed. A missing decoder or server-side codec costs a dropped codec, not the session. Partial frame copies live in `Services/RdpBridgeClient.cs`: when `cxrdp_get_frame_dirty_rect` reports a rect and the frame did not resize, `OnFrame` copies only that rect out of the native buffer into `_frameBuffer`/`_previousFrameBuffer`, and `TryPresentFrame` copies only that rect — unioned with the previously presented rect — into the pooled snapshot, which `RdpViewModel.OnFramebufferUpdated` blits into the locked target bitmap. The union with the last presented rect is REQUIRED: the host alternates two persistent bitmaps, so a region must be published twice before both bitmaps are current; dropping the union shows stale regions on the back buffer. Any full copy (resize, wave classification, no dirty rect) resets `_pendingFullFrameCopy` and re-copies the whole surface. @@ -81,7 +83,7 @@ RDP frame presentation latency (regression fix, 2026-11-23): pure repaint-wave d ## Full Screen Connection Bar -`Views/FullScreenConnectionBar.axaml(.cs)` is the mstsc-style floating bar shown at the top centre of a full screen window. It is hosted by `Views/MainWindow.axaml` (bound to `MainWindowViewModel.IsTerminalFullScreen`, endpoint `SelectedTab.Session.Host`, quality `SelectedTab.Rdp.LinkQualityLevel`, `IsQualityVisible=SelectedTab.IsRdpSession`), `Views/DetachedTabWindow.axaml` (bound to the tab view model), and `Views/RdpMonitorWindow.axaml`. Hosts wire `MinimizeRequested` / `RestoreRequested` / `CloseRequested` / `PinnedChanged` (and workspace/multi-monitor events where applicable). +`Views/FullScreenConnectionBar.axaml(.cs)` is the mstsc-style floating bar shown at the top centre of a full screen window. It is hosted by `Views/MainWindow.axaml` (bound to `MainWindowViewModel.IsTerminalFullScreen`, endpoint `SelectedTab.Session.Host`, quality `SelectedTab.Rdp.LinkQualityLevel`, `IsQualityVisible=SelectedTab.IsRdpSession`), `Views/DetachedTabWindow.axaml` (bound to the tab view model), `Views/RdpWorkspaceWindow.axaml`, and `Views/RdpMonitorWindow.axaml`. Hosts wire `MinimizeRequested` / `RestoreRequested` / `CloseRequested` / `PinnedChanged` (and workspace/multi-monitor events where applicable). Behaviour that must not regress: @@ -92,7 +94,7 @@ Behaviour that must not regress: - The quality bars are an estimate, not an RDP capability: `RdpViewModel` times a bare TCP connect to the session endpoint every 10 s while connected and maps ≤50 ms/≤100 ms/≤200 ms/longer to 4/3/2/1 bars (`LinkQualityLevel`); 0 means unknown/disconnected. RDP exposes no signal strength, and a full reconnect probe must never be used. - Minimize from the bar leaves the full screen presentation, so the host must restore it when the window comes back: `MainWindow` uses `_restoreFullScreenAfterMinimize` plus `OnMainWindowPropertyChanged`; `DetachedTabWindow` needs `_restoreFullScreenAfterMinimize` / `_restoreKeepTaskbarAfterMinimize` and the `_suppressPresentationRestore` guard, because leaving the taskbar-visible mode changes `WindowState` and would otherwise look like a user restore. Close maps to `CloseTab(SelectedTab)` in the main window and `Close()` in a detached window - never to shutting down the application. - **Both full screen modes must hide the drawn chrome, not just the title bar.** `WindowState.FullScreen` only drops the native frame; AtomUI draws its title bar (`IsTitleBarVisible`) inside the client area. `Views/KeepTaskbarFullScreen.cs` owns that: `Enter()` hides the title bar before maximizing, the immersive path calls `HideTitleBar()`. -- **AtomUI 6.3.0's built-in full-screen title bar must stay disabled via `FullScreenTitleBarMode="Hidden"`.** AtomUI 6.3.0 removed `FullscreenHeaderFrame` from `WindowDrawnDecorationsTheme` and introduced `Window.FullScreenTitleBarMode` (default `AutoHide`) inside `WindowChromeLayer`. Every window hosting `FullScreenConnectionBar` (`MainWindow.axaml`, `DetachedTabWindow.axaml`, `RdpMonitorWindow.axaml`) must set `FullScreenTitleBarMode="Hidden"` so AtomUI never activates its built-in full-screen bar or moves `TitleBar` between `NormalSlotTitleBar` and `FullScreenSlotContent`. +- **AtomUI 6.3.0's built-in full-screen title bar must stay disabled via `FullScreenTitleBarMode="Hidden"`.** AtomUI 6.3.0 removed `FullscreenHeaderFrame` from `WindowDrawnDecorationsTheme` and introduced `Window.FullScreenTitleBarMode` (default `AutoHide`) inside `WindowChromeLayer`. Every window hosting `FullScreenConnectionBar` (`MainWindow.axaml`, `DetachedTabWindow.axaml`, `RdpWorkspaceWindow.axaml`, `RdpMonitorWindow.axaml`) must set `FullScreenTitleBarMode="Hidden"` so AtomUI never activates its built-in full-screen bar or moves `TitleBar` between `NormalSlotTitleBar` and `FullScreenSlotContent`. - **Keep `FullScreenConnectionBar` as a dedicated control rather than replacing it with `Window.FullScreenTitleBar`.** `Window.FullScreenTitleBar` only activates for `WindowState.FullScreen`, whereas CxShell needs the same bar in taskbar-visible maximized mode (`KeepTaskbarFullScreen`) and `RdpMonitorWindow` borderless mode, with the centred 8 px / 500 ms mstsc hot-zone, RDP link quality, pin persistence, multi-monitor popup lock, workspace tab switching, and drag-restore. - `KeepTaskbarFullScreen` owns `HideTitleBar`/`RestoreTitleBar` and `HideDecorations`/`RestoreDecorations` (`Window.WindowDecorations = None`, previous values saved once). Both helpers are idempotent so switching between "keep taskbar" and immersive full screen never loses the original state. Restore them on every exit path (after leaving full screen, never before), including an external takeover (window manager shortcut, native caption button): `MainWindow.OnMainWindowPropertyChanged` and `DetachedTabWindow.OnWindowPropertyChanged` restore the chrome whenever the window ends up outside full screen without `_keepTaskbarFullScreen.IsActive`. Never bind `IsTitleBarVisible` or `WindowDecorations` from XAML. diff --git a/CxShell.Tests/RdpKeyboardScancodesTests.cs b/CxShell.Tests/RdpKeyboardScancodesTests.cs new file mode 100644 index 0000000..dbf3603 --- /dev/null +++ b/CxShell.Tests/RdpKeyboardScancodesTests.cs @@ -0,0 +1,72 @@ +using Avalonia.Input; +using CxShell.Services; + +namespace CxShell.Tests; + +public sealed class RdpKeyboardScancodesTests +{ + [Theory] + [InlineData(Key.NumPad0, 0x52)] + [InlineData(Key.NumPad1, 0x4F)] + [InlineData(Key.NumPad2, 0x50)] + [InlineData(Key.NumPad3, 0x51)] + [InlineData(Key.NumPad4, 0x4B)] + [InlineData(Key.NumPad5, 0x4C)] + [InlineData(Key.NumPad6, 0x4D)] + [InlineData(Key.NumPad7, 0x47)] + [InlineData(Key.NumPad8, 0x48)] + [InlineData(Key.NumPad9, 0x49)] + public void NumPadDigitScancode_MatchesPs2KeypadGrid(Key key, uint expected) + { + Assert.Equal(expected, RdpKeyboardScancodes.NumPadDigitScancode(key)); + } + + [Fact] + public void NumPadDigitScancode_ReturnsZeroOutsideTheKeypad() + { + Assert.Equal(0u, RdpKeyboardScancodes.NumPadDigitScancode(Key.D1)); + Assert.Equal(0u, RdpKeyboardScancodes.NumPadDigitScancode(Key.Decimal)); + Assert.Equal(0u, RdpKeyboardScancodes.NumPadDigitScancode(Key.Add)); + Assert.Equal(0u, RdpKeyboardScancodes.NumPadDigitScancode(Key.None)); + } + + [Fact] + public void NumPadDigits_DoNotCollideWithKeypadDecimalOrFunctionKeys() + { + // The old 0x52 + digit arithmetic sent NumPad1 as the keypad decimal + // (0x53) and NumPad5/NumPad6 as F11/F12 (0x57/0x58), which is why the + // numeric keypad typed garbage or nothing in RDP sessions. + var scancodes = new HashSet(); + for (var key = Key.NumPad0; key <= Key.NumPad9; key++) + scancodes.Add(RdpKeyboardScancodes.NumPadDigitScancode(key)); + + Assert.Equal(10, scancodes.Count); + Assert.DoesNotContain(0x53u, scancodes); // keypad . + Assert.DoesNotContain(0x57u, scancodes); // F11 + Assert.DoesNotContain(0x58u, scancodes); // F12 + } + + [Fact] + public void NumPadDigits_MatchTheNonExtendedNavigationScancodes() + { + // The keypad shares its scancodes with the navigation block: NumPad7 + // is the non-extended Home, NumPad8 the non-extended Up, and so on. + // The remote side decides digits versus navigation from its own + // NumLock state, exactly like a physical keyboard plugged into it. + Assert.Equal(0x0100 | 0x47u, RdpKeyboardScancodes.NumPadDigitScancode(Key.NumPad7) | 0x0100); + Assert.Equal(0x0100 | 0x48u, RdpKeyboardScancodes.NumPadDigitScancode(Key.NumPad8) | 0x0100); + Assert.Equal(0x0100 | 0x4Du, RdpKeyboardScancodes.NumPadDigitScancode(Key.NumPad6) | 0x0100); + Assert.Equal(0x0100 | 0x50u, RdpKeyboardScancodes.NumPadDigitScancode(Key.NumPad2) | 0x0100); + } + + [Fact] + public void IsLockKey_MatchesTheToggleKeys() + { + Assert.True(RdpKeyboardScancodes.IsLockKey(Key.NumLock)); + Assert.True(RdpKeyboardScancodes.IsLockKey(Key.CapsLock)); + Assert.True(RdpKeyboardScancodes.IsLockKey(Key.Scroll)); + Assert.False(RdpKeyboardScancodes.IsLockKey(Key.NumPad1)); + Assert.False(RdpKeyboardScancodes.IsLockKey(Key.F5)); + Assert.False(RdpKeyboardScancodes.IsLockKey(Key.None)); + } +} diff --git a/Models/SessionInfo.cs b/Models/SessionInfo.cs index e08d924..fa28401 100644 --- a/Models/SessionInfo.cs +++ b/Models/SessionInfo.cs @@ -627,6 +627,20 @@ public int SshMonitorRefreshIntervalSeconds public string RdpColorQuality { get; set; } = "32"; /// Preferred RDP security mode: Auto, Negotiate, NLA, TLS or RDP. public string RdpSecurityMode { get; set; } = "Auto"; + /// RDP window mode: Default (main window tab), MultiTab (standalone multi-tab RDP window), or Standalone (detached single-session window with multi-monitor support). + public string RdpWindowMode { get; set; } = "Default"; + public bool RdpOpenInStandaloneWindow { get; set; } + + public string ResolveEffectiveRdpWindowMode() + { + if (string.Equals(RdpWindowMode, "MultiTab", StringComparison.OrdinalIgnoreCase)) + return "MultiTab"; + if (string.Equals(RdpWindowMode, "Standalone", StringComparison.OrdinalIgnoreCase)) + return "Standalone"; + if (string.Equals(RdpWindowMode, "Default", StringComparison.OrdinalIgnoreCase) && RdpOpenInStandaloneWindow) + return "MultiTab"; + return RdpOpenInStandaloneWindow ? "MultiTab" : "Default"; + } public bool RdpApplyKeyCombinations { get; set; } = true; public bool RdpSyncLockKeys { get; set; } = true; public bool RdpEnableClipboardLock { get; set; } = true; diff --git a/Services/LocalizationService.cs b/Services/LocalizationService.cs index d5b94b3..e9a1c6c 100644 --- a/Services/LocalizationService.cs +++ b/Services/LocalizationService.cs @@ -180,6 +180,7 @@ public sealed class LocalizationService : INotifyPropertyChanged ["FullScreenBar.Unpin"] = "Unpin the connection bar (auto hide)", ["FullScreenBar.Minimize"] = "Minimize", ["FullScreenBar.Restore"] = "Restore window", + ["FullScreenBar.ToggleFullScreen"] = "Toggle full screen (F11)", ["FullScreenBar.Close"] = "Close this session", ["FullScreenBar.Quality"] = "Link quality", ["FullScreenBar.QualityGood"] = "Good", @@ -541,6 +542,7 @@ public sealed class LocalizationService : INotifyPropertyChanged ["FullScreenBar.Unpin"] = "取消固定(自动隐藏)", ["FullScreenBar.Minimize"] = "最小化", ["FullScreenBar.Restore"] = "还原窗口", + ["FullScreenBar.ToggleFullScreen"] = "切换全屏 (F11)", ["FullScreenBar.Close"] = "关闭当前会话", ["FullScreenBar.Quality"] = "网络质量", ["FullScreenBar.QualityGood"] = "良好", @@ -2241,12 +2243,21 @@ private static void AddGeneratedTexts(Dictionary english, Dictio english["UiText.088"] = "Resize screen (C):"; english["UiText.089"] = "Color quality (Q):"; english["SessionEdit.RdpSecurityMode"] = "Security mode:"; + english["SessionEdit.RdpWindowModeSection"] = "Window Mode"; + english["SessionEdit.RdpWindowModeLabel"] = "Open Mode:"; + english["SessionEdit.RdpWindowMode.Default"] = "Default (Main window tab)"; + english["SessionEdit.RdpWindowMode.MultiTab"] = "Multi-tab window"; + english["SessionEdit.RdpWindowMode.Standalone"] = "Standalone window (Multi-monitor)"; + english["SessionEdit.RdpOpenInStandaloneWindow"] = "Open in standalone RDP multi-tab window"; english["SessionEdit.RdpSyncLockKeys"] = "Sync CapsLock / NumLock / ScrollLock state"; english["SessionEdit.RdpSyncLockKeysHint"] = "Automatically synchronize local lock key states to the remote session on connect or focus."; english["SessionEdit.RdpEnableClipboardLock"] = "Enable clipboard large file locking (LockClipboardData)"; english["SessionEdit.RdpEnableClipboardLockHint"] = "Lock clipboard file snapshots during large file transfers so copying other content does not abort transfers."; english["Rdp.MultiMonitor"] = "Multi-Monitor"; english["Rdp.MultiMonitorTip"] = "Multi-monitor / Virtual screen settings"; + english["Rdp.MoveToWorkspace"] = "Move to multi-tab RDP window (single monitor)"; + english["Rdp.OpenInWorkspace"] = "Open in multi-tab RDP window"; + english["Rdp.OpenInDetachedWindow"] = "Open in standalone window (multi-monitor)"; english["Rdp.MultiMonitorPrompt"] = "Monitors to use (switches live)"; english["Rdp.AddVirtualMonitor"] = "+ Add virtual screen (separate window)"; english["Rdp.UltrawideSection"] = "Ultrawide / split layout"; @@ -2525,12 +2536,21 @@ private static void AddGeneratedTexts(Dictionary english, Dictio chinese["UiText.088"] = "改变屏幕大小(C):"; chinese["UiText.089"] = "颜色质量(Q):"; chinese["SessionEdit.RdpSecurityMode"] = "安全模式:"; + chinese["SessionEdit.RdpWindowModeSection"] = "窗口模式"; + chinese["SessionEdit.RdpWindowModeLabel"] = "打开方式:"; + chinese["SessionEdit.RdpWindowMode.Default"] = "默认(主窗口标签页)"; + chinese["SessionEdit.RdpWindowMode.MultiTab"] = "多标签"; + chinese["SessionEdit.RdpWindowMode.Standalone"] = "独立窗体(支持多屏)"; + chinese["SessionEdit.RdpOpenInStandaloneWindow"] = "在独立的 RDP 多标签窗口中打开"; chinese["SessionEdit.RdpSyncLockKeys"] = "同步 CapsLock / NumLock / ScrollLock 锁定键状态"; chinese["SessionEdit.RdpSyncLockKeysHint"] = "连接或切入 RDP 窗口时自动将本地大小写与小键盘锁定状态同步到远端。"; chinese["SessionEdit.RdpEnableClipboardLock"] = "启用剪贴板大文件锁定 (LockClipboardData)"; chinese["SessionEdit.RdpEnableClipboardLockHint"] = "通过剪贴板传输大文件时锁定快照,防止中途复制其他内容导致传输中断。"; chinese["Rdp.MultiMonitor"] = "多显示器"; chinese["Rdp.MultiMonitorTip"] = "多显示器 / 虚拟屏幕设置"; + chinese["Rdp.MoveToWorkspace"] = "移入多标签 RDP 窗口(自动收敛为单屏)"; + chinese["Rdp.OpenInWorkspace"] = "在独立多标签窗口打开"; + chinese["Rdp.OpenInDetachedWindow"] = "在独立窗体打开(支持多屏)"; chinese["Rdp.MultiMonitorPrompt"] = "选择要启用的显示器(实时热切换)"; chinese["Rdp.AddVirtualMonitor"] = "+ 新增虚拟屏(独立窗体)"; chinese["Rdp.UltrawideSection"] = "带鱼屏 / 虚拟分屏模式"; diff --git a/Services/RdpKeyboardScancodes.cs b/Services/RdpKeyboardScancodes.cs new file mode 100644 index 0000000..466757d --- /dev/null +++ b/Services/RdpKeyboardScancodes.cs @@ -0,0 +1,39 @@ +using Avalonia.Input; + +namespace CxShell.Services; + +/// +/// Translates Avalonia keys into the PS/2 set-1 scancodes that RDP keyboard +/// events carry. The numeric keypad is a physical grid, not a linear range: +/// only NumPad0 sits at 0x52 while digits 1-9 occupy 0x47-0x51, so the +/// scancodes cannot be derived from the Key enum order (0x52 + digit sends +/// NumPad1 as the keypad decimal 0x53 and NumPad5/NumPad6 as F11/F12). +/// +public static class RdpKeyboardScancodes +{ + /// + /// Returns the non-extended keypad scancode for a numpad digit key, or 0 + /// when the key is not one of -. + /// + public static uint NumPadDigitScancode(Key key) => key switch + { + Key.NumPad0 => 0x52, + Key.NumPad1 => 0x4F, + Key.NumPad2 => 0x50, + Key.NumPad3 => 0x51, + Key.NumPad4 => 0x4B, + Key.NumPad5 => 0x4C, + Key.NumPad6 => 0x4D, + Key.NumPad7 => 0x47, + Key.NumPad8 => 0x48, + Key.NumPad9 => 0x49, + _ => 0 + }; + + /// + /// Whether the key is a toggle key whose local LED state should be + /// re-asserted to the remote session through a synchronize event. + /// + public static bool IsLockKey(Key key) => + key is Key.NumLock or Key.CapsLock or Key.Scroll; +} diff --git a/ViewModels/MainWindowViewModel.cs b/ViewModels/MainWindowViewModel.cs index 92d5e04..4fa3e8f 100644 --- a/ViewModels/MainWindowViewModel.cs +++ b/ViewModels/MainWindowViewModel.cs @@ -2588,7 +2588,17 @@ public async Task ConnectSession(SessionInfo session, string? passwordOverride, } } - private async Task ConnectRdpSession(SessionInfo session, string? passwordOverride) + public Task OpenRdpInWorkspaceWindowAsync(SessionInfo session) => + ConnectRdpSession(session, null, openInWorkspace: true, openInDetached: false); + + public Task OpenRdpInDetachedWindowAsync(SessionInfo session) => + ConnectRdpSession(session, null, openInWorkspace: false, openInDetached: true); + + private async Task ConnectRdpSession( + SessionInfo session, + string? passwordOverride, + bool? openInWorkspace = null, + bool openInDetached = false) { var password = string.IsNullOrEmpty(passwordOverride) ? GetSavedPassword(session) @@ -2603,6 +2613,19 @@ private async Task ConnectRdpSession(SessionInfo session, string? passwordOverri var tab = new TerminalTabViewModel(session, rdp); RecordAudit(session, ConnectionAuditEventType.ConnectStarted); + var effectiveWindowMode = session.ResolveEffectiveRdpWindowMode(); + if (openInDetached || (openInWorkspace == null && string.Equals(effectiveWindowMode, "Standalone", StringComparison.OrdinalIgnoreCase))) + { + Views.DetachedTabWindow.ShowFor(tab); + return; + } + + if (openInWorkspace ?? string.Equals(effectiveWindowMode, "MultiTab", StringComparison.OrdinalIgnoreCase)) + { + Views.RdpWorkspaceWindow.OpenTab(tab); + return; + } + tab.CloseRequested += CloseTab; tab.PropertyChanged += OnTerminalTabPropertyChanged; AddTabToActiveGroup(tab); diff --git a/ViewModels/SessionEditViewModel.cs b/ViewModels/SessionEditViewModel.cs index 1684f2d..580b89e 100644 --- a/ViewModels/SessionEditViewModel.cs +++ b/ViewModels/SessionEditViewModel.cs @@ -331,6 +331,8 @@ public readonly record struct AppearanceColorPalette( [ObservableProperty] private string _rdpFrameStrategy = "Auto"; [ObservableProperty] private string _rdpColorQuality = "32"; [ObservableProperty] private string _rdpSecurityMode = "Auto"; + [ObservableProperty] private string _rdpWindowMode = "Default"; + [ObservableProperty] private bool _rdpOpenInStandaloneWindow; [ObservableProperty] private bool _rdpApplyKeyCombinations = true; [ObservableProperty] private bool _rdpSyncLockKeys = true; [ObservableProperty] private bool _rdpEnableClipboardLock = true; @@ -1048,6 +1050,12 @@ public bool IsNumericKeypadModeForceNormal new SelectOption { Header = "TLS", Content = "TLS" }, new SelectOption { Header = "Standard RDP", Content = "RDP" } ]; + public ObservableCollection RdpWindowModeOptions { get; } = + [ + new SelectOption { Header = LocalizationService.Shared.Text("SessionEdit.RdpWindowMode.Default"), Content = "Default" }, + new SelectOption { Header = LocalizationService.Shared.Text("SessionEdit.RdpWindowMode.MultiTab"), Content = "MultiTab" }, + new SelectOption { Header = LocalizationService.Shared.Text("SessionEdit.RdpWindowMode.Standalone"), Content = "Standalone" } + ]; public ObservableCollection RdpAudioModeOptions { get; } = [ new SelectOption { Header = "Play on this computer", Content = "PlayLocal" }, @@ -1547,6 +1555,8 @@ public SessionEditViewModel(SessionInfo session) RdpFrameStrategy = RdpFramePresentationModes.Normalize(session.RdpFrameStrategy); RdpColorQuality = string.IsNullOrWhiteSpace(session.RdpColorQuality) ? "32" : session.RdpColorQuality; RdpSecurityMode = string.IsNullOrWhiteSpace(session.RdpSecurityMode) ? "Auto" : session.RdpSecurityMode; + RdpWindowMode = session.ResolveEffectiveRdpWindowMode(); + RdpOpenInStandaloneWindow = session.RdpOpenInStandaloneWindow; RdpApplyKeyCombinations = session.RdpApplyKeyCombinations; RdpSyncLockKeys = session.RdpSyncLockKeys; RdpEnableClipboardLock = session.RdpEnableClipboardLock; @@ -1861,6 +1871,8 @@ private void Save() session.RdpFrameStrategy = RdpFramePresentationModes.Normalize(RdpFrameStrategy); session.RdpColorQuality = RdpColorQuality; session.RdpSecurityMode = string.IsNullOrWhiteSpace(RdpSecurityMode) ? "Auto" : RdpSecurityMode; + session.RdpWindowMode = string.IsNullOrWhiteSpace(RdpWindowMode) ? "Default" : RdpWindowMode; + session.RdpOpenInStandaloneWindow = string.Equals(session.RdpWindowMode, "MultiTab", StringComparison.OrdinalIgnoreCase); session.RdpApplyKeyCombinations = RdpApplyKeyCombinations; session.RdpSyncLockKeys = RdpSyncLockKeys; session.RdpEnableClipboardLock = RdpEnableClipboardLock; diff --git a/ViewModels/SessionTreeViewModel.cs b/ViewModels/SessionTreeViewModel.cs index 5c5a40d..2557401 100644 --- a/ViewModels/SessionTreeViewModel.cs +++ b/ViewModels/SessionTreeViewModel.cs @@ -266,6 +266,8 @@ public static void CopySessionValues(SessionInfo target, SessionInfo source) target.RdpFrameStrategy = source.RdpFrameStrategy; target.RdpColorQuality = source.RdpColorQuality; target.RdpSecurityMode = source.RdpSecurityMode; + target.RdpWindowMode = source.RdpWindowMode; + target.RdpOpenInStandaloneWindow = source.RdpOpenInStandaloneWindow; target.RdpSyncLockKeys = source.RdpSyncLockKeys; target.RdpEnableClipboardLock = source.RdpEnableClipboardLock; target.RdpClipboardEnabled = source.RdpClipboardEnabled; @@ -1261,6 +1263,8 @@ private static SessionInfo CloneSession(SessionInfo source, string name) RdpFrameStrategy = source.RdpFrameStrategy, RdpColorQuality = source.RdpColorQuality, RdpSecurityMode = source.RdpSecurityMode, + RdpWindowMode = source.RdpWindowMode, + RdpOpenInStandaloneWindow = source.RdpOpenInStandaloneWindow, RdpApplyKeyCombinations = source.RdpApplyKeyCombinations, RdpSyncLockKeys = source.RdpSyncLockKeys, RdpEnableClipboardLock = source.RdpEnableClipboardLock, diff --git a/Views/DetachedTabWindow.axaml b/Views/DetachedTabWindow.axaml index 2be8310..6e46a8e 100644 --- a/Views/DetachedTabWindow.axaml +++ b/Views/DetachedTabWindow.axaml @@ -6,6 +6,7 @@ xmlns:services="using:CxShell.Services" xmlns:views="using:CxShell.Views" x:Class="CxShell.Views.DetachedTabWindow" + x:Name="DetachedWindowRoot" x:DataType="vm:TerminalTabViewModel" Title="{Binding Title}" Icon="/Assets/CxShellLogo.png" @@ -27,14 +28,35 @@ + - + + - - + + - + DataContext="{Binding Rdp}" + IsVisible="{Binding #DetachedWindowRoot.((vm:TerminalTabViewModel)DataContext).IsRdpSession}"/> + diff --git a/Views/DetachedTabWindow.axaml.cs b/Views/DetachedTabWindow.axaml.cs index 61989e8..0b51849 100644 --- a/Views/DetachedTabWindow.axaml.cs +++ b/Views/DetachedTabWindow.axaml.cs @@ -45,7 +45,14 @@ public DetachedTabWindow() KeepTaskbarFullScreenButton.SetValue( AtomUI.Desktop.Controls.ToolTip.TipProperty, Services.LocalizationService.Shared.Text("Toolbar.FullScreenKeepTaskbarTip")); + DetachedMultiMonitorButton.SetValue( + AtomUI.Desktop.Controls.ToolTip.TipProperty, + Services.LocalizationService.Shared.Text("Rdp.MultiMonitorTip")); + MoveToWorkspaceButton.SetValue( + AtomUI.Desktop.Controls.ToolTip.TipProperty, + Services.LocalizationService.Shared.Text("Rdp.MoveToWorkspace")); Closed += OnClosed; + FullScreenConnectionBar.ToggleFullScreenRequested += ToggleWindowFullScreen; FullScreenConnectionBar.MultiMonitorRequested += anchor => DetachedRdpView.ToggleMultiMonitorPopup(anchor, PlacementMode.Bottom, FullScreenConnectionBar.SetExternalPopupOpen); PropertyChanged += OnWindowPropertyChanged; @@ -206,6 +213,13 @@ private void OnWindowPropertyChanged(object? sender, AvaloniaPropertyChangedEven return; } + if (state == WindowState.Maximized && !_keepTaskbarFullScreen.IsActive) + { + _keepTaskbarFullScreen.Enter(); + UpdateConnectionBarState(); + return; + } + // Another full screen path (the caption button, F11, or a window manager // shortcut) took over, so hand the title bar back instead of leaving the // window stuck in a borderless maximized state. @@ -327,6 +341,27 @@ private void OnDetachedMultiMonitorMenuClick(object? sender, RoutedEventArgs e) DetachedRdpView.ToggleMultiMonitorPopup(TitleBarAddOnPanel, PlacementMode.Bottom); } + private void OnDetachedMultiMonitorClick(object? sender, RoutedEventArgs e) + { + if (sender is Control anchor) + DetachedRdpView.ToggleMultiMonitorPopup(anchor, PlacementMode.Bottom); + } + + private void OnMoveToWorkspaceClick(object? sender, RoutedEventArgs e) + { + if (_disposed || _tab is not { IsRdpSession: true } tab) + return; + + DetachedRdpView.ResetToSingleMonitor(); + _reattach = null; + _closeTab = null; + _tab = null; + DataContext = null; + _disposed = true; + RdpWorkspaceWindow.OpenTab(tab); + Close(); + } + private void OnKeepTaskbarFullScreenClick(object? sender, RoutedEventArgs e) { if (_keepTaskbarFullScreen.IsActive) diff --git a/Views/FullScreenConnectionBar.axaml b/Views/FullScreenConnectionBar.axaml index f5c9c10..909cf2b 100644 --- a/Views/FullScreenConnectionBar.axaml +++ b/Views/FullScreenConnectionBar.axaml @@ -27,7 +27,7 @@ BorderBrush="{atom:SharedTokenResource ColorBorderSecondary}" BorderThickness="1" BoxShadow="0 6 18 0 #40000000"> - - - - - + + + @@ -1051,10 +1051,10 @@ IsVisible="{Binding IsMonitorPanelVisible}"> - + PanelCloseCommand="{Binding #MainWindowRoot.((vm:MainWindowViewModel)DataContext).ToggleMonitorCommand}"/> = Key.NumPad0 && e.Key <= Key.NumPad9) { - scancode = 0x52 + (uint)(e.Key - Key.NumPad0); - return true; + scancode = RdpKeyboardScancodes.NumPadDigitScancode(e.Key); + return scancode != 0; } needsShift = e.KeyModifiers.HasFlag(KeyModifiers.Shift); diff --git a/Views/RdpWorkspaceWindow.axaml b/Views/RdpWorkspaceWindow.axaml new file mode 100644 index 0000000..9b77a68 --- /dev/null +++ b/Views/RdpWorkspaceWindow.axaml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Views/RdpWorkspaceWindow.axaml.cs b/Views/RdpWorkspaceWindow.axaml.cs new file mode 100644 index 0000000..e7556b2 --- /dev/null +++ b/Views/RdpWorkspaceWindow.axaml.cs @@ -0,0 +1,358 @@ +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Media; +using Avalonia.VisualTree; +using CommunityToolkit.Mvvm.ComponentModel; +using CxShell.ViewModels; + +namespace CxShell.Views; + +public partial class RdpWorkspaceTabItem : ObservableObject +{ + private static readonly IBrush SelectedBrush = new SolidColorBrush(Color.Parse("#2B3440")); + private static readonly IBrush FloatingSelectedBrush = new SolidColorBrush(Color.Parse("#4464D8FF")); + private static readonly IBrush FloatingUnselectedBrush = new SolidColorBrush(Color.Parse("#1FFFFFFF")); + private static readonly IBrush UnselectedBrush = Brushes.Transparent; + + public RdpWorkspaceTabItem(TerminalTabViewModel tab) + { + Tab = tab; + } + + public TerminalTabViewModel Tab { get; } + public string Title => Tab.Title; + + [ObservableProperty] + [NotifyPropertyChangedFor(nameof(TabBackground))] + [NotifyPropertyChangedFor(nameof(FloatingTabBackground))] + [NotifyPropertyChangedFor(nameof(TitleFontWeight))] + private bool _isSelected; + + public IBrush TabBackground => IsSelected ? SelectedBrush : UnselectedBrush; + public IBrush FloatingTabBackground => IsSelected ? FloatingSelectedBrush : FloatingUnselectedBrush; + public FontWeight TitleFontWeight => IsSelected ? FontWeight.SemiBold : FontWeight.Normal; +} + +/// +/// Standalone multi-tab window dedicated to hosting RDP sessions outside the main window. +/// +public partial class RdpWorkspaceWindow : AtomUI.Desktop.Controls.Window +{ + private static RdpWorkspaceWindow? _instance; + private readonly ObservableCollection _tabs = []; + private WindowState _windowStateBeforeFullScreen = WindowState.Normal; + private RdpViewModel? _selectedRdpVm; + + public RdpWorkspaceWindow() + { + InitializeComponent(); + TabStripItems.ItemsSource = _tabs; + RdpViewsItems.ItemsSource = _tabs; + + FloatingBar.TabItemsSource = _tabs; + FloatingBar.TabSelected += item => + { + if (item is RdpWorkspaceTabItem tabItem) + SelectTab(tabItem); + }; + FloatingBar.TabCloseRequested += item => + { + if (item is RdpWorkspaceTabItem tabItem) + CloseTabItem(tabItem); + }; + FloatingBar.MultiMonitorRequested += anchor => + GetSelectedRdpView()?.ToggleMultiMonitorPopup(anchor, PlacementMode.Bottom, FloatingBar.SetExternalPopupOpen); + FloatingBar.MinimizeRequested += (_, _) => WindowState = WindowState.Minimized; + FloatingBar.RestoreRequested += (_, _) => WindowState = WindowState.Normal; + FloatingBar.ToggleFullScreenRequested += ToggleWindowFullScreen; + FloatingBar.CloseRequested += (_, _) => Close(); + FloatingBar.DragRestoreRequested += e => + { + if (WindowState is WindowState.Maximized or WindowState.FullScreen) + { + WindowState = WindowState.Normal; + BeginMoveDrag(e); + e.Handled = true; + } + }; + + Closed += OnClosed; + PropertyChanged += OnWindowPropertyChanged; + AddHandler(KeyDownEvent, OnWindowKeyDown, RoutingStrategies.Tunnel, handledEventsToo: true); + } + + public static void OpenTab(TerminalTabViewModel tab) + { + var window = _instance; + if (window == null) + { + window = new RdpWorkspaceWindow(); + _instance = window; + window.Show(); + } + + window.AddAndSelectTab(tab); + + if (window.WindowState == WindowState.Minimized) + window.WindowState = WindowState.Normal; + + window.Activate(); + } + + public static void CloseAll() + { + var window = _instance; + _instance = null; + window?.Close(); + } + + private void AddAndSelectTab(TerminalTabViewModel tab) + { + var item = new RdpWorkspaceTabItem(tab); + _tabs.Add(item); + SelectTab(item); + } + + private void SelectTab(RdpWorkspaceTabItem item) + { + GetSelectedRdpView()?.CloseMultiMonitorPopup(); + + foreach (var existing in _tabs) + existing.IsSelected = ReferenceEquals(existing, item); + + if (_selectedRdpVm != null) + { + _selectedRdpVm.PropertyChanged -= OnSelectedRdpPropertyChanged; + _selectedRdpVm = null; + } + + if (item.Tab.Rdp is { } rdp) + { + _selectedRdpVm = rdp; + rdp.PropertyChanged += OnSelectedRdpPropertyChanged; + } + + UpdateMultiMonitorButtonState(); + } + + private RdpView? GetSelectedRdpView() + { + var selected = _tabs.FirstOrDefault(t => t.IsSelected); + if (selected?.Tab.Rdp is not { } rdp) + return null; + + return RdpViewsItems.GetVisualDescendants() + .OfType() + .FirstOrDefault(v => ReferenceEquals(v.DataContext, rdp)); + } + + private void OnSelectedRdpPropertyChanged(object? sender, PropertyChangedEventArgs e) + { + if (e.PropertyName is nameof(RdpViewModel.IsConnected) or nameof(RdpViewModel.IsMultiMonitorActive)) + UpdateMultiMonitorButtonState(); + } + + private void UpdateMultiMonitorButtonState() + { + var connected = _selectedRdpVm?.IsConnected == true; + var active = _selectedRdpVm?.IsMultiMonitorActive == true; + FloatingBar.IsMultiMonitorEnabled = connected; + FloatingBar.IsMultiMonitorActive = active; + if (TitleBarMultiMonitorButton != null) + TitleBarMultiMonitorButton.IsEnabled = connected; + } + + private void OnTitleBarMultiMonitorClick(object? sender, RoutedEventArgs e) + { + if (sender is Control anchor) + GetSelectedRdpView()?.ToggleMultiMonitorPopup(anchor, PlacementMode.Bottom); + } + + private void DetachTabItem(RdpWorkspaceTabItem item) + { + var wasSelected = item.IsSelected; + var index = _tabs.IndexOf(item); + if (index < 0) + return; + + _tabs.RemoveAt(index); + DetachedTabWindow.ShowFor(item.Tab); + + if (_tabs.Count == 0) + { + Close(); + return; + } + + if (wasSelected) + { + var nextIndex = Math.Min(index, _tabs.Count - 1); + SelectTab(_tabs[nextIndex]); + } + } + + private void CloseTabItem(RdpWorkspaceTabItem item) + { + var wasSelected = item.IsSelected; + var index = _tabs.IndexOf(item); + if (index < 0) + return; + + _tabs.RemoveAt(index); + try + { + item.Tab.Dispose(); + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"RDP workspace tab cleanup failed: {ex.Message}"); + } + + if (_tabs.Count == 0) + { + Close(); + return; + } + + if (wasSelected) + { + var nextIndex = Math.Min(index, _tabs.Count - 1); + SelectTab(_tabs[nextIndex]); + } + } + + private void TabItem_OnPointerPressed(object? sender, PointerPressedEventArgs e) + { + if (e.Source is Control source && IsInsideButton(source)) + return; + + if (sender is Control { DataContext: RdpWorkspaceTabItem item }) + { + SelectTab(item); + e.Handled = true; + } + } + + private static bool IsInsideButton(Control? control) + { + while (control != null) + { + if (control is Button) + return true; + control = control.Parent as Control; + } + + return false; + } + + private void DetachTabButton_OnClick(object? sender, RoutedEventArgs e) + { + if (sender is Control { DataContext: RdpWorkspaceTabItem item }) + { + e.Handled = true; + DetachTabItem(item); + } + } + + private void CloseOtherTabsButton_OnClick(object? sender, RoutedEventArgs e) + { + if (sender is Control { DataContext: RdpWorkspaceTabItem keep }) + { + e.Handled = true; + foreach (var other in _tabs.Where(t => !ReferenceEquals(t, keep)).ToList()) + CloseTabItem(other); + } + } + + private void CloseTabButton_OnClick(object? sender, RoutedEventArgs e) + { + if (sender is Control { DataContext: RdpWorkspaceTabItem item }) + { + e.Handled = true; + CloseTabItem(item); + } + } + + private void OnClosed(object? sender, EventArgs e) + { + FloatingBar?.StopTimer(); + if (_selectedRdpVm != null) + { + _selectedRdpVm.PropertyChanged -= OnSelectedRdpPropertyChanged; + _selectedRdpVm = null; + } + if (ReferenceEquals(_instance, this)) + _instance = null; + + foreach (var item in _tabs.ToArray()) + { + try + { + item.Tab.Dispose(); + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"RDP workspace tab cleanup failed: {ex.Message}"); + } + } + + _tabs.Clear(); + } + + private void OnWindowPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property != WindowStateProperty) + return; + + var state = WindowState; + if (state != WindowState.FullScreen) + _windowStateBeforeFullScreen = state; + + var isImmersive = state is WindowState.Maximized or WindowState.FullScreen; + IsTitleBarVisible = !isImmersive; + WindowDecorations = state == WindowState.FullScreen + ? WindowDecorations.None + : WindowDecorations.Full; + FloatingBar?.SetImmersiveActive(isImmersive); + } + + private void OnWindowKeyDown(object? sender, KeyEventArgs e) + { + if (e.Key == Key.Escape && WindowState == WindowState.FullScreen) + { + ExitFullScreen(); + e.Handled = true; + return; + } + + if (e.Key != Key.F11) + return; + + ToggleWindowFullScreen(); + e.Handled = true; + } + + private void ToggleWindowFullScreen() + { + if (WindowState == WindowState.FullScreen) + ExitFullScreen(); + else + WindowState = WindowState.FullScreen; + } + + private void ExitFullScreen() + { + if (WindowState != WindowState.FullScreen) + return; + + WindowState = _windowStateBeforeFullScreen == WindowState.FullScreen + ? WindowState.Normal + : _windowStateBeforeFullScreen; + } +} diff --git a/Views/SessionEditDialog.axaml b/Views/SessionEditDialog.axaml index 4f909c7..e1d16b3 100644 --- a/Views/SessionEditDialog.axaml +++ b/Views/SessionEditDialog.axaml @@ -1700,6 +1700,32 @@ + + + + + + + + + + vm.MainWindow.OpenRdpInWorkspaceWindowAsync(rdpSession), vm.CanUseSelectedSession); + AddItem(LocalizationService.Shared.Text("Rdp.OpenInDetachedWindow"), () => vm.MainWindow.OpenRdpInDetachedWindowAsync(rdpSession), vm.CanUseSelectedSession); + } AddItem(vm.PropertiesText, () => { OnEditClick(anchor, new RoutedEventArgs()); diff --git a/Views/SettingsCenterWindow.axaml b/Views/SettingsCenterWindow.axaml index e1d1912..e118ed5 100644 --- a/Views/SettingsCenterWindow.axaml +++ b/Views/SettingsCenterWindow.axaml @@ -160,25 +160,25 @@ + IsVisible="{Binding #SettingsCenter.((vm:SettingsCenterViewModel)DataContext).IsApplicationSelected}"/> + IsVisible="{Binding #SettingsCenter.((vm:SettingsCenterViewModel)DataContext).IsAgentSelected}"/> + IsVisible="{Binding #SettingsCenter.((vm:SettingsCenterViewModel)DataContext).IsAuditSelected}"/> + IsVisible="{Binding #SettingsCenter.((vm:SettingsCenterViewModel)DataContext).IsRecordingsSelected}"/> + IsVisible="{Binding #SettingsCenter.((vm:SettingsCenterViewModel)DataContext).IsTrustedHostsSelected}"/> + DataContext="{Binding #SettingsCenter.DataContext}" + IsVisible="{Binding #SettingsCenter.((vm:SettingsCenterViewModel)DataContext).IsAboutSelected}"/> + DataContext="{Binding #SettingsCenter.DataContext}" + IsVisible="{Binding #SettingsCenter.((vm:SettingsCenterViewModel)DataContext).IsSupportDonateSelected}"/>