-
Notifications
You must be signed in to change notification settings - Fork 3
/
MainWindow.xaml.cs
76 lines (66 loc) · 2.28 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Windows;
using System.ComponentModel;
namespace DesktopApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow
{
private readonly ViewModel _vmPanel;
public MainWindow()
{
InitializeComponent();
var vm = new ViewModel(new Panel(), new AnomalyData(new SimpleAnomalyDetector(0)));
_vmPanel = vm;
DataContext = _vmPanel;
Playback.Notify += OnPress;
Graphs.Notify += OnPress;
}
private void OnPress(object sender, EventArgs e)
{
if (e.GetType() == typeof(MediaEventArgs))
{
var m = (MediaEventArgs) e;
_vmPanel.PlaybackControl(m);
}
else if (e.GetType() == typeof(GraphEventArgs))
{
var m = (GraphEventArgs) e;
_vmPanel.GraphControls(m);
}
}
private void XmlButtonClick(object sender, RoutedEventArgs e)
{
_vmPanel.ClickXml();
CsvFileTrain.Visibility = Visibility.Visible;
}
private void CSVTrainFile_Click(object sender, RoutedEventArgs e)
{
if (!_vmPanel.ClickCsvTrain()) return;
CsvFileTrain.Content = "Upload CSV Train File";
CsvFileTest.Visibility = Visibility.Visible;
XmlFile.Visibility = Visibility.Hidden;
}
private void CSVFileTest_Click(object sender, RoutedEventArgs e)
{
if (!_vmPanel.ClickCsvTest()) return;
Graphs.DataContext = _vmPanel;
_vmPanel.LearnProcess();
Graphs.ColumnsName.SelectedItem = "aileron";
CsvFileTrain.Visibility = Visibility.Hidden;
GraphsTab.Visibility = Visibility.Visible;
}
private void exit_Click(object sender, CancelEventArgs e)
{
var result = MessageBox.Show("Really close?", "Warning", MessageBoxButton.YesNo);
if (result != MessageBoxResult.Yes)
{
e.Cancel = true;
return;
}
_vmPanel.CloseAll();
}
}
}