From 5f1432057d8069171e827ef57e813350ec088fb1 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Mon, 13 Nov 2017 15:57:47 -0500 Subject: [PATCH 1/3] Logger.nonull should not accept a struct to check for null. --- src/client/spark_core/logging/Logger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/spark_core/logging/Logger.cs b/src/client/spark_core/logging/Logger.cs index dfbf65f20..0edcc4703 100644 --- a/src/client/spark_core/logging/Logger.cs +++ b/src/client/spark_core/logging/Logger.cs @@ -87,7 +87,7 @@ namespace mbts } } - public static void notnull(object o) { + public static void notnull(T o) where T : class { assert(o != null); } From 6790b6cf3430270da51125eb26b70ca683ca0169 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Mon, 13 Nov 2017 16:02:35 -0500 Subject: [PATCH 2/3] Add extension methods that help when interacting with protobuf apis --- .../core/GlobalExtensions/GlobalExtensions.cs | 22 +++++++++++-------- src/client/spark/mspark/Core/SparkTags.cs | 3 +-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/client/spark/core/GlobalExtensions/GlobalExtensions.cs b/src/client/spark/core/GlobalExtensions/GlobalExtensions.cs index 9c89c3d8b..fdd0f0c5b 100644 --- a/src/client/spark/core/GlobalExtensions/GlobalExtensions.cs +++ b/src/client/spark/core/GlobalExtensions/GlobalExtensions.cs @@ -400,17 +400,21 @@ namespace mbts return -1; } - #region Curry - public static Func> curry(Func fn) { - return a => b => fn(a, b); + public static void ignore(this Task t) { } + + public static Google.Protobuf.WellKnownTypes.Timestamp ToGoogleTime(this DateTime self) { + return Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(self); } - public static Func>> curry(Func fn) { - return a => b => c => fn(a, b, c); + + public static bool TryGetValue(this ILookup self, TKey key, out IEnumerable value) { + bool has_value = self.Contains(key); + if (has_value) { + value = self[key]; + } + else { value = Enumerable.Empty(); } + return has_value; } - public static Func>>> curry(this Func fn) { - return a => b => c => d => fn(a, b, c, d); - } - #endregion + } } diff --git a/src/client/spark/mspark/Core/SparkTags.cs b/src/client/spark/mspark/Core/SparkTags.cs index fa75b6259..e99fcd5dc 100644 --- a/src/client/spark/mspark/Core/SparkTags.cs +++ b/src/client/spark/mspark/Core/SparkTags.cs @@ -7,10 +7,9 @@ namespace mbts.spark { private class SparkTag : ITag { private readonly string Name; public SparkTag(string name) { Name = name; } } #region Core Data - public static ITag ExchangeSecuritiesTag { get; } = new SparkTag("ExchangeSecuritiesTag"); public static ITag> SecuritiesTag { get; } = new SparkTag>("Securities"); public static ITag SyntheticSecuritiesTag { get; } = new SparkTag("SyntheticSecuritiesTag"); - public static ITag OrderBookTag = new SparkTag("OrderBookTag"); + public static ITag OrderBookTag { get; } = new SparkTag("OrderBookTag"); public static ITag PositionsTag { get; } = new SparkTag(nameof(PositionsTag)); #endregion From 6b770ea1374586657379920e142fe3c51c435885 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Mon, 13 Nov 2017 16:11:48 -0500 Subject: [PATCH 3/3] Add support button option to BTSMessageBox --- src/client/spark/mspark/Shell/MarketModule.cs | 2 +- .../spark/uicore/Images/Vector/Icons.xaml | 12 +++ .../view/Controls/Dialogs/BTSMessageBox.xaml | 48 ++++++----- .../Controls/Dialogs/BTSMessageBox.xaml.cs | 84 +++++++++---------- .../spark/view/Shell/Login/LoginViewModel.cs | 2 +- 5 files changed, 83 insertions(+), 65 deletions(-) diff --git a/src/client/spark/mspark/Shell/MarketModule.cs b/src/client/spark/mspark/Shell/MarketModule.cs index d37de5341..e5571436f 100644 --- a/src/client/spark/mspark/Shell/MarketModule.cs +++ b/src/client/spark/mspark/Shell/MarketModule.cs @@ -178,7 +178,7 @@ namespace mbts.spark } else show_synthetic_editor(msg.data.CloneToMutable(), ses.ExecutionStrategy); } private void show_synthetic_editor_warning(string warn_msg) { - BTSMessageBox.Show(warn_msg, "Synthetic Strategy", MessageBoxButton.OK, MessageBoxImage.Exclamation, true, false, true); + BTSMessageBox.Show(warn_msg, "Synthetic Strategy", BTSMessageBoxButtons.OK, MessageBoxImage.Exclamation, true, false, true); } private void show_synthetic_editor(Security synthetic, ExecutionStrategy strategy) { var dialog = new SyntheticEditorDialog { DataContext = new SyntheticEditorVM(_bus, synthetic, strategy) }.Show(-200, -300, true); diff --git a/src/client/spark/uicore/Images/Vector/Icons.xaml b/src/client/spark/uicore/Images/Vector/Icons.xaml index 347cfe9be..58dec4d7e 100644 --- a/src/client/spark/uicore/Images/Vector/Icons.xaml +++ b/src/client/spark/uicore/Images/Vector/Icons.xaml @@ -454,6 +454,18 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z"> + + + + + + + + + + +