using OxyPlot; using OxyPlot.Axes; using System; using System.Threading.Tasks; using System.Windows; using Tango.DispenserAnalyzer.UI.ViewModels; namespace Tango.DispenserAnalyzer.UI { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { private MainWindowVM _vm; public string WindowTitle { get { Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; return "Dispenser Analyzer - Version" + version; } } public MainWindow() { InitializeComponent(); _vm = new MainWindowVM(); DataContext = _vm; _vm.PlotControl = PressurePlot; _vm.ResultsPanel = resultItems; foreach (var ax in PressurePlot.Axes) ax.Maximum = ax.Minimum = Double.NaN; } public async void GenerateResultsInBackground( string[] filePathArr) { if(_vm != null) { for (int index = 0; index < filePathArr.Length; index++) { await _vm.GenerateInBackground(filePathArr[index]); if(index < filePathArr.Length) { await Task.Delay(500); } } } await Task.Delay(500); Application.Current.Shutdown(); } 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 RangeToCountPlot_Loaded(object sender, RoutedEventArgs e) { var element = (FrameworkElement)sender; } } }