Skip to content

Commit d5427ff

Browse files
committed
Remote Desktop - Settings added
1 parent db819c9 commit d5427ff

8 files changed

Lines changed: 150 additions & 15 deletions

File tree

Source/NETworkManager/Controls/RemoteDesktopControl.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public RemoteDesktopControl(RemoteDesktopSessionInfo info)
8787
rdpClient.AdvancedSettings9.RedirectPrinters = info.RedirectPrinters;
8888

8989
// Display
90-
rdpClient.ColorDepth = 24; // 8, 15, 16, 24
91-
rdpClient.DesktopHeight = 768;
92-
rdpClient.DesktopWidth = 1280;
90+
rdpClient.ColorDepth = info.ColorDepth; // 8, 15, 16, 24
91+
rdpClient.DesktopWidth = info.DesktopWidth;
92+
rdpClient.DesktopHeight = info.DesktopHeight;
9393

9494
// Events
9595
rdpClient.OnDisconnected += RdpClient_OnDisconnected; ;

Source/NETworkManager/Models/RemoteDesktop/RemoteDesktopSessionInfo.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
public class RemoteDesktopSessionInfo
44
{
55
public string Hostname { get; set; }
6+
public int DesktopWidth { get; set; }
7+
public int DesktopHeight { get; set; }
8+
public int ColorDepth { get; set; }
69
public bool RedirectClipboard { get; set; }
710
public bool RedirectDevices { get; set; }
811
public bool RedirectDrives { get; set; }
@@ -15,9 +18,12 @@ public RemoteDesktopSessionInfo()
1518

1619
}
1720

