Skip to content

Commit db819c9

Browse files
committed
Remote Desktop - reset/export/import settings & translation, bugfixes, cleanup
1 parent 1de6c57 commit db819c9

31 files changed

Lines changed: 275 additions & 102 deletions

Source/NETworkManager/App.xaml.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
4646
// Get assembly informations
4747
AssemblyManager.Load();
4848

49-
// Load settings
49+
// Load application settings (profiles/sessions/clients are loaded when needed)
5050
SettingsManager.Load();
5151

5252
// Load localization (requires settings to be loaded first)
@@ -92,6 +92,21 @@ private void Application_Exit(object sender, ExitEventArgs e)
9292
{
9393
if (SettingsManager.Current.SettingsChanged)
9494
SettingsManager.Save();
95+
96+
if (NetworkInterfaceProfileManager.ProfilesChanged)
97+
NetworkInterfaceProfileManager.Save();
98+
99+
if (IPScannerProfileManager.ProfilesChanged)
100+
IPScannerProfileManager.Save();
101+
102+
if (WakeOnLANClientManager.ClientsChanged)
103+
WakeOnLANClientManager.Save();
104+
105+
if (PortScannerProfileManager.ProfilesChanged)
106+
PortScannerProfileManager.Save();
107+
108+
if (RemoteDesktopSessionManager.SessionsChanged)
109+
RemoteDesktopSessionManager.Save();
95110
}
96111
}
97112
}

Source/NETworkManager/Controls/RemoteDesktopControl.xaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ public RemoteDesktopControl(RemoteDesktopSessionInfo info)
7979
rdpClient.AdvancedSettings9.EnableCredSspSupport = true;
8080

8181
// Devices and resources
82-
rdpClient.AdvancedSettings9.RedirectClipboard = false;
83-
rdpClient.AdvancedSettings9.RedirectDevices = false;
84-
rdpClient.AdvancedSettings9.RedirectDrives = false;
85-
rdpClient.AdvancedSettings9.RedirectPorts = false;
86-
rdpClient.AdvancedSettings9.RedirectSmartCards = false;
87-
rdpClient.AdvancedSettings9.RedirectPrinters = false;
82+
rdpClient.AdvancedSettings9.RedirectClipboard = info.RedirectClipboard;
83+
rdpClient.AdvancedSettings9.RedirectDevices = info.RedirectDevices;
84+
rdpClient.AdvancedSettings9.RedirectDrives = info.RedirectDrives;
85+
rdpClient.AdvancedSettings9.RedirectPorts = info.RedirectPorts;
86+
rdpClient.AdvancedSettings9.RedirectSmartCards = info.RedirectSmartCards;
87+
rdpClient.AdvancedSettings9.RedirectPrinters = info.RedirectPrinters;
8888

8989
// Display
9090
rdpClient.ColorDepth = 24; // 8, 15, 16, 24

Source/NETworkManager/Converters/ValidateSettingsExportConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public sealed class ValidateSettingsExportConverter : IMultiValueConverter
88
{
99
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1010
{
11-
return (!(bool)values[0] && (bool)values[1] || (bool)values[2] || (bool)values[3] || (bool)values[4] || (bool)values[5]);
11+
return (!(bool)values[0] && (bool)values[1] || (bool)values[2] || (bool)values[3] || (bool)values[4] || (bool)values[5] || (bool)values[6]);
1212
}
1313

1414
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)

Source/NETworkManager/Converters/ValidateSettingsImportConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public sealed class ValidateSettingsImportConverter : IMultiValueConverter
88
{
99
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1010
{
11-
return (!(bool)values[0] && (bool)values[1] || (bool)values[2] || (bool)values[3] || (bool)values[4] || (bool)values[5]);
11+
return (!(bool)values[0] && (bool)values[1] || (bool)values[2] || (bool)values[3] || (bool)values[4] || (bool)values[5] || (bool)values[6]);
1212
}
1313

1414
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)

Source/NETworkManager/Converters/ValidateSettingsResetConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public sealed class ValidateSettingsResetConverter : IMultiValueConverter
88
{
99
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1010
{
11-
return (!(bool)values[0] && (bool)values[1] || (bool)values[2] || (bool)values[3] || (bool)values[4] || (bool)values[5]);
11+
return (!(bool)values[0] && (bool)values[1] || (bool)values[2] || (bool)values[3] || (bool)values[4] || (bool)values[5] || (bool)values[6]);
1212
}
1313

1414
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)

