Skip to content

Commit 5ab5ef9

Browse files
committed
1 parent 517c6b9 commit 5ab5ef9

7 files changed

Lines changed: 53 additions & 30 deletions

File tree

Source/NETworkManager/Controls/RemoteDesktopControl.xaml.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,33 @@ private void Connect()
182182
RdpClient.AdvancedSettings9.RedirectSmartCards = _rdpSessionInfo.RedirectSmartCards;
183183
RdpClient.AdvancedSettings9.RedirectPrinters = _rdpSessionInfo.RedirectPrinters;
184184

185+
// Performance
186+
RdpClient.AdvancedSettings9.BitmapPeristence = _rdpSessionInfo.PersistentBitmapCaching ? 1 : 0;
187+
RdpClient.AdvancedSettings9.EnableAutoReconnect = _rdpSessionInfo.ReconnectIfTheConnectionIsDropped;
188+
185189
// Experience
186-
RdpClient.AdvancedSettings9.NetworkConnectionType = 0x1;
187-
RdpClient.AdvancedSettings9.PerformanceFlags |= 0x00000001;
188-
RdpClient.AdvancedSettings9.BitmapPersistence = true ? 1 : 0;
190+
if (_rdpSessionInfo.ConnectionSpeed != 0)
191+
{
192+
RdpClient.AdvancedSettings9.NetworkConnectionType = _rdpSessionInfo.ConnectionSpeed;
193+
194+
if (!_rdpSessionInfo.DesktopBackground)
195+
RdpClient.AdvancedSettings9.PerformanceFlags |= RemoteDesktopPerformanceConstants.TS_PERF_DISABLE_WALLPAPER;
196+
197+
if (_rdpSessionInfo.FontSmoothing)
198+
RdpClient.AdvancedSettings9.PerformanceFlags |= RemoteDesktopPerformanceConstants.TS_PERF_ENABLE_FONT_SMOOTHING;
199+
200+
if (_rdpSessionInfo.DesktopComposition)
201+
RdpClient.AdvancedSettings9.PerformanceFlags |= RemoteDesktopPerformanceConstants.TS_PERF_ENABLE_DESKTOP_COMPOSITION;
202+
203+
if (!_rdpSessionInfo.ShowWindowContentsWhileDragging)
204+
RdpClient.AdvancedSettings9.PerformanceFlags |= RemoteDesktopPerformanceConstants.TS_PERF_DISABLE_FULLWINDOWDRAG;
205+
206+
if (!_rdpSessionInfo.MenuAndWindowAnimation)
207+
RdpClient.AdvancedSettings9.PerformanceFlags |= RemoteDesktopPerformanceConstants.TS_PERF_DISABLE_MENUANIMATIONS;
208+
209+
if (!_rdpSessionInfo.VisualStyles)
210+
RdpClient.AdvancedSettings9.PerformanceFlags |= RemoteDesktopPerformanceConstants.TS_PERF_DISABLE_THEMING;
211+
}
189212

190213
// Display
191214
RdpClient.ColorDepth = _rdpSessionInfo.ColorDepth; // 8, 15, 16, 24

Source/NETworkManager/GlobalStaticConfiguration.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,17 @@ public class GlobalStaticConfiguration
122122
};
123123
public static int RemoteDesktop_KeyboardHookMode => 1;
124124
public static uint RemoteDesktop_AuthenticationLevel => 2;
125-
public static List<Tuple<int, string>> RemoteDesktop_ConnectionSpeeds => new List<Tuple<int, string>>
125+
public static List<Tuple<uint, string>> RemoteDesktop_ConnectionSpeeds => new List<Tuple<uint, string>>
126126
{
127-
Tuple.Create(0,Resources.Localization.Strings.RemoteDesktopConnectionType_DetectAutomatically),
128-
Tuple.Create(1,Resources.Localization.Strings.RemoteDesktopConnectionType_Modem),
129-
Tuple.Create(2,Resources.Localization.Strings.RemoteDesktopConnectionType_BroadbandLow),
130-
Tuple.Create(3,Resources.Localization.Strings.RemoteDesktopConnectionType_Satellite),
131-
Tuple.Create(4,Resources.Localization.Strings.RemoteDesktopConnectionType_BroadbandHigh),
132-
Tuple.Create(5,Resources.Localization.Strings.RemoteDesktopConnectionType_WAN),
133-
Tuple.Create(6,Resources.Localization.Strings.RemoteDesktopConnectionType_LAN)
127+
Tuple.Create((uint)0,Resources.Localization.Strings.RemoteDesktopConnectionType_DetectAutomatically),
128+
Tuple.Create((uint)1,Resources.Localization.Strings.RemoteDesktopConnectionType_Modem),
129+
Tuple.Create((uint)2,Resources.Localization.Strings.RemoteDesktopConnectionType_BroadbandLow),
130+
Tuple.Create((uint)3,Resources.Localization.Strings.RemoteDesktopConnectionType_Satellite),
131+
Tuple.Create((uint)4,Resources.Localization.Strings.RemoteDesktopConnectionType_BroadbandHigh),
132+
Tuple.Create((uint)5,Resources.Localization.Strings.RemoteDesktopConnectionType_WAN),
133+
Tuple.Create((uint)6,Resources.Localization.Strings.RemoteDesktopConnectionType_LAN)
134134
};
135-
public static int RemoteDesktop_ConnectionSpeed => 0;
135+
public static uint RemoteDesktop_ConnectionSpeed => 0;
136136

137137
// Application: PowerShell
138138
public static string PowerShell_ApplicationFileLocationPowerShell => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), @"System32\WindowsPowerShell\v1.0\powershell.exe");

