Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2142,6 +2142,12 @@ is disabled!</value>
<data name="VisualStyles" xml:space="preserve">
<value>Visual styles</value>
</data>
<data name="ViewOnly" xml:space="preserve">
<value>View only</value>
</data>
<data name="ViewOnlyDescription" xml:space="preserve">
<value>Block keyboard and mouse input to the remote session</value>
</data>
<data name="RemoteAudio" xml:space="preserve">
<value>Remote audio</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public class RemoteDesktopSessionInfo
public int DesktopWidth { get; set; }
public int DesktopHeight { get; set; }
public int ColorDepth { get; set; }

// View only (block keyboard and mouse input to the remote session)
public bool ViewOnly { get; set; }

public bool EnableCredSspSupport { get; set; }
public uint AuthenticationLevel { get; set; }
public bool EnableGatewayServer { get; set; }
Expand Down
9 changes: 9 additions & 0 deletions Source/NETworkManager.Profiles/Application/RemoteDesktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public static RemoteDesktopSessionInfo CreateSessionInfo()
: SettingsManager.Current.RemoteDesktop_ScreenHeight,
ColorDepth = SettingsManager.Current.RemoteDesktop_ColorDepth,

// View only
ViewOnly = SettingsManager.Current.RemoteDesktop_ViewOnly,

// Authentication
EnableCredSspSupport = SettingsManager.Current.RemoteDesktop_EnableCredSspSupport,
AuthenticationLevel = SettingsManager.Current.RemoteDesktop_AuthenticationLevel,
Expand Down Expand Up @@ -128,6 +131,12 @@ public static RemoteDesktopSessionInfo CreateSessionInfo(ProfileInfo profile)
info.ColorDepth = group.RemoteDesktop_ColorDepth;
}

// View only
if (profile.RemoteDesktop_OverrideViewOnly)
info.ViewOnly = profile.RemoteDesktop_ViewOnly;
else if (group.RemoteDesktop_OverrideViewOnly)
info.ViewOnly = group.RemoteDesktop_ViewOnly;

// Authentication
if (profile.RemoteDesktop_OverrideCredSspSupport)
info.EnableCredSspSupport = profile.RemoteDesktop_EnableCredSspSupport;
Expand Down
4 changes: 4 additions & 0 deletions Source/NETworkManager.Profiles/GroupInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public GroupInfo(GroupInfo group) : this(group.Name)
RemoteDesktop_ColorDepth = group.RemoteDesktop_ColorDepth;
RemoteDesktop_OverridePort = group.RemoteDesktop_OverridePort;
RemoteDesktop_Port = group.RemoteDesktop_Port;
RemoteDesktop_OverrideViewOnly = group.RemoteDesktop_OverrideViewOnly;
RemoteDesktop_ViewOnly = group.RemoteDesktop_ViewOnly;
RemoteDesktop_OverrideCredSspSupport = group.RemoteDesktop_OverrideCredSspSupport;
RemoteDesktop_EnableCredSspSupport = group.RemoteDesktop_EnableCredSspSupport;
RemoteDesktop_OverrideAuthenticationLevel = group.RemoteDesktop_OverrideAuthenticationLevel;
Expand Down Expand Up @@ -196,6 +198,8 @@ public GroupInfo(GroupInfo group) : this(group.Name)
public int RemoteDesktop_ColorDepth { get; set; } = GlobalStaticConfiguration.RemoteDesktop_ColorDepth;
public bool RemoteDesktop_OverridePort { get; set; }
public int RemoteDesktop_Port { get; set; } = GlobalStaticConfiguration.RemoteDesktop_Port;
public bool RemoteDesktop_OverrideViewOnly { get; set; }
public bool RemoteDesktop_ViewOnly { get; set; } = GlobalStaticConfiguration.RemoteDesktop_ViewOnly;
public bool RemoteDesktop_OverrideCredSspSupport { get; set; }
public bool RemoteDesktop_EnableCredSspSupport { get; set; }
public bool RemoteDesktop_OverrideAuthenticationLevel { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions Source/NETworkManager.Profiles/ProfileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public ProfileInfo(ProfileInfo profile)
RemoteDesktop_ColorDepth = profile.RemoteDesktop_ColorDepth;
RemoteDesktop_OverridePort = profile.RemoteDesktop_OverridePort;
RemoteDesktop_Port = profile.RemoteDesktop_Port;
RemoteDesktop_OverrideViewOnly = profile.RemoteDesktop_OverrideViewOnly;
RemoteDesktop_ViewOnly = profile.RemoteDesktop_ViewOnly;
RemoteDesktop_OverrideCredSspSupport = profile.RemoteDesktop_OverrideCredSspSupport;
RemoteDesktop_EnableCredSspSupport = profile.RemoteDesktop_EnableCredSspSupport;
RemoteDesktop_OverrideAuthenticationLevel = profile.RemoteDesktop_OverrideAuthenticationLevel;
Expand Down Expand Up @@ -345,6 +347,8 @@ public ProfileInfo(ProfileInfo profile)
public int RemoteDesktop_ColorDepth { get; set; } = GlobalStaticConfiguration.RemoteDesktop_ColorDepth;
public bool RemoteDesktop_OverridePort { get; set; }
public int RemoteDesktop_Port { get; set; } = GlobalStaticConfiguration.RemoteDesktop_Port;
public bool RemoteDesktop_OverrideViewOnly { get; set; }
public bool RemoteDesktop_ViewOnly { get; set; } = GlobalStaticConfiguration.RemoteDesktop_ViewOnly;
public bool RemoteDesktop_OverrideCredSspSupport { get; set; }
public bool RemoteDesktop_EnableCredSspSupport { get; set; }
public bool RemoteDesktop_OverrideAuthenticationLevel { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public static class GlobalStaticConfiguration

public static int RemoteDesktop_ColorDepth => 32;
public static int RemoteDesktop_Port => 3389;
public static bool RemoteDesktop_ViewOnly => false;
public static bool RemoteDesktop_GatewayServerBypassLocalAddresses => true;

public static GatewayUserSelectedCredsSource RemoteDesktop_GatewayServerLogonMethod =>
Expand Down
13 changes: 13 additions & 0 deletions Source/NETworkManager.Settings/SettingsInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,19 @@ public int RemoteDesktop_Port
}
} = GlobalStaticConfiguration.RemoteDesktop_Port;

