Fix menus. Fix Parameter sorting. Fix erroneous bindings. Fix issue with display of model name not showing an underscore in the name.

Label control was interpreting it as an accelerator.  Other code cleanup.
This commit is contained in:
2025-02-22 22:24:55 -05:00
parent d60b32e51d
commit acaea61f2c
16 changed files with 170 additions and 104 deletions

View File

@@ -60,7 +60,7 @@ namespace TradeBlotter.ViewModels
// session section
private ModelStatistics modelStatistics=null;
private NVPDictionary nvpDictionary=null;
private ObservableCollection<String> nvpDictionaryKeys=null;
private ObservableCollection<String> nvpDictionaryKeys = default;
private MGSHConfiguration configuration=null;
private MGSHSessionParams sessionParams;
private String selectedParameter=null;
@@ -132,6 +132,7 @@ namespace TradeBlotter.ViewModels
StopMonitor();
base.OnDispose();
}
// ******************************************************************************************** P E R S I S T E N C E ********************************************************************************************
public override bool CanPersist()
{
@@ -233,7 +234,7 @@ namespace TradeBlotter.ViewModels
return collection;
}
}
private void OnMomentumViewModelPropertyChanged(object sender, PropertyChangedEventArgs eventArgs)
{
}
@@ -1371,7 +1372,7 @@ namespace TradeBlotter.ViewModels
sessionParams=MGSHSessionManager.RestoreSession(pathFileName);
if(null==sessionParams)
{
MessageBox.Show(String.Format("Unable to open {0}",pathFileName));
MessageBox.Show(String.Format("Unable to open {0}",pathFileName),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation ,MessageBoxResult.OK,MessageBoxOptions.DefaultDesktopOnly);
pathFileName=null;
return false;
}
@@ -1380,12 +1381,14 @@ namespace TradeBlotter.ViewModels
configuration=sessionParams.Configuration;
NVPCollection nvpCollection=sessionParams.Configuration.ToNVPCollection();
nvpDictionary=nvpCollection.ToDictionary();
nvpDictionaryKeys=new ObservableCollection<String>(nvpDictionary.Keys);
List<String> dictionaryKeys=new List<String>(nvpDictionary.Keys);
dictionaryKeys.Sort();
nvpDictionaryKeys=new ObservableCollection<String>(dictionaryKeys);
selectedParameter=nvpDictionaryKeys[0];
positions=new MGSHPositionModelCollection();
positions.Add(sessionParams.ActivePositions); // active positions will go into their assigned slot
positions.Add(sessionParams.HedgePositions, sessionParams.ActivePositions.GetMaxSlotNumber()+1); // -1 is a special slot so active hedge positions will always appear in the slot position 1 past the max
positions.Add(sessionParams.AllPositions);
//// positions.Add(sessionParams.HedgePositions, -1); // hedge positions will go into slot -1
UpdatePositionPrices(false);
UpdatePositionRSI3(true);
RunPerformance();
@@ -1393,7 +1396,7 @@ namespace TradeBlotter.ViewModels
}
catch(Exception exception)
{
MessageBox.Show(String.Format("Unable to open {0}",pathFileName));
MessageBox.Show(String.Format("Unable to open {0}",pathFileName),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation ,MessageBoxResult.OK,MessageBoxOptions.DefaultDesktopOnly);
pathFileName=null;
return false;
}