blob: 18551cbb3edd7ff890bdf95c74e29fbd3ef1ce7b (
plain)
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
|
using OxyPlot;
using OxyPlot.Axes;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.DispenserAnalyzer.UI.ViewModels;
namespace Tango.DispenserAnalyzer.UI
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
MainWindowVM _vm;
OxyPlot.Wpf.Axis xAxisValues;
OxyPlot.Wpf.Axis yAxisValues;
public MainWindow()
{
InitializeComponent();
_vm = new MainWindowVM();
DataContext = _vm;
CompositionTarget.Rendering += CompositionTargetRendering;
foreach (var ax in PressurePlot.Axes)
ax.Maximum = ax.Minimum = Double.NaN;
}
private void TextBlock_PreviewDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files != null && files.Length != 0 && System.IO.Path.GetExtension(files[0]).ToUpperInvariant() == ".CSV")
{
tbPath.Text = files[0];
}
e.Handled = true;
}
private void TextBox_PreviewDragOver(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files == null || files.Length == 0 || System.IO.Path.GetExtension(files[0]).ToUpperInvariant() != ".CSV")
{
e.Effects = DragDropEffects.None;
e.Handled = true;
}
else
{
e.Effects = DragDropEffects.All;
e.Handled = true;
}
}
private void CompositionTargetRendering(object sender, EventArgs e)
{
//_vm.UpdateModel();
if(_vm.ResetAllAxes)
{
_vm.ResetAllAxes = false;
foreach (var ax in PressurePlot.Axes)
ax.Maximum = ax.Minimum = Double.NaN;
PressurePlot.ResetAllAxes();
}
PressurePlot.InvalidatePlot(true);
}
}
}
|