-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
115 lines (96 loc) · 3.62 KB
/
MainWindow.xaml.cs
File metadata and controls
115 lines (96 loc) · 3.62 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using DayZTediratorToolz.Helpers;
using DayZTediratorToolz.Services;
using DayZTediratorToolz.Views;
using MaterialDesignThemes.Wpf;
using PropertyChanged;
namespace DayZTediratorToolz
{
[AddINotifyPropertyChangedInterface]
public partial class MainWindow
{
private readonly IServerInspectionService _serverInspectionService;
private readonly IControllerService _controller;
private readonly INotificationService _notificationService;
System.Media.SoundPlayer soundPlayer { get; set; } = new System.Media.SoundPlayer();
public IBaseView ActiveView { get => _controller.CurrentView;}
public MainWindow(IAppSettingsManager appSettingsManager,
IServerInspectionService serverInspectionService,
IControllerService controller,
INotificationService notificationService)
{
_serverInspectionService = serverInspectionService;
_controller = controller;
_notificationService = notificationService;
InitializeComponent();
DataContext = this;
}
private void MinimizeButton_OnClick(object sender, RoutedEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
private void MaximizeButton_OnClick(object sender, RoutedEventArgs e)
{
this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal: WindowState.Maximized;
}
private void CloseButton_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
protected override void OnClosed(EventArgs e)
{
_serverInspectionService.ShutDownInspectionService();
_controller.CloseViews();
base.OnClosed(e);
}
private void IconImage_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
soundPlayer.SoundLocation = "EEGG/TBEEG.wav";
soundPlayer.LoadCompleted += delegate(object sender, AsyncCompletedEventArgs e) {
soundPlayer.Play();
};
soundPlayer.LoadAsync();
}
}
private void TitleCard_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 1 && e.LeftButton == MouseButtonState.Pressed)
{
DragMove();
}
}
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
{
// _notificationService.Initialize();
}
private void NavClickedAdminButton(object sender, RoutedEventArgs e)
{
ChangeView(DayZTediratorConstants.Views.Admin);
}
private void NavClickedTypesEditorButton(object sender, RoutedEventArgs e)
{
ChangeView(DayZTediratorConstants.Views.TypesEditor);
}
private void ChangeView(DayZTediratorConstants.Views viewID)
{
if (!_controller.CheckView(viewID))
{
_controller.SetView(viewID);
HostCard.GetBindingExpression(Card.ContentProperty).UpdateTarget();
}
}
private void SettingsButton_OnClick(object sender, RoutedEventArgs e)
{
}
private void NavClickedHomeButton(object sender, RoutedEventArgs e)
{
ChangeView(DayZTediratorConstants.Views.Home);
}
}
}