public bool RemoteDesktop_ViewOnly
{
get;
set
{
if (value == field)
return;

field = value;
OnPropertyChanged();
}
} = GlobalStaticConfiguration.RemoteDesktop_ViewOnly;

public bool RemoteDesktop_EnableCredSspSupport
{
get;
Expand Down
51 changes: 49 additions & 2 deletions Source/NETworkManager/Controls/DragablzTabHostWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xmlns:dockablz="clr-namespace:Dragablz.Dockablz;assembly=Dragablz"
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
xmlns:controls="clr-namespace:NETworkManager.Controls"
xmlns:converters="clr-namespace:NETworkManager.Converters;assembly=NETworkManager.Converters"
xmlns:application="clr-namespace:NETworkManager.Models;assembly=NETworkManager.Models"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:wpfHelpers="clr-namespace:NETworkManager.Utilities.WPF;assembly=NETworkManager.Utilities.WPF"
Expand All @@ -18,6 +19,8 @@
d:DataContext="{d:DesignInstance controls:DragablzTabHostWindow}">
<mah:MetroWindow.Resources>
<wpfHelpers:BindingProxy x:Key="BindingProxy" Data="{Binding}" />
<converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
<converters:BooleanReverseToVisibilityCollapsedConverter x:Key="BooleanReverseToVisibilityCollapsedConverter" />
</mah:MetroWindow.Resources>
<mah:MetroWindow.WindowButtonCommands>
<mah:WindowButtonCommands Template="{DynamicResource MahApps.Templates.WindowButtonCommands.Win10}" />
Expand Down Expand Up @@ -53,7 +56,8 @@
<MenuItem
Header="{x:Static localization:Strings.Reconnect}"
Command="{Binding Data.RemoteDesktop_ReconnectCommand, Source={StaticResource BindingProxy}}"
CommandParameter="{Binding View}">
CommandParameter="{Binding View}"
Visibility="{Binding View.IsConnected, Converter={StaticResource BooleanReverseToVisibilityCollapsedConverter}}">
<MenuItem.Icon>
<Rectangle Width="16" Height="16"
Fill="{DynamicResource MahApps.Brushes.Gray3}">
Expand All @@ -67,7 +71,8 @@
<MenuItem
Header="{x:Static localization:Strings.Disconnect}"
Command="{Binding Data.RemoteDesktop_DisconnectCommand, Source={StaticResource BindingProxy}}"
CommandParameter="{Binding View}">
CommandParameter="{Binding View}"
Visibility="{Binding View.IsConnected, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
<MenuItem.Icon>
<Rectangle Width="16" Height="16"
Fill="{DynamicResource MahApps.Brushes.Gray3}">
Expand Down Expand Up @@ -107,6 +112,38 @@
</Rectangle>
</MenuItem.Icon>
</MenuItem>
<MenuItem
Header="{x:Static localization:Strings.ViewOnly}"
Command="{Binding Data.RemoteDesktop_ViewOnlyCommand, Source={StaticResource BindingProxy}}"
CommandParameter="{Binding View}">
<MenuItem.Icon>
<Rectangle Width="16" Height="16"
Fill="{DynamicResource MahApps.Brushes.Gray3}">
<Rectangle.Resources>
<VisualBrush x:Key="VisualEye"
Stretch="Uniform"
Visual="{iconPacks:Material Kind=Eye}" />
<VisualBrush x:Key="VisualEyeOff"
Stretch="Uniform"
Visual="{iconPacks:Material Kind=EyeOff}" />
</Rectangle.Resources>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="OpacityMask"
Value="{StaticResource VisualEyeOff}" />
<Style.Triggers>
<DataTrigger
Binding="{Binding View.IsViewOnly}"
Value="True">
<Setter Property="OpacityMask"
Value="{StaticResource VisualEye}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem
Header="{x:Static localization:Strings.KeyboardShortcuts}">
Expand Down Expand Up @@ -160,6 +197,16 @@
<Thumb Style="{DynamicResource InvisibleThumbStyle}"
dragablz:DragablzItem.IsCustomThumb="True" />
</Grid>
<Rectangle Width="16" Height="16" Margin="0,0,10,0"
VerticalAlignment="Center"
Fill="{DynamicResource MahApps.Brushes.Gray3}"
ToolTip="{x:Static localization:Strings.ViewOnly}"
Visibility="{Binding View.IsViewOnly, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform"
Visual="{iconPacks:Material Kind=Eye}" />
</Rectangle.OpacityMask>
</Rectangle>
<Button Style="{StaticResource CleanButton}"
Command="dragablz:TabablzControl.CloseItemCommand"
ToolTip="{x:Static localization:Strings.Close}"
Expand Down
22 changes: 20 additions & 2 deletions Source/NETworkManager/Controls/DragablzTabHostWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ private bool RemoteDesktop_IsDisconnected_CanExecute(object view)
return false;
}

// Used to block actions that would bypass view-only mode (e.g. fullscreen, Ctrl+Alt+Del).
private bool RemoteDesktop_IsConnectedAndNotViewOnly_CanExecute(object view)
{
if (view is RemoteDesktopControl control)
return control.IsConnected && !control.IsViewOnly;

return false;
}

public ICommand RemoteDesktop_DisconnectCommand =>
new RelayCommand(RemoteDesktop_DisconnectAction, RemoteDesktop_IsConnected_CanExecute);

Expand All @@ -186,14 +195,23 @@ private void RemoteDesktop_ReconnectAction(object view)
}

public ICommand RemoteDesktop_FullscreenCommand =>
new RelayCommand(RemoteDesktop_FullscreenAction, RemoteDesktop_IsConnected_CanExecute);
new RelayCommand(RemoteDesktop_FullscreenAction, RemoteDesktop_IsConnectedAndNotViewOnly_CanExecute);

private void RemoteDesktop_FullscreenAction(object view)
{
if (view is RemoteDesktopControl control)
control.FullScreen();
}

public ICommand RemoteDesktop_ViewOnlyCommand =>
new RelayCommand(RemoteDesktop_ViewOnlyAction, RemoteDesktop_IsConnected_CanExecute);

private void RemoteDesktop_ViewOnlyAction(object view)
{
if (view is RemoteDesktopControl control)
control.ToggleViewOnly();
}

public ICommand RemoteDesktop_AdjustScreenCommand =>
new RelayCommand(RemoteDesktop_AdjustScreenAction, RemoteDesktop_IsConnected_CanExecute);

Expand All @@ -204,7 +222,7 @@ private void RemoteDesktop_AdjustScreenAction(object view)
}

public ICommand RemoteDesktop_SendCtrlAltDelCommand =>
new RelayCommand(RemoteDesktop_SendCtrlAltDelAction, RemoteDesktop_IsConnected_CanExecute);
new RelayCommand(RemoteDesktop_SendCtrlAltDelAction, RemoteDesktop_IsConnectedAndNotViewOnly_CanExecute);

private async void RemoteDesktop_SendCtrlAltDelAction(object view)
{
Expand Down
Loading
Loading