Source/NETworkManager/Models/RemoteDesktop/RemoteDesktopPerformanceConstants.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@
33
public static class RemoteDesktopPerformanceConstants
44
{
55
// No features are disabled.
6-
private const uint TS_PERF_DISABLE_NOTHING = 0x00000000;
6+
public const int TS_PERF_DISABLE_NOTHING = 0x00000000;
77

88
// Wallpaper on the desktop is not displayed.
9-
private const uint TS_PERF_DISABLE_WALLPAPER = 0x00000001;
9+
public const int TS_PERF_DISABLE_WALLPAPER = 0x00000001;
1010

1111
// Full-window drag is disabled; only the window outline is displayed when the window is moved.
12-
private const uint TS_PERF_DISABLE_FULLWINDOWDRAG = 0x00000002;
12+
public const int TS_PERF_DISABLE_FULLWINDOWDRAG = 0x00000002;
1313

1414
// Menu animations are disabled.
15-
private const uint TS_PERF_DISABLE_MENUANIMATIONS = 0x00000004;
15+
public const int TS_PERF_DISABLE_MENUANIMATIONS = 0x00000004;
1616

1717
// Themes are disabled.
18-
private const uint TS_PERF_DISABLE_THEMING = 0x00000008;
18+
public const int TS_PERF_DISABLE_THEMING = 0x00000008;
1919

2020
// Enable enhanced graphics.
21-
private const uint TS_PERF_ENABLE_ENHANCED_GRAPHICS = 0x00000010;
21+
public const int TS_PERF_ENABLE_ENHANCED_GRAPHICS = 0x00000010;
2222

2323
// No shadow is displayed for the cursor.
24-
private const uint TS_PERF_DISABLE_CURSOR_SHADOW = 0x00000020;
24+
public const int TS_PERF_DISABLE_CURSOR_SHADOW = 0x00000020;
2525

2626
// Cursor blinking is disabled.
27-
private const uint TS_PERF_DISABLE_CURSORSETTINGS = 0x00000040;
27+
public const int TS_PERF_DISABLE_CURSORSETTINGS = 0x00000040;
2828

2929
// Font smoothing
30-
private const uint TS_PERF_ENABLE_FONT_SMOOTHING = 0x00000080;
30+
public const int TS_PERF_ENABLE_FONT_SMOOTHING = 0x00000080;
3131

3232
// Desktop composition
33-
private const uint TS_PERF_ENABLE_DESKTOP_COMPOSITION = 0x00000100;
33+
public const int TS_PERF_ENABLE_DESKTOP_COMPOSITION = 0x00000100;
3434

3535
}
3636
}

Source/NETworkManager/Models/RemoteDesktop/RemoteDesktopSessionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class RemoteDesktopSessionInfo
2525
public bool RedirectPrinters { get; set; }
2626
public bool PersistentBitmapCaching { get; set; }
2727
public bool ReconnectIfTheConnectionIsDropped { get; set; }
28-
public int ConnectionSpeed { get; set; }
28+
public uint ConnectionSpeed { get; set; }
2929
public bool DesktopBackground { get; set; }
3030
public bool FontSmoothing { get; set; }
3131
public bool DesktopComposition { get; set; }

Source/NETworkManager/Models/Settings/ProfileInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class ProfileInfo
8282
public bool RemoteDesktop_OverrideReconnectIfTheConnectionIsDropped { get; set; }
8383
public bool RemoteDesktop_ReconnectIfTheConnectionIsDropped { get; set; }
8484
public bool RemoteDesktop_OverrideConnectionSpeed { get; set; }
85-
public int RemoteDesktop_ConnectionSpeed { get; set; }
85+
public uint RemoteDesktop_ConnectionSpeed { get; set; }
8686
public bool RemoteDesktop_OverrideDesktopBackground { get; set; }
8787
public bool RemoteDesktop_DesktopBackground { get; set; }
8888
public bool RemoteDesktop_OverrideFontSmoothing { get; set; }

Source/NETworkManager/Models/Settings/SettingsInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,8 +2111,8 @@ public bool RemoteDesktop_ReconnectIfTheConnectionIsDropped
21112111
}
21122112
}
21132113

2114-
private int _remoteDesktop_ConnectionSpeed = GlobalStaticConfiguration.RemoteDesktop_ConnectionSpeed;
2115-
public int RemoteDesktop_ConnectionSpeed
2114+
private uint _remoteDesktop_ConnectionSpeed = GlobalStaticConfiguration.RemoteDesktop_ConnectionSpeed;
2115+
public uint RemoteDesktop_ConnectionSpeed
21162116
{
21172117
get => _remoteDesktop_ConnectionSpeed;
21182118
set

Source/NETworkManager/ViewModels/RemoteDesktopSettingsViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ public bool ReconnectIfTheConnectionIsDropped
361361
OnPropertyChanged();
362362
}
363363
}
364-
public List<Tuple<int, string>> ConnectionSpeeds => GlobalStaticConfiguration.RemoteDesktop_ConnectionSpeeds;
364+
public List<Tuple<uint, string>> ConnectionSpeeds => GlobalStaticConfiguration.RemoteDesktop_ConnectionSpeeds;
365365

366-
private Tuple<int, string> _connectionSpeed;
367-
public Tuple<int, string> ConnectionSpeed
366+
private Tuple<uint, string> _connectionSpeed;
367+
public Tuple<uint, string> ConnectionSpeed
368368
{
369369
get => _connectionSpeed;
370370
set
@@ -529,7 +529,7 @@ private void LoadSettings()
529529
#endregion
530530

531531
#region Methods
532-
private void ChangeConnectionSpeedSettings(int speed)
532+
private void ChangeConnectionSpeedSettings(uint speed)
533533
{
534534
switch (speed)
535535
{

0 commit comments

Comments
 (0)