forked from BornToBeRoot/NETworkManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDNSLookupView.xaml.cs
More file actions
45 lines (35 loc) · 1.04 KB
/
Copy pathDNSLookupView.xaml.cs
File metadata and controls
45 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Windows;
using System.Windows.Controls;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Controls;
using NETworkManager.ViewModels;
namespace NETworkManager.Views;
public partial class DNSLookupView : IDragablzTabItem
{
private readonly DNSLookupViewModel _viewModel;
public DNSLookupView(Guid tabId, string host = null)
{
InitializeComponent();
_viewModel = new DNSLookupViewModel(DialogCoordinator.Instance, tabId, host);
DataContext = _viewModel;
Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
}
public void CloseTab()
{
_viewModel.OnClose();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
_viewModel.OnLoaded();
}
private void Dispatcher_ShutdownStarted(object sender, EventArgs e)
{
_viewModel.OnClose();
}
private void ContextMenu_Opened(object sender, RoutedEventArgs e)
{
if (sender is ContextMenu menu)
menu.DataContext = _viewModel;
}
}