Source/NETworkManager/MainWindow.xaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,6 @@
218218
</Style.Triggers>
219219
</Style>
220220
</TextBox.Style>
221-
<TextBox.InputBindings>
222-
<KeyBinding Key="Esc" Command="{Binding TextBoxSearchCommand}" />
223-
<KeyBinding Key="Delete" Command="{Binding TextBoxSearchCommand}" />
224-
</TextBox.InputBindings>
225221
<Interactivity:Interaction.Triggers>
226222
<Interactivity:EventTrigger EventName="GotKeyboardFocus">
227223
<Interactivity:InvokeCommandAction Command="{Binding TextBoxSearchGotKeyboardFocusCommand}" />
@@ -527,7 +523,7 @@
527523
<RowDefinition Height="*" />
528524
</Grid.RowDefinitions>
529525
<Border x:Name="HeaderBorder" Grid.Row="0" BorderBrush="{DynamicResource GrayBrush8}" BorderThickness="0,0,0,1" MouseDown="HeaderBorder_MouseDown">
530-
<TextBlock VerticalAlignment="Center" Height="48" TextAlignment="Center" Style="{StaticResource HeaderTextBlock}" Text="{Binding SelectedApplicationViewInfo.TranslatedName}" Foreground="{DynamicResource GrayBrush3}" Margin="0" />
526+
<TextBlock VerticalAlignment="Center" Height="48" TextAlignment="Center" Style="{StaticResource HeaderTextBlock}" Text="{Binding SelectedApplication.TranslatedName}" Foreground="{DynamicResource GrayBrush3}" Margin="0" />
531527
</Border>
532528
<ContentControl x:Name="contentControlApplication" Grid.Row="1" Focusable="False" />
533529
</Grid>

Source/NETworkManager/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ private void ChangeApplicationView(ApplicationViewManager.Name name)
428428

429429
#endregion
430430

431-
#region ListView Search/Filter
431+
#region Methods
432432
private void ClearSearchFilterOnApplicationListMinimize()
433433
{
434434
if (ApplicationView_Expand)

Source/NETworkManager/Models/RemoteDesktop/RemoteDesktopSessionInfo.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,27 @@
33
public class RemoteDesktopSessionInfo
44
{
55
public string Hostname { get; set; }
6+
public bool RedirectClipboard { get; set; }
7+
public bool RedirectDevices { get; set; }
8+
public bool RedirectDrives { get; set; }
9+
public bool RedirectPorts { get; set; }
10+
public bool RedirectSmartCards { get; set; }
11+
public bool RedirectPrinters { get; set; }
612

713
public RemoteDesktopSessionInfo()
814
{
915

1016
}
1117

12-
public RemoteDesktopSessionInfo(string hostname)
18+
public RemoteDesktopSessionInfo(string hostname, bool redirectClipboard, bool redirectDevices, bool redirectDrives, bool redirectPorts, bool redirectSmartCards, bool redirectPrinters)
1319
{
1420
Hostname = hostname;
21+
RedirectClipboard = redirectClipboard;
22+
RedirectDevices = redirectDevices;
23+
RedirectDrives = redirectDrives;
24+
RedirectPorts = redirectPorts;
25+
RedirectSmartCards = redirectSmartCards;
26+
RedirectPrinters = redirectPrinters;
1527
}
1628
}
1729
}

Source/NETworkManager/Models/Settings/IPScannerProfileManager.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void Load(bool deserialize = true)
3737
if (deserialize)
3838
Deserialize().ForEach(profile => AddProfile(profile));
3939

40-
Profiles.CollectionChanged += Templates_CollectionChanged; ;
40+
Profiles.CollectionChanged += Templates_CollectionChanged;
4141
}
4242

4343
public static void Import(bool overwrite)
@@ -90,9 +90,14 @@ private static void Serialize()
9090
public static void Reset()
9191
{
9292
if (Profiles == null)
93-
Profiles = new ObservableCollection<IPScannerProfileInfo>();
93+
{
94+
Load(false);
95+
ProfilesChanged = true;
96+
}
9497
else
98+
{
9599
Profiles.Clear();
100+
}
96101
}
97102

98103
public static void AddProfile(IPScannerProfileInfo profile)

Source/NETworkManager/Models/Settings/ImportExportManager.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public enum ImportExportOptions
8484
NetworkInterfaceProfiles,
8585
IPScannerProfiles,
8686
WakeOnLANClients,
87-
PortScannerProfiles
87+
PortScannerProfiles,
88+
RemoteDesktopSessions
8889
}
8990

9091
public static ImportExportOptions GetImportExportOption(string fileName)
@@ -105,6 +106,9 @@ public static ImportExportOptions GetImportExportOption(string fileName)
105106
if (fileName == PortScannerProfileManager.ProfilesFileName)
106107
return ImportExportOptions.PortScannerProfiles;
107108

109+
if (fileName == RemoteDesktopSessionManager.SessionsFileName)
110+
return ImportExportOptions.RemoteDesktopSessions;
111+
108112
return ImportExportOptions.None;
109113
}
110114

@@ -122,6 +126,8 @@ private static string GetImportExportOptionFileName(ImportExportOptions importEx
122126
return WakeOnLANClientManager.ClientsFileName;
123127
case ImportExportOptions.PortScannerProfiles:
124128
return PortScannerProfileManager.ProfilesFileName;
129+
case ImportExportOptions.RemoteDesktopSessions:
130+
return RemoteDesktopSessionManager.SessionsFileName;
125131
}
126132

127133
return string.Empty;
@@ -141,6 +147,8 @@ private static string GetImportExportOptionFilePath(ImportExportOptions importEx
141147
return WakeOnLANClientManager.GetClientsFilePath();
142148
case ImportExportOptions.PortScannerProfiles:
143149
return PortScannerProfileManager.GetProfilesFilePath();
150+
case ImportExportOptions.RemoteDesktopSessions:
151+
return RemoteDesktopSessionManager.GetSessionsFilePath();
144152
}
145153

146154
return string.Empty;

0 commit comments

Comments
 (0)