|
1 |
| -using System; |
| 1 | +using Dragablz; |
| 2 | +using MahApps.Metro.Controls.Dialogs; |
| 3 | +using NETworkManager.Localization; |
| 4 | +using NETworkManager.Localization.Resources; |
| 5 | +using NETworkManager.Models; |
| 6 | +using NETworkManager.Models.RemoteDesktop; |
| 7 | +using NETworkManager.Settings; |
| 8 | +using NETworkManager.Utilities; |
| 9 | +using System; |
2 | 10 | using System.Collections.Generic;
|
3 | 11 | using System.ComponentModel;
|
4 | 12 | using System.Diagnostics;
|
|
9 | 17 | using System.Windows.Forms;
|
10 | 18 | using System.Windows.Input;
|
11 | 19 | using System.Windows.Interop;
|
12 |
| -using Dragablz; |
13 |
| -using MahApps.Metro.Controls.Dialogs; |
14 |
| -using NETworkManager.Localization; |
15 |
| -using NETworkManager.Localization.Resources; |
16 |
| -using NETworkManager.Models; |
17 |
| -using NETworkManager.Models.RemoteDesktop; |
18 |
| -using NETworkManager.Settings; |
19 |
| -using NETworkManager.Utilities; |
20 |
| -using Application = System.Windows.Application; |
21 | 20 |
|
22 | 21 | namespace NETworkManager.Controls;
|
23 | 22 |
|
@@ -71,7 +70,7 @@ private async void FocusEmbeddedWindow()
|
71 | 70 |
|
72 | 71 | // Focus embedded window in the selected tab
|
73 | 72 | (((DragablzTabItem)tabablzControl.SelectedItem)?.View as IEmbeddedWindow)?.FocusEmbeddedWindow();
|
74 |
| - |
| 73 | + |
75 | 74 | break;
|
76 | 75 | }
|
77 | 76 | }
|
@@ -169,7 +168,7 @@ private bool RemoteDesktop_IsConnected_CanExecute(object view)
|
169 | 168 | private bool RemoteDesktop_IsDisconnected_CanExecute(object view)
|
170 | 169 | {
|
171 | 170 | if (view is RemoteDesktopControl control)
|
172 |
| - return !control.IsConnected; |
| 171 | + return !control.IsConnected && !control.IsConnecting; |
173 | 172 |
|
174 | 173 | return false;
|
175 | 174 | }
|
@@ -376,8 +375,8 @@ private void DragablzTabHostWindow_OnClosing(object sender, CancelEventArgs e)
|
376 | 375 | {
|
377 | 376 | // Find all TabablzControl in the active window
|
378 | 377 | foreach (var tabablzControl in VisualTreeHelper.FindVisualChildren<TabablzControl>(this))
|
379 |
| - foreach (var tabItem in tabablzControl.Items.OfType<DragablzTabItem>()) |
380 |
| - ((IDragablzTabItem)tabItem.View).CloseTab(); |
| 378 | + foreach (var tabItem in tabablzControl.Items.OfType<DragablzTabItem>()) |
| 379 | + ((IDragablzTabItem)tabItem.View).CloseTab(); |
381 | 380 |
|
382 | 381 | // Reset the dragging state
|
383 | 382 | switch (ApplicationName)
|
@@ -481,14 +480,14 @@ private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref
|
481 | 480 | }
|
482 | 481 |
|
483 | 482 | private void UpdateOnWindowResize()
|
484 |
| - { |
| 483 | + { |
485 | 484 | // Find all TabablzControl
|
486 | 485 | foreach (var tabablzControl in VisualTreeHelper.FindVisualChildren<TabablzControl>(this))
|
487 | 486 | {
|
488 | 487 | // Skip if no items
|
489 | 488 | if (tabablzControl.Items.Count == 0)
|
490 | 489 | continue;
|
491 |
| - |
| 490 | + |
492 | 491 | foreach (var item in tabablzControl.Items.OfType<DragablzTabItem>())
|
493 | 492 | {
|
494 | 493 | if (item.View is RemoteDesktopControl control)
|
|
0 commit comments