18-
public RemoteDesktopSessionInfo(string hostname, bool redirectClipboard, bool redirectDevices, bool redirectDrives, bool redirectPorts, bool redirectSmartCards, bool redirectPrinters)
21+
public RemoteDesktopSessionInfo(string hostname, int desktopWidth, int desktopHeight, int colorDepth, bool redirectClipboard, bool redirectDevices, bool redirectDrives, bool redirectPorts, bool redirectSmartCards, bool redirectPrinters)
1922
{
2023
Hostname = hostname;
24+
DesktopWidth = desktopWidth;
25+
DesktopHeight = desktopHeight;
26+
ColorDepth = colorDepth;
2127
RedirectClipboard = redirectClipboard;
2228
RedirectDevices = redirectDevices;
2329
RedirectDrives = redirectDrives;

Source/NETworkManager/Models/Settings/SettingsInfo.cs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,49 @@ public List<string> SubnetCalculator_IPv4Splitter_NewSubnetmaskOrCIDRHistory
10941094
#endregion
10951095
#endregion
10961096

1097-
#region RemoteDesktop
1097+
#region RemoteDesktop
1098+
private int _remoteDesktop_DesktopWidth = 1280;
1099+
public int RemoteDesktop_DesktopWidth
1100+
{
1101+
get { return _remoteDesktop_DesktopWidth; }
1102+
set
1103+
{
1104+
if (value == _remoteDesktop_DesktopWidth)
1105+
return;
1106+
1107+
_remoteDesktop_DesktopWidth = value;
1108+
SettingsChanged = true;
1109+
}
1110+
}
1111+
1112+
private int _remoteDesktop_DesktopHeight = 768;
1113+
public int RemoteDesktop_DesktopHeight
1114+
{
1115+
get { return _remoteDesktop_DesktopHeight; }
1116+
set
1117+
{
1118+
if (value == _remoteDesktop_DesktopHeight)
1119+
return;
1120+
1121+
_remoteDesktop_DesktopHeight = value;
1122+
SettingsChanged = true;
1123+
}
1124+
}
1125+
1126+
private int _remoteDesktop_ColorDepth = 32;
1127+
public int RemoteDesktop_ColorDepth
1128+
{
1129+
get { return _remoteDesktop_ColorDepth; }
1130+
set
1131+
{
1132+
if (value == _remoteDesktop_ColorDepth)
1133+
return;
1134+
1135+
_remoteDesktop_ColorDepth = value;
1136+
SettingsChanged = true;
1137+
}
1138+
}
1139+
10981140
private bool _remoteDesktop_RedirectClipboard = true;
10991141
public bool RemoteDesktop_RedirectClipboard
11001142
{

Source/NETworkManager/Resources/Localization/Resources.de-DE.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
<system:String x:Key="String_Header_RemoteDesktop">Remote Desktop</system:String>
7777
<system:String x:Key="String_Header_Disconnected">Getrennt</system:String>
7878
<system:String x:Key="String_Header_LocalDevicesAndResources">Lokale Geräte und Ressourcen</system:String>
79-
79+
<system:String x:Key="String_Header_Display">Anzeige</system:String>
80+
8081
<!-- Normal strings -->
8182
<system:String x:Key="String_ProductName">NETworkManager</system:String>
8283
<system:String x:Key="String_Slogan">Ein leistungsstarkes Tool zum Verwalten von Netzwerken und zur Behebung von Netzwerkproblemen!</system:String>
@@ -276,6 +277,8 @@
276277
<system:String x:Key="String_RedirectPorts">Ports umleiten</system:String>
277278
<system:String x:Key="String_RedirectSmartcards">Smartcards umleiten</system:String>
278279
<system:String x:Key="String_RedirectPrinters">Drucker umleiten</system:String>
280+
<system:String x:Key="String_ScreenResolution">Bildschirmauflösung</system:String>
281+
<system:String x:Key="String_ColorDepthBit">Farbtiefe (Bit)</system:String>
279282

280283
<!-- ToolTip -->
281284
<system:String x:Key="String_ToolTip_Settings">Einstellungen</system:String>

Source/NETworkManager/Resources/Localization/Resources.en-US.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<system:String x:Key="String_Header_RemoteDesktop">Remote Desktop</system:String>
7777
<system:String x:Key="String_Header_Disconnected">Disconnected</system:String>
7878
<system:String x:Key="String_Header_LocalDevicesAndResources">Local devices and resources</system:String>
79+
<system:String x:Key="String_Header_Display">Display</system:String>
7980

8081
<!-- Normal strings -->
8182
<system:String x:Key="String_ProductName">NETworkManager</system:String>
@@ -276,7 +277,8 @@
276277
<system:String x:Key="String_RedirectPorts">Redirect ports</system:String>
277278
<system:String x:Key="String_RedirectSmartcards">Redirect smartcards</system:String>
278279
<system:String x:Key="String_RedirectPrinters">Redirect printers</system:String>
279-
280+
<system:String x:Key="String_ScreenResolution">Screen resolution</system:String>
281+
<system:String x:Key="String_ColorDepthBit">Color depth (bit)</system:String>
280282
<!-- ToolTip -->
281283
<system:String x:Key="String_ToolTip_Settings">Settings</system:String>
282284
<system:String x:Key="String_ToolTip_Expand">Expand</system:String>

Source/NETworkManager/ViewModels/Applications/RemoteDesktopViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using NETworkManager.Models.Settings;
1010
using System.ComponentModel;
1111
using System.Windows.Data;
12-
using System.Collections.Generic;
1312
using System;
1413

1514
namespace NETworkManager.ViewModels.Applications
@@ -138,6 +137,9 @@ private void LoadSettings()
138137
private void ConnectSession(Models.RemoteDesktop.RemoteDesktopSessionInfo sessionInfo, string Header = null)
139138
{
140139
// Add global settings...
140+
sessionInfo.DesktopWidth = SettingsManager.Current.RemoteDesktop_DesktopWidth;
141+
sessionInfo.DesktopHeight = SettingsManager.Current.RemoteDesktop_DesktopHeight;
142+
sessionInfo.ColorDepth = SettingsManager.Current.RemoteDesktop_ColorDepth;
141143
sessionInfo.RedirectClipboard = SettingsManager.Current.RemoteDesktop_RedirectClipboard;
142144
sessionInfo.RedirectDevices = SettingsManager.Current.RemoteDesktop_RedirectDevices;
143145
sessionInfo.RedirectDrives = SettingsManager.Current.RemoteDesktop_RedirectDrives;

Source/NETworkManager/ViewModels/Settings/SettingsApplicationRemoteDesktopViewModel.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using NETworkManager.Models.Settings;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Windows;
25

36
namespace NETworkManager.ViewModels.Settings
47
{
@@ -7,6 +10,77 @@ public class SettingsApplicationRemoteDesktopViewModel : ViewModelBase
710
#region Variables
811
private bool _isLoading = true;
912

13+
public List<string> ScreenResolutions
14+
{
15+
get
16+
{
17+
return new List<string>()
18+
{
19+
"640x480",
20+
"800x600",
21+
"1024x768",
22+
"1280x720",
23+
"1280x768",
24+
"1280x800",
25+
"1280x1024",
26+
"1366x768",
27+
"1440x900",
28+
"1400x1050",
29+
"1680x1050",
30+
"1920x1080"
31+
};
32+
}
33+
}
34+
35+
private string _selectedScreenResolution;
36+
public string SelectedScreenResolution
37+
{
38+
get { return _selectedScreenResolution; }
39+
set
40+
{
41+
if (value == _selectedScreenResolution)
42+
return;
43+
44+
if (!_isLoading)
45+
{
46+
string[] resolution = value.Split('x');
47+
48+
SettingsManager.Current.RemoteDesktop_DesktopWidth = int.Parse(resolution[0]);
49+
SettingsManager.Current.RemoteDesktop_DesktopHeight = int.Parse(resolution[1]);
50+
}
51+
52+
_selectedScreenResolution = value;
53+
OnPropertyChanged();
54+
}
55+
}
56+
57+
public List<int> ColorDepths
58+
{
59+
get
60+
{
61+
return new List<int>()
62+
{
63+
15,
64+
16,
65+
24,
66+
32
67+
};
68+
}
69+
}
70+
71+
private int _selectedColorDepth;
72+
public int SelectedColorDepth
73+
{
74+
get { return _selectedColorDepth; }
75+
set
76+
{ if (value == _selectedColorDepth)
77+
return;
78+
79+
_selectedColorDepth = value;
80+
OnPropertyChanged();
81+
}
82+
}
83+
1084
private bool _redirectClipboard;
1185
public bool RedirectClipboard
1286
{
@@ -120,6 +194,8 @@ public SettingsApplicationRemoteDesktopViewModel()
120194

121195
private void LoadSettings()
122196
{
197+
SelectedScreenResolution = ScreenResolutions.FirstOrDefault(x => x == string.Format("{0}x{1}", SettingsManager.Current.RemoteDesktop_DesktopWidth, SettingsManager.Current.RemoteDesktop_DesktopHeight));
198+
SelectedColorDepth = ColorDepths.FirstOrDefault(x => x == SettingsManager.Current.RemoteDesktop_ColorDepth);
123199
RedirectClipboard = SettingsManager.Current.RemoteDesktop_RedirectClipboard;
124200
RedirectDevices = SettingsManager.Current.RemoteDesktop_RedirectDevices;
125201
RedirectDrives = SettingsManager.Current.RemoteDesktop_RedirectDrives;

Source/NETworkManager/Views/Settings/SettingsApplicationRemoteDesktopView.xaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:Validator="clr-namespace:NETworkManager.Validators"
76
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
87
mc:Ignorable="d">
98
<StackPanel>
9+
<TextBlock Text="{DynamicResource String_Header_Display}" Style="{StaticResource HeaderTextBlock}" />
10+
<TextBlock Text="{DynamicResource String_ScreenResolution}" Style="{DynamicResource DefaultTextBlock}" VerticalAlignment="Center" Margin="0,0,0,10" />
11+
<ComboBox ItemsSource="{Binding ScreenResolutions}" SelectedItem="{Binding SelectedScreenResolution}" Width="250" HorizontalAlignment="Left" Margin="0,0,0,10" />
12+
<TextBlock Text="{DynamicResource String_ColorDepthBit}" Style="{DynamicResource DefaultTextBlock}" VerticalAlignment="Center" Margin="0,0,0,10" />
13+
<ComboBox ItemsSource="{Binding ColorDepths}" SelectedItem="{Binding SelectedColorDepth}" Width="250" HorizontalAlignment="Left" Margin="0,0,0,20" />
1014
<TextBlock Text="{DynamicResource String_Header_LocalDevicesAndResources}" Style="{StaticResource HeaderTextBlock}" />
11-
<mah:ToggleSwitch Header="{DynamicResource String_RedirectClipboard}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectClipboard}" Margin="0,0,0,10"/>
12-
<mah:ToggleSwitch Header="{DynamicResource String_RedirectDevices}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectDevices}" Margin="0,0,0,10"/>
13-
<mah:ToggleSwitch Header="{DynamicResource String_RedirectDrives}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectDrives}" Margin="0,0,0,10"/>
14-
<mah:ToggleSwitch Header="{DynamicResource String_RedirectPorts}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectPorts}" Margin="0,0,0,10"/>
15-
<mah:ToggleSwitch Header="{DynamicResource String_RedirectSmartcards}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectSmartCards}" Margin="0,0,0,10"/>
16-
<mah:ToggleSwitch Header="{DynamicResource String_RedirectPrinters}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectPrinters}" Margin="0,0,0,10"/>
15+
<mah:ToggleSwitch Header="{DynamicResource String_RedirectClipboard}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectClipboard}" Margin="0,0,0,10" />
16+
<mah:ToggleSwitch Header="{DynamicResource String_RedirectDevices}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectDevices}" Margin="0,0,0,10" />
17+
<mah:ToggleSwitch Header="{DynamicResource String_RedirectDrives}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectDrives}" Margin="0,0,0,10" />
18+
<mah:ToggleSwitch Header="{DynamicResource String_RedirectPorts}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectPorts}" Margin="0,0,0,10" />
19+
<mah:ToggleSwitch Header="{DynamicResource String_RedirectSmartcards}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectSmartCards}" Margin="0,0,0,10" />
20+
<mah:ToggleSwitch Header="{DynamicResource String_RedirectPrinters}" OnLabel="{DynamicResource String_ToggleSwitch_On}" OffLabel="{DynamicResource String_ToggleSwitch_Off}" IsChecked="{Binding RedirectPrinters}" />
1721
</StackPanel>
1822
</UserControl>

0 commit comments

Comments
 (0)