Skip to content

Commit b174950

Browse files
committed
Ping & RemoteDesktop tabs can no longer be in the same window
1 parent 144a2e1 commit b174950

11 files changed

Lines changed: 98 additions & 22 deletions

Source/NETworkManager/Controls/DragablzMainInterTabClient.cs renamed to Source/NETworkManager/Controls/DragablzPingInterTabClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
namespace NETworkManager.Controls
55
{
6-
public class DragablzMainInterTabClient : IInterTabClient
6+
public class DragablzPingInterTabClient : IInterTabClient
77
{
88
public INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
99
{
10-
DragablzTabHostWindow dragablzTabHostWindow = new DragablzTabHostWindow();
11-
return new NewTabHost<DragablzTabHostWindow>(dragablzTabHostWindow, dragablzTabHostWindow.TabsContainer);
10+
DragablzPingTabHostWindow dragablzPingTabHostWindow = new DragablzPingTabHostWindow();
11+
return new NewTabHost<DragablzPingTabHostWindow>(dragablzPingTabHostWindow, dragablzPingTabHostWindow.TabsContainer);
1212
}
1313

1414
public TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)

Source/NETworkManager/Controls/DragablzTabHostWindow.xaml renamed to Source/NETworkManager/Controls/DragablzPingTabHostWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Controls:MetroWindow x:Name="MetroWindowDragablzTabHost" x:Class="NETworkManager.Controls.DragablzTabHostWindow"
1+
<Controls:MetroWindow x:Class="NETworkManager.Controls.DragablzPingTabHostWindow"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -13,7 +13,7 @@
1313
<Grid>
1414
<dragablz:TabablzControl Name="TabsContainer">
1515
<dragablz:TabablzControl.InterTabController>
16-
<dragablz:InterTabController></dragablz:InterTabController>
16+
<dragablz:InterTabController Partition="DF0DC56F-0C28-4917-B1B1-5DA7A9C8FFA5" />
1717
</dragablz:TabablzControl.InterTabController>
1818
<dragablz:TabablzControl.Style>
1919
<Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource DefaultTabablzControl}">

