Skip to content

Commit

Permalink
Fix profile switch after export and market log clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Slivo-fr committed Jul 5, 2021
1 parent 623412e commit b4fa510
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Elinor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ private void UpdateStatus()

private void TbStatusMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
this._lastEvent = null;
CacheTools.ClearMarketLogs(_logdir);
UpdateStatus();
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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";
}
}
}
4 changes: 4 additions & 0 deletions Elinor/MiscTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b4fa510

Please sign in to comment.