Fix the LoadSessionFile method so that the BusyIndicator is displayed with the correct content.
This commit is contained in:
@@ -28,6 +28,7 @@ using Position = MarketData.Generator.CMMomentum.Position;
|
|||||||
using TradeBlotter.UIUtils;
|
using TradeBlotter.UIUtils;
|
||||||
using MarketData.Generator.Model;
|
using MarketData.Generator.Model;
|
||||||
using MarketData.CNNProcessing;
|
using MarketData.CNNProcessing;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
|
||||||
namespace TradeBlotter.ViewModels
|
namespace TradeBlotter.ViewModels
|
||||||
{
|
{
|
||||||
@@ -1120,7 +1121,15 @@ namespace TradeBlotter.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadSessionFile()
|
public bool LoadSessionFile()
|
||||||
|
{
|
||||||
|
BusyIndicator = true;
|
||||||
|
BusyContent = $"Loading {Utility.GetFileNameNoExtension(pathFileName)}...";
|
||||||
|
|
||||||
|
Task workerTask = Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (!CMSessionManager.IsValidSessionFile(pathFileName)) return false;
|
if (!CMSessionManager.IsValidSessionFile(pathFileName)) return false;
|
||||||
initialPath = Path.GetDirectoryName(pathFileName);
|
initialPath = Path.GetDirectoryName(pathFileName);
|
||||||
@@ -1139,6 +1148,17 @@ namespace TradeBlotter.ViewModels
|
|||||||
UpdatePositionPrices(false);
|
UpdatePositionPrices(false);
|
||||||
UpdatePositionRSI3(true);
|
UpdatePositionRSI3(true);
|
||||||
RunPerformance();
|
RunPerformance();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show(String.Format("Exception {0}",exception.ToString()),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
workerTask.ContinueWith(continuation =>
|
||||||
|
{
|
||||||
|
BusyIndicator=false;
|
||||||
base.OnPropertyChanged("Parameters");
|
base.OnPropertyChanged("Parameters");
|
||||||
base.OnPropertyChanged("SelectedParameter");
|
base.OnPropertyChanged("SelectedParameter");
|
||||||
base.OnPropertyChanged("ParameterValue");
|
base.OnPropertyChanged("ParameterValue");
|
||||||
@@ -1151,8 +1171,10 @@ namespace TradeBlotter.ViewModels
|
|||||||
base.OnPropertyChanged("ModelExpectation");
|
base.OnPropertyChanged("ModelExpectation");
|
||||||
base.OnPropertyChanged("ExpectationColor");
|
base.OnPropertyChanged("ExpectationColor");
|
||||||
base.OnPropertyChanged("ExpectationDescription");
|
base.OnPropertyChanged("ExpectationDescription");
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunPerformance()
|
private void RunPerformance()
|
||||||
{
|
{
|
||||||
if(null==sessionParams)return;
|
if(null==sessionParams)return;
|
||||||
|
|||||||
@@ -1236,7 +1236,15 @@ namespace TradeBlotter.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadSessionFile()
|
public bool LoadSessionFile()
|
||||||
|
{
|
||||||
|
BusyIndicator = true;
|
||||||
|
BusyContent = $"Loading {Utility.GetFileNameNoExtension(pathFileName)}...";
|
||||||
|
|
||||||
|
Task workerTask = Task.Factory.StartNew( () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if(!CMTSessionManager.IsValidSessionFile(pathFileName)) return false;
|
if(!CMTSessionManager.IsValidSessionFile(pathFileName)) return false;
|
||||||
initialPath=Path.GetDirectoryName(pathFileName);
|
initialPath=Path.GetDirectoryName(pathFileName);
|
||||||
@@ -1255,6 +1263,17 @@ namespace TradeBlotter.ViewModels
|
|||||||
foreach(CMTCandidate candidate in sessionParams.Candidates)trendCandidates.Add(candidate);
|
foreach(CMTCandidate candidate in sessionParams.Candidates)trendCandidates.Add(candidate);
|
||||||
UpdatePositionPrices(true);
|
UpdatePositionPrices(true);
|
||||||
RunPerformance();
|
RunPerformance();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show(String.Format("Exception {0}",exception.ToString()),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
workerTask.ContinueWith(continuation =>
|
||||||
|
{
|
||||||
|
BusyIndicator = false;
|
||||||
base.OnPropertyChanged("Parameters");
|
base.OnPropertyChanged("Parameters");
|
||||||
base.OnPropertyChanged("SelectedParameter");
|
base.OnPropertyChanged("SelectedParameter");
|
||||||
base.OnPropertyChanged("ParameterValue");
|
base.OnPropertyChanged("ParameterValue");
|
||||||
@@ -1270,8 +1289,10 @@ namespace TradeBlotter.ViewModels
|
|||||||
base.OnPropertyChanged("ExpectationDescription");
|
base.OnPropertyChanged("ExpectationDescription");
|
||||||
base.OnPropertyChanged("TradeableCashDescription");
|
base.OnPropertyChanged("TradeableCashDescription");
|
||||||
base.OnPropertyChanged("NonTradeableCashDescription");
|
base.OnPropertyChanged("NonTradeableCashDescription");
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunPerformance()
|
private void RunPerformance()
|
||||||
{
|
{
|
||||||
if(null==sessionParams)return;
|
if(null==sessionParams)return;
|
||||||
|
|||||||
@@ -1103,7 +1103,13 @@ namespace TradeBlotter.ViewModels
|
|||||||
}
|
}
|
||||||
else LoadSessionFile();
|
else LoadSessionFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadSessionFile()
|
public bool LoadSessionFile()
|
||||||
|
{
|
||||||
|
BusyIndicator = true;
|
||||||
|
BusyContent = $"Loading {Utility.GetFileNameNoExtension(pathFileName)}...";
|
||||||
|
|
||||||
|
Task workerTask = Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1134,6 +1140,17 @@ namespace TradeBlotter.ViewModels
|
|||||||
UpdatePositionPrices(false);
|
UpdatePositionPrices(false);
|
||||||
UpdatePositionRSI3(true);
|
UpdatePositionRSI3(true);
|
||||||
RunPerformance();
|
RunPerformance();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show(String.Format("Exception {0}",exception.ToString()),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
workerTask.ContinueWith(continuation =>
|
||||||
|
{
|
||||||
|
BusyIndicator=false;
|
||||||
base.OnPropertyChanged("Parameters");
|
base.OnPropertyChanged("Parameters");
|
||||||
base.OnPropertyChanged("SelectedParameter");
|
base.OnPropertyChanged("SelectedParameter");
|
||||||
base.OnPropertyChanged("ParameterValue");
|
base.OnPropertyChanged("ParameterValue");
|
||||||
@@ -1146,14 +1163,10 @@ namespace TradeBlotter.ViewModels
|
|||||||
base.OnPropertyChanged("ModelExpectation");
|
base.OnPropertyChanged("ModelExpectation");
|
||||||
base.OnPropertyChanged("ExpectationColor");
|
base.OnPropertyChanged("ExpectationColor");
|
||||||
base.OnPropertyChanged("ExpectationDescription");
|
base.OnPropertyChanged("ExpectationDescription");
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception exception)
|
|
||||||
{
|
|
||||||
System.Windows.MessageBox.Show(String.Format("Exception {0}",exception.ToString()),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void RunPerformance()
|
private void RunPerformance()
|
||||||
{
|
{
|
||||||
if(null==sessionParams)return;
|
if(null==sessionParams)return;
|
||||||
|
|||||||
Reference in New Issue
Block a user