diff --git a/Elinor/MainWindow.xaml.cs b/Elinor/MainWindow.xaml.cs index 6d22e4c..b08f7eb 100644 --- a/Elinor/MainWindow.xaml.cs +++ b/Elinor/MainWindow.xaml.cs @@ -322,6 +322,7 @@ private void UpdateStatus() private void TbStatusMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { + this._lastEvent = null; CacheTools.ClearMarketLogs(_logdir); UpdateStatus(); } @@ -584,10 +585,14 @@ private void CbProfilesSelectionChanged(object sender, SelectionChangedEventArgs { btnDelete.IsEnabled = cbProfiles.SelectedItem.ToString() != "Default"; Profile.SaveSettings(profile); - profile = (Profile) cbProfiles.SelectedItem; + profile = (Profile)cbProfiles.SelectedItem; updateSettingsDisplay(); - if (_lastEvent != null) FileSystemWatcherOnCreated(this, _lastEvent); + if (_lastEvent != null) { + FileSystemWatcherOnCreated(this, _lastEvent); + } else { + this.resetCurrentExportValues(); + } } private void BtnNewClick(object sender, RoutedEventArgs e) @@ -867,5 +872,18 @@ private void cbBuyRangeSelectionChanged(object sender, SelectionChangedEventArgs ); */ } + + private void resetCurrentExportValues() + { + var cdt = new CalculateDataThread(-1, -1, this); + var calc = new Thread(cdt.Run); + calc.Start(); + + lblItemName.Content = "No item selected"; + lblSell.Content = "0.00 ISK"; + lblBuy.Content = "0.00 ISK"; + lblBuyOrderCost.Content = "0.00 ISK"; + lblSellOrderCost.Content = "0.00 ISK"; + } } } \ No newline at end of file diff --git a/Elinor/MiscTools.cs b/Elinor/MiscTools.cs index 615b12d..ff8039a 100644 --- a/Elinor/MiscTools.cs +++ b/Elinor/MiscTools.cs @@ -17,6 +17,10 @@ internal static bool IsFileLocked(FileInfo file) { stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None); } + catch (FileNotFoundException) + { + return true; + } catch (IOException) { return true;