-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMainWindow.xaml.cs
59 lines (50 loc) · 1.56 KB
/
MainWindow.xaml.cs
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
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using CanetisRadar2.Audio;
using CanetisRadar2.View;
namespace CanetisRadar2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
internal const int mainScreenWidth = 1920;
internal const int appWidth = 300;
internal const int appHeight = 1080;
private readonly Speakers _speakers;
private readonly ColoredSpeakers _coloredSpeakers;
public MainWindow()
{
InitializeComponent();
_speakers = new Speakers();
_coloredSpeakers = new ColoredSpeakers(_speakers);
ShowScreen();
StartMonitoring();
}
private void ShowScreen()
{
var leftScreen = new LeftScreen(_coloredSpeakers);
leftScreen.Show();
var rightScreen = new RightScreen(_coloredSpeakers);
rightScreen.Show();
WindowState = WindowState.Minimized;
}
private async void StartMonitoring()
{
// ReSharper disable once FunctionNeverReturns
await Task.Run(() =>
{
for (;;)
{
Thread.Sleep(200);
Dispatcher.BeginInvoke(DispatcherPriority.Normal,
(ThreadStart) delegate { _speakers.Update(); }
);
}
});
}
}
}