Source/NETworkManager/Controls/DragablzTabHostWindow.xaml.cs renamed to Source/NETworkManager/Controls/DragablzPingTabHostWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ namespace NETworkManager.Controls
55
/// <summary>
66
/// Interaktionslogik für Settings.xaml
77
/// </summary>
8-
public partial class DragablzTabHostWindow : MetroWindow
8+
public partial class DragablzPingTabHostWindow : MetroWindow
99
{
10-
public DragablzTabHostWindow()
10+
public DragablzPingTabHostWindow()
1111
{
1212
InitializeComponent();
1313
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Dragablz;
2+
using System.Windows;
3+
4+
namespace NETworkManager.Controls
5+
{
6+
public class DragablzRemoteDesktopInterTabClient : IInterTabClient
7+
{
8+
public INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
9+
{
10+
DragablzRemoteDesktopTabHostWindow dragablzRemoteDesktopTabHostWindow = new DragablzRemoteDesktopTabHostWindow();
11+
return new NewTabHost<DragablzRemoteDesktopTabHostWindow>(dragablzRemoteDesktopTabHostWindow, dragablzRemoteDesktopTabHostWindow.TabsContainer);
12+
}
13+
14+
public TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
15+
{
16+
return TabEmptiedResponse.DoNothing;
17+
}
18+
}
19+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Controls:MetroWindow x:Class="NETworkManager.Controls.DragablzRemoteDesktopTabHostWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
7+
xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
8+
mc:Ignorable="d"
9+
Title="{DynamicResource String_ProductName}" Style="{DynamicResource DefaultWindow}" MinWidth="650" MinHeight="500" Height="650" Width="1000" TitleAlignment="Left">
10+
<Controls:MetroWindow.WindowButtonCommands>
11+
<Controls:WindowButtonCommands Template="{DynamicResource MahApps.Metro.Templates.WindowButtonCommands.Win10}" />
12+
</Controls:MetroWindow.WindowButtonCommands>
13+
<Grid>
14+
<dragablz:TabablzControl Name="TabsContainer">
15+
<dragablz:TabablzControl.InterTabController>
16+
<dragablz:InterTabController Partition="3D21565B-3E97-42F1-B0B9-CCA7DA63EFB2" />
17+
</dragablz:TabablzControl.InterTabController>
18+
<dragablz:TabablzControl.Style>
19+
<Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource DefaultTabablzControl}">
20+
<!-- If not null, the header suffix will be removed in the main window -->
21+
<Setter Property="HeaderSuffixContent" Value="{x:Null}" />
22+
<Setter Property="ContentTemplate">
23+
<Setter.Value>
24+
<DataTemplate>
25+
<ContentPresenter Content="{Binding View}" />
26+
</DataTemplate>
27+
</Setter.Value>
28+
</Setter>
29+
</Style>
30+
</dragablz:TabablzControl.Style>
31+
</dragablz:TabablzControl>
32+
</Grid>
33+
</Controls:MetroWindow>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using MahApps.Metro.Controls;
2+
3+
namespace NETworkManager.Controls
4+
{
5+
/// <summary>
6+
/// Interaktionslogik für Settings.xaml
7+
/// </summary>
8+
public partial class DragablzRemoteDesktopTabHostWindow : MetroWindow
9+
{
10+
public DragablzRemoteDesktopTabHostWindow()
11+
{
12+
InitializeComponent();
13+
}
14+
}
15+
}

Source/NETworkManager/NETworkManager.csproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@
184184
<Compile Include="3rdParty\Heijden.DNS\Response.cs" />
185185
<Compile Include="3rdParty\Heijden.DNS\RR.cs" />
186186
<Compile Include="3rdParty\Heijden.DNS\Structs.cs" />
187-
<Compile Include="Controls\DragablzMainInterTabClient.cs" />
187+
<Compile Include="Controls\DragablzRemoteDesktopTabHostWindow.xaml.cs">
188+
<DependentUpon>DragablzRemoteDesktopTabHostWindow.xaml</DependentUpon>
189+
</Compile>
190+
<Compile Include="Controls\DragablzRemoteDesktopInterTabClient.cs" />
191+
<Compile Include="Controls\DragablzPingInterTabClient.cs" />
188192
<Compile Include="Controls\DragablzPingTabItem.cs" />
189193
<Compile Include="Controls\DragablzRemoteDesktopTabItem.cs" />
190194
<Compile Include="Converters\NullOrEmptyToBoolConverter.cs" />
@@ -297,8 +301,8 @@
297301
<Compile Include="Views\Applications\RemoteDesktopView.xaml.cs">
298302
<DependentUpon>RemoteDesktopView.xaml</DependentUpon>
299303
</Compile>
300-
<Compile Include="Controls\DragablzTabHostWindow.xaml.cs">
301-
<DependentUpon>DragablzTabHostWindow.xaml</DependentUpon>
304+
<Compile Include="Controls\DragablzPingTabHostWindow.xaml.cs">
305+
<DependentUpon>DragablzPingTabHostWindow.xaml</DependentUpon>
302306
</Compile>
303307
<Compile Include="Views\Dialogs\CredentialDialog.xaml.cs">
304308
<DependentUpon>CredentialDialog.xaml</DependentUpon>
@@ -359,6 +363,10 @@
359363
</Compile>
360364
<Compile Include="WpfHelper\PasswordBoxBindingBehavior.cs" />
361365
<Compile Include="WpfHelper\ProtocolSettingsLayout.cs" />
366+
<Page Include="Controls\DragablzRemoteDesktopTabHostWindow.xaml">
367+
<Generator>MSBuild:Compile</Generator>
368+
<SubType>Designer</SubType>
369+
</Page>
362370
<Page Include="Resources\ContextMenu\ContextMenu.xaml">
363371
<Generator>MSBuild:Compile</Generator>
364372
<SubType>Designer</SubType>
@@ -514,7 +522,7 @@
514522
<SubType>Designer</SubType>
515523
<Generator>MSBuild:Compile</Generator>
516524
</Page>
517-
<Page Include="Controls\DragablzTabHostWindow.xaml">
525+
<Page Include="Controls\DragablzPingTabHostWindow.xaml">
518526
<Generator>MSBuild:Compile</Generator>
519527
<SubType>Designer</SubType>
520528
</Page>

Source/NETworkManager/ViewModels/Applications/PingHostViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public PingHostViewModel()
3939
{
4040
ChangeTabTitleAction = ChangeTabTitle;
4141

42-
InterTabClient = new DragablzMainInterTabClient();
42+
InterTabClient = new DragablzPingInterTabClient();
4343

4444
TabItems = new ObservableCollection<DragablzPingTabItem>()
4545
{

Source/NETworkManager/ViewModels/Applications/RemoteDesktopViewModel.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public RemoteDesktopViewModel(IDialogCoordinator instance)
124124

125125
if (IsRDP8dot1Available)
126126
{
127-
InterTabClient = new DragablzMainInterTabClient();
127+
InterTabClient = new DragablzRemoteDesktopInterTabClient();
128128
TabItems = new ObservableCollection<DragablzRemoteDesktopTabItem>();
129129

130130
// Load sessions
@@ -399,14 +399,15 @@ private async void ConnectSessionAsAction()
399399
{
400400
dialogCoordinator.HideMetroDialogAsync(this, customDialog);
401401
ConfigurationManager.Current.FixAirspace = false;
402-
}, true);
403-
404-
// Set name, hostname
405-
connectRemoteDesktopSessionViewModel.Name = SelectedSession.Name;
406-
connectRemoteDesktopSessionViewModel.Host = SelectedSession.Host;
402+
}, true)
403+
{
404+
// Set name, hostname
405+
Name = SelectedSession.Name,
406+
Host = SelectedSession.Host,
407407

408-
// Request credentials
409-
connectRemoteDesktopSessionViewModel.UseCredentials = true;
408+
// Request credentials
409+
UseCredentials = true
410+
};
410411

411412
customDialog.Content = new RemoteDesktopSessionConnectDialog
412413
{

Source/NETworkManager/Views/Applications/PingHostView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<Grid>
1515
<dragablz:TabablzControl Grid.Column="0" Grid.Row="0" Margin="-0,-2,0,0" ItemsSource="{Binding TabItems}" SelectedIndex="{Binding SelectedTabIndex}">
1616
<dragablz:TabablzControl.InterTabController>
17-
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
17+
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" Partition="DF0DC56F-0C28-4917-B1B1-5DA7A9C8FFA5" />
1818
</dragablz:TabablzControl.InterTabController>
1919
<dragablz:TabablzControl.Style>
2020
<Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource DefaultTabablzControl}">

0 commit comments

Comments
 (0)