From 8e6b863d8fae09d633daf70b3ffedd33089f24cd Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Wed, 29 Aug 2018 14:20:24 -0500 Subject: [PATCH 01/22] updating test text --- testing/manual/positions_and_fills/SOD.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testing/manual/positions_and_fills/SOD.txt b/testing/manual/positions_and_fills/SOD.txt index c0a13c9e7..95406c323 100644 --- a/testing/manual/positions_and_fills/SOD.txt +++ b/testing/manual/positions_and_fills/SOD.txt @@ -11,14 +11,15 @@ button the ladder displays - 1. Force buy and sell fills across the 6 ladders. Keep track of the long and short positions and verify that that the position -button in the ladder is reflectig the net position carefully. +button in the ladder is reflecting the net position carefully. Open up the PNL and make sure the Day Long and Day Short positions match what you expect. The Start Net Pos should be 0. (The Total Net Pos in the PNL should match the pos button in the ladder) -2. Now comes the SOD part. The SOD is what demarkates a day. Notice the time, convert it to UTC -and override the SOD time in your spark.conf +2. Now comes the SOD part. The SOD is what demarkates a day. Find the most recent time on your fills, select 1 minute past that and convert it to UTC and override the SOD time in your spark.conf + +Here's an example of what the key looks like: SODTime{ value { @@ -27,7 +28,7 @@ SODTime{ } } -3. Now restart the server. Verify that all rows in the fills have a Fill Kind 'Sod'. +3. Now restart the server. Verify that all rows in the fills have a Fill Kind 'Sod' and the time matches the SODTime (converted to your local time zone) 4. Verify that the ladder is displaying the correct position (it should be the same as before the server start) From d6a6b2ca79ca4d1a8f7f889056e6a60e6da05afb Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Wed, 29 Aug 2018 14:22:08 -0500 Subject: [PATCH 02/22] FillTuple - no longer trimming account per Taha; SOD test was done w/o the trim and things worked as execpted --- src/client/spark/Orders/FillTuple.cs | 10 ++++------ src/lib/CMakeDeps.cmake | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/client/spark/Orders/FillTuple.cs b/src/client/spark/Orders/FillTuple.cs index 1cc929bcb..e48e6bcbf 100644 --- a/src/client/spark/Orders/FillTuple.cs +++ b/src/client/spark/Orders/FillTuple.cs @@ -19,14 +19,12 @@ namespace mbts.spark { key = new FillTupleKey(fill.FillKey, order.HasValue ? order.Value.Key : 0u, security_md.HasValue ? security_md.Value.security.Id : 0u); } - // the TrimEnd is very important b/c the server currently does not trim, - // but the account is part of the group, so this is necessary public string account { get { - var trimmed_account_string = string.Empty; - if (fill.FillKind != FillKind.Sod && order.HasValue && order.Value.HasDef) trimmed_account_string = order.Value.Def.Account; - else trimmed_account_string = fill.Account; - return trimmed_account_string == null ? string.Empty : trimmed_account_string.Trim(); + var account_string = string.Empty; + if (fill.FillKind != FillKind.Sod && order.HasValue && order.Value.HasDef) account_string = order.Value.Def.Account; + else account_string = fill.Account; + return account_string == null ? string.Empty : account_string; } } diff --git a/src/lib/CMakeDeps.cmake b/src/lib/CMakeDeps.cmake index b4c4b1246..739e47c0c 100644 --- a/src/lib/CMakeDeps.cmake +++ b/src/lib/CMakeDeps.cmake @@ -1 +1 @@ -set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/services/AdminService.proto;api/services/ApiUnitTestService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MarketDataRelay.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/services/UserService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/Executor.conf;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cpp_config.conf;config/defaults/dynamic_orders.conf;config/defaults/edge.conf;config/defaults/expiration_display_offset.conf;config/defaults/jetfix.conf;config/defaults/logging.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/testkeys.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cpp_config.proto;config/protos/dynamic_orders.proto;config/protos/environment.proto;config/protos/expiration_display_offset.proto;config/protos/jetfix.proto;config/protos/logging.proto;config/protos/orders_fills_cleanup.proto;config/protos/quickbus_cfg.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPriceLantencyTester.cpp;md/Diag/ShmDumper.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MDRecoverableConsumer.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/md2_tests.cpp;md/test/synthetic_book_merge_tests.cpp;mercury/actors/Actor.cpp;mercury/broker/AsyncEventBroker.cpp;mercury/broker/CoreEventBroker.cpp;mercury/broker/IEventBroker.cpp;mercury/events/TimerEvent.cpp;mercury/mercury_utils/Executor.cpp;mercury/mercury_utils/IPollableActor.cpp;mercury/mercury_utils/mercury_common.cpp;mercury/synopsis/SynopsisBuilder.cpp;mercury/topics/ITopic.cpp;metrics/metrics.cpp;metrics/system_metrics.cpp;orderman/actors/AsyncFactory.cpp;orderman/actors/ExecutionGateway.cpp;orderman/actors/FillStore.cpp;orderman/actors/OrderStore.cpp;orderman/actors/SODPosition.cpp;orderman/actors/SecuritySrc.cpp;orderman/actors/ServiceBridge.cpp;orderman/actors/order_manager/OrderBuilder.cpp;orderman/actors/order_manager/OrderManager.cpp;orderman/actors/order_manager/OrderServicesData.cpp;orderman/events/CancelRejectEvent.cpp;orderman/events/NewExecutionReportEvent.cpp;orderman/limiter/LimitStore.cpp;orderman/limiter/Limiter.cpp;orderman/limiter/ProductLimitNode.cpp;orderman/limiter/ProductLimitTree.cpp;orderman/limiter/SecurityLimitNode.cpp;orderman/limiter/SecurityLimitTree.cpp;orderman/limiter/tests/limit_tests.cpp;orderman/order_factory/OrderFactory.cpp;orderman/order_router/OrderRouter.cpp;orderman/orderman_utils/fix_order_codec.cpp;orderman/orders/DynamicOrder.cpp;orderman/orders/IcebergOrder.cpp;orderman/orders/NativeOrder.cpp;orderman/orders/Order.cpp;orderman/orders/TimeBoxOrder.cpp;orderman/orders/TriggerOrder.cpp;orderman/orders/book_algos/BookAlgo.cpp;orderman/orders/book_algos/CoverOrder.cpp;orderman/orders/book_algos/JoinOrder.cpp;orderman/orders/book_algos/LeanOrder.cpp;orderman/orders/book_algos/TickOrder.cpp;orderman/orders/book_algos/TopOrder.cpp;orderman/orders/spreader_orders/SpreaderOrder.cpp;orderman/orders/spreader_orders/spreader/LegPropertyData.cpp;orderman/orders/spreader_orders/spreader/QuoteLegPriceQuantityState.cpp;orderman/orders/spreader_orders/spreader/SingleFillHedger.cpp;orderman/orders/spreader_orders/spreader/SingleLegQuoter.cpp;orderman/orders/spreader_orders/spreader/SpreaderBookkeepingData.cpp;orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.cpp;orderman/orders/spreader_orders/spreader/SpreaderLegData.cpp;orderman/orders/spreader_orders/spreader/SpreaderUtils.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderOrderBuilder.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderOrderServices.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderPreActivationOrderServices.cpp;orderman/orders/spreader_orders/spreader/hedger/UnhedgedDelta.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerEndStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerStartStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForCancelAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForFirstAckCancelledStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForFirstAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWorkingStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteDriverSet.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteDriverSetHistory.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteLegDriver.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterEndStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterStartStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForCancelAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForFirstAckCancelledWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForFirstAckWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForIOCWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForSizeStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderEndStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderStartStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWaitingForCancelAllStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWorkingStateWorker.cpp;orderman/orders/spreader_orders/tests/spreader_tests.cpp;orderman/server/OrderServiceServer.cpp;orderman/tests/fat_wrapper_tests.cpp;os/os.cpp;os/tests/os_tests.cpp;persistence/IStore.cpp;persistence/PersistenceServiceServer.cpp;persistence/SqliteStore.cpp;persistence/tests/PersistenceServiceTests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/Dispatcher.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SecureLogon.cpp;utils/SharedMemory.cpp;utils/Sqlite_utils.cpp;utils/Uuid.cpp;utils/datetime.cpp;utils/download.cpp;utils/file_utils.cpp;utils/init_spark_lib.cpp;utils/is_unittest_environment.cpp) \ No newline at end of file +set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/services/AdminService.proto;api/services/ApiUnitTestService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MarketDataRelay.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/services/UserService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/Executor.conf;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cpp_config.conf;config/defaults/dynamic_orders.conf;config/defaults/edge.conf;config/defaults/expiration_display_offset.conf;config/defaults/jetfix.conf;config/defaults/logging.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/testkeys.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cpp_config.proto;config/protos/dynamic_orders.proto;config/protos/environment.proto;config/protos/expiration_display_offset.proto;config/protos/jetfix.proto;config/protos/logging.proto;config/protos/orders_fills_cleanup.proto;config/protos/quickbus_cfg.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPriceLantencyTester.cpp;md/Diag/ShmDumper.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MDRecoverableConsumer.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/md2_tests.cpp;md/test/synthetic_book_merge_tests.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/Dispatcher.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SecureLogon.cpp;utils/SharedMemory.cpp;utils/Sqlite_utils.cpp;utils/Uuid.cpp;utils/datetime.cpp;utils/download.cpp;utils/file_utils.cpp;utils/init_spark_lib.cpp;utils/is_unittest_environment.cpp) \ No newline at end of file From 5424a07862a0f24573f22217e5e2740c66321511 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Wed, 29 Aug 2018 15:42:47 -0400 Subject: [PATCH 03/22] SPARK-1647 Position button on ladder not reflecting accurate position per account --- .../spark/core/Utility/KeyDrivenObservable.cs | 27 +++++++++++++++++++ .../spark/view/Spark/Ladder/LadderVM.cs | 9 ++++--- 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/client/spark/core/Utility/KeyDrivenObservable.cs diff --git a/src/client/spark/core/Utility/KeyDrivenObservable.cs b/src/client/spark/core/Utility/KeyDrivenObservable.cs new file mode 100644 index 000000000..77d4e6296 --- /dev/null +++ b/src/client/spark/core/Utility/KeyDrivenObservable.cs @@ -0,0 +1,27 @@ +using System; +using System.Reactive.Subjects; + +namespace mbts.utils { + class KeyDrivenObservable : ISubject, IDisposable { + readonly Func> _selector; + Subject _value_subject = new Subject(); + IDisposable _current_key_sub; + + public KeyDrivenObservable(Func> selector) => + _selector = selector; + + public void OnCompleted() => Disposable.dispose(ref _current_key_sub); + public void OnError(Exception error) { } + public void OnNext(TKey key) { + Disposable.dispose(ref _current_key_sub); + _current_key_sub = _selector(key)?.Subscribe(_value_subject); + } + + public IDisposable Subscribe(IObserver observer) => _value_subject.Subscribe(observer); + + public void Dispose() { + Disposable.dispose(ref _current_key_sub); + Disposable.dispose(ref _value_subject); + } + } +} \ No newline at end of file diff --git a/src/client/spark/view/Spark/Ladder/LadderVM.cs b/src/client/spark/view/Spark/Ladder/LadderVM.cs index c3bee34a9..bd1cf1e28 100644 --- a/src/client/spark/view/Spark/Ladder/LadderVM.cs +++ b/src/client/spark/view/Spark/Ladder/LadderVM.cs @@ -7,6 +7,7 @@ using mbts.persist; using mbts.ui; using mbts.ui.shell; using mbts.ui.utility; +using mbts.utils; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -42,9 +43,9 @@ namespace mbts.spark { _change = backing(nameof(change), double.NaN); _open = backing(nameof(open), double.NaN); _settlement = backing(nameof(settlement), double.NaN); - _position = backing(nameof(position), order_properties_vm.observe_account(true).Select(a => a.name) - .SelectMany(a => _model.order_gateway.security_total_position(security.Id, a)) - .OnDispatcher()); + // remember: account_positions needs to subscribe to selected_account; both the sub and account_positions need to be disposed + var account_positions = new KeyDrivenObservable(a => _model.order_gateway.security_total_position(security.Id, a)); + _position = backing(nameof(position), account_positions.OnDispatcher()); _volume = backing(nameof(volume), 0ul); _auto_clear = backing(nameof(auto_clear), false); _status = backing(nameof(status_message), ""); @@ -77,6 +78,8 @@ namespace mbts.spark { _dispose = Disposable.Create( settings_command, order_properties_vm, + order_properties_vm.observe_account(true).Select(a => a.name).Subscribe(account_positions), + account_positions, size_calculator = new CalculatorLogic(0, _settings_manager.subscribe_current().Select(s => s.calculator_buttons)), bus.subscribe(SparkTags.LogActivity).OnDispatcher().Subscribe(status_update), model.order_gateway.working_orders.OnDispatcher().Subscribe(working => { From 146e555ad091fa4d79f97a7bf6ddf280342b64ff Mon Sep 17 00:00:00 2001 From: John Colvin Date: Wed, 29 Aug 2018 16:00:09 -0400 Subject: [PATCH 04/22] SPARK-1650 Ladder - selected account resets to the first item in dropdown when account limits are changed --- src/client/spark/core/Utility/ViewModelBase.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/spark/core/Utility/ViewModelBase.cs b/src/client/spark/core/Utility/ViewModelBase.cs index 47a090dc8..50d8efe5b 100644 --- a/src/client/spark/core/Utility/ViewModelBase.cs +++ b/src/client/spark/core/Utility/ViewModelBase.cs @@ -649,9 +649,12 @@ namespace mbts.ui.shell } } else { _items.sync_with(value); - if (_is_user_selected_item) + if (_is_user_selected_item) { _is_user_selected_item = _items.Contains(_selected_item); - _try_auto_select(); + } + if (!_is_user_selected_item) { + _try_auto_select(); + } } } void IObserver>.OnError(Exception error) { } From bca8f754b605259259943f7be2eaea3d862c8b96 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Wed, 29 Aug 2018 16:58:33 -0400 Subject: [PATCH 05/22] OrdersModel - use .Naggle in positions observable --- src/client/spark/Orders/OrdersModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/spark/Orders/OrdersModel.cs b/src/client/spark/Orders/OrdersModel.cs index 0107af243..3b53594a5 100644 --- a/src/client/spark/Orders/OrdersModel.cs +++ b/src/client/spark/Orders/OrdersModel.cs @@ -41,7 +41,7 @@ namespace mbts.spark { var scheduler = ThreadPoolScheduler.Instance; var interval = TimeSpan.FromMilliseconds(100); on_orders = _service.subscribei_orders().Naggle(interval, scheduler).Table().Cache(); - on_positions = _position_service.subscribei_position_data().Table().Cache(); + on_positions = _position_service.subscribei_position_data().Naggle(interval, scheduler).Table().Cache(); working_orders = on_orders.Scan( ImmutableDictionary.Empty, From 2ba33caae82d44c0fb2f439af63638e15028be03 Mon Sep 17 00:00:00 2001 From: Michael Harding Date: Thu, 30 Aug 2018 11:17:35 -0400 Subject: [PATCH 06/22] SPARK-1639: More of this --- .../Order/OrderDetailsPopupControl.xaml | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/client/spark/view/Controls/Order/OrderDetailsPopupControl.xaml b/src/client/spark/view/Controls/Order/OrderDetailsPopupControl.xaml index 5853f425a..d9a5c66b9 100644 --- a/src/client/spark/view/Controls/Order/OrderDetailsPopupControl.xaml +++ b/src/client/spark/view/Controls/Order/OrderDetailsPopupControl.xaml @@ -409,18 +409,21 @@ - Price Type - + > + Price Type + + @@ -440,21 +443,24 @@ - - Child - + - + > + + Child + + From 5920b841c3f8a923343892c8e00c23267605c38c Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 30 Aug 2018 11:49:29 -0400 Subject: [PATCH 07/22] SPARK-1642 / SPARK-1655 remove silence at beginning of some sounds --- src/client/spark/Notifications/INotifier.cs | 12 ++---------- src/client/spark/Notifications/NAudioPlayer.cs | 14 ++++++++++---- .../spark/Notifications/SoundNotification.cs | 9 +++++++++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/client/spark/Notifications/INotifier.cs b/src/client/spark/Notifications/INotifier.cs index 98aad00dd..1d75be20b 100644 --- a/src/client/spark/Notifications/INotifier.cs +++ b/src/client/spark/Notifications/INotifier.cs @@ -6,6 +6,7 @@ using mbts.collections.extensions; using mbts.persist; using mbts.spark; using mbts.ui.extensions; +using mbts.ui.utility; using NAudio.Wave; using System; using System.Collections.Generic; @@ -171,16 +172,7 @@ namespace mbts.ui { } static IReadOnlyDictionary _all_players() => - new Dictionary { - { SoundNotification.SystemSound.GameCorrect, new NAudioPlayer(bts.Properties.Resources.game_sound_correct) }, - { SoundNotification.SystemSound.GameIncorrect, new NAudioPlayer(bts.Properties.Resources.game_sound_wrong) }, - { SoundNotification.SystemSound.GameOverArcade, new NAudioPlayer(bts.Properties.Resources.game_over_arcade) }, - { SoundNotification.SystemSound.Whistle, new NAudioPlayer(bts.Properties.Resources.whistle) }, - { SoundNotification.SystemSound.BellCounter, new NAudioPlayer(bts.Properties.Resources.bell_counter) }, - { SoundNotification.SystemSound.Powerup, new NAudioPlayer(bts.Properties.Resources.powerup) }, - { SoundNotification.SystemSound.CashRegister, new NAudioPlayer(bts.Properties.Resources.cash_register_purchase) }, - { SoundNotification.SystemSound.Reload, new NAudioPlayer(bts.Properties.Resources.reload_1911) } - }; + EnumHelper.get_values().ToReadOnlyDictionary(s => s, NAudioPlayer.create); } // This class adopts to role of view-controller in the mvc paradigm, rather than view-model in mvvm. diff --git a/src/client/spark/Notifications/NAudioPlayer.cs b/src/client/spark/Notifications/NAudioPlayer.cs index 12bbb2dc1..938af0b95 100644 --- a/src/client/spark/Notifications/NAudioPlayer.cs +++ b/src/client/spark/Notifications/NAudioPlayer.cs @@ -1,4 +1,5 @@ using bts.shell; +using mbts.ui.utility; using NAudio.Wave; using System; using System.IO; @@ -9,21 +10,26 @@ namespace mbts.ui { // number of milliseconds to delay playing sound, // during which time all subsequent requests to play the same sound will be ignored. const int _delay_ms = 75; + readonly int _start_position; WaveOutEvent _wave_out = new WaveOutEvent(); WaveFileReader _wave_reader; bool _is_playing, _is_play_requested; - public NAudioPlayer(Stream uwave_stream) { + public NAudioPlayer(Stream uwave_stream, int start_position = 0) { var ms = new MemoryStream(); uwave_stream.CopyTo(ms); ms.Position = 0; _wave_reader = new WaveFileReader(ms); + _wave_reader.Position = _start_position = (start_position < _wave_reader.Length ? start_position : 0); _wave_out.Init(_wave_reader); _wave_out.PlaybackStopped += _on_playback_stopped; } - public static NAudioPlayer create(SoundNotification.SystemSound system_sound) => - new NAudioPlayer(_get_stream(system_sound)); + public static NAudioPlayer create(SoundNotification.SystemSound system_sound) { + var stream = _get_stream(system_sound); + var sb = EnumHelper.get_attribute(system_sound); + return sb != null ? new NAudioPlayer(stream, sb.start_position) : new NAudioPlayer(stream); + } public void play() { if (_is_playing) { @@ -36,7 +42,7 @@ namespace mbts.ui { } void _on_playback_stopped(object sender, StoppedEventArgs e) { - _wave_reader.Position = 0; + _wave_reader.Position = _start_position; if (_is_play_requested) { _is_play_requested = false; _play_core(); diff --git a/src/client/spark/Notifications/SoundNotification.cs b/src/client/spark/Notifications/SoundNotification.cs index 10c7b9b61..4125b3d95 100644 --- a/src/client/spark/Notifications/SoundNotification.cs +++ b/src/client/spark/Notifications/SoundNotification.cs @@ -25,6 +25,13 @@ namespace bts.shell { } } + class SilenceBufferAttribute : Attribute { + public readonly int start_position; + + public SilenceBufferAttribute(int start_position) => + this.start_position = start_position; + } + [ProtoContract] class SoundNotification { SystemSound? _system_sound; @@ -37,10 +44,12 @@ namespace bts.shell { GameIncorrect, [License(LicenseType.PublicDomain, "Game Over Arcade", "myfox14", link: "https://freesound.org/people/myfox14/sounds/")] GameOverArcade, + [SilenceBuffer(100000)] [License(LicenseType.PublicDomain, "Whistle", "zstewart09", link: "https://freesound.org/people/zstewart09/sounds")] Whistle, [License(LicenseType.PublicDomain, "Powerup", "kianda", link: "https://freesound.org/people/kianda/sounds/")] Powerup, + [SilenceBuffer(130000)] [License(LicenseType.AttributionLicense, "Bell, Counter, A", "Inspectorj of Freesound.org", link: "https://www.jshaw.co.uk")] BellCounter, [License(LicenseType.PublicDomain, "Cash Register Purchase", "Zott820", link: "https://freesound.org/people/Zott820/sounds/")] From c53c843d54a995f1f3a3322ea98d4095fd567e68 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 30 Aug 2018 11:55:22 -0400 Subject: [PATCH 08/22] remove unused CVOrderBook message in toggles.conf --- src/lib/config/protos/toggles.proto | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lib/config/protos/toggles.proto b/src/lib/config/protos/toggles.proto index 7e4b45df2..ac186df5d 100644 --- a/src/lib/config/protos/toggles.proto +++ b/src/lib/config/protos/toggles.proto @@ -12,10 +12,6 @@ message LaddersOnThreads { optional bool enabled = 1 [default = true]; } -message CVOrderBook { - optional bool enabled = 1 [default = true]; -} - message FilterOrdersWithDanglingSecurities { optional bool enabled = 1 [default = true]; } From 07874cad770f8d3b7fb067940b40aaa611cb002b Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 30 Aug 2018 13:21:11 -0400 Subject: [PATCH 09/22] SPARK-1642 / SPARK-1656 disable toast notifications for 1.2 via toggles.conf --- .../Modules/Settings/SettingsShellModule.cs | 11 ++-- src/client/spark/Notifications/INotifier.cs | 50 ++++++++++--------- .../spark/Predicates/IPredicateBuilderVM.cs | 5 +- .../UserSettings/UserSettings.cs | 3 +- src/lib/config/protos/toggles.proto | 4 ++ 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/client/spark/Modules/Settings/SettingsShellModule.cs b/src/client/spark/Modules/Settings/SettingsShellModule.cs index d604f794c..005dd648b 100644 --- a/src/client/spark/Modules/Settings/SettingsShellModule.cs +++ b/src/client/spark/Modules/Settings/SettingsShellModule.cs @@ -12,6 +12,7 @@ using bts.api; using System.ComponentModel.Composition; using mbts.ui.spark; using mbts.persist; +using mbts.config; namespace bts.ui { [Export(typeof(IShellModule))] @@ -25,6 +26,11 @@ namespace bts.ui { public SettingsShellModule(IBus bus, UserSettingsHub settings_hub, WorkspacesModel ws) { // todo: settings dialog ws_model = ws; + var actions_list = new List(2) { SparkCommands.ShowWorkspaces }; + if (Configuration.get().enabled) { + actions_list.Add(SparkCommands.ShowSettings); + } + actions = actions_list; _dispose = Disposable.Create( bus.subscribe(SparkTags.ShowWorkspaces).Subscribe(_ => show_workspaces_dialog()), bus.subscribe(SparkTags.ShowSettings).Subscribe(_ => { @@ -42,10 +48,7 @@ namespace bts.ui { public int priority => 40; - public IEnumerable actions => new SparkCommand[]{ - SparkCommands.ShowWorkspaces, - SparkCommands.ShowSettings - }; + public IEnumerable actions { get; } public Task create(Stream load_stream) { throw new NotImplementedException(); diff --git a/src/client/spark/Notifications/INotifier.cs b/src/client/spark/Notifications/INotifier.cs index 1d75be20b..5934e1cfb 100644 --- a/src/client/spark/Notifications/INotifier.cs +++ b/src/client/spark/Notifications/INotifier.cs @@ -3,6 +3,7 @@ using bts.api; using bts.shell; using bts.spark; using mbts.collections.extensions; +using mbts.config; using mbts.persist; using mbts.spark; using mbts.ui.extensions; @@ -52,7 +53,7 @@ namespace mbts.ui { ToastNotificationController _toast_controller; SoundNotificationPlayer _sound_player; Dispatcher _dispatcher; - bool _toast_notifications_enabled, _sound_notifications_enabled; + bool _toast_notifications_enabled, _sound_notifications_enabled = NotificationSettings.Default.sound_notification.enabled; [ImportingConstructor] public Notifier(IBus bus, UserSettingsHub settings_hub) { @@ -70,27 +71,29 @@ namespace mbts.ui { if (_disposer.has_dispose_started) return; _sound_player = SoundNotificationPlayer.create(); - _toast_controller = new ToastNotificationController(bus); - _settings_sub = settings_hub.subscribe_default_settings().StartWith(settings_hub.current).OnDispatcher().Subscribe(s => { - if (s == null || _disposer.has_dispose_started) - return; - _sound_notifications_enabled = s.notification.sound_notification.enabled; - switch (s.notification.toast_notification.mode) { - case ToastNotificationSettings.Mode.Disabled: - _toast_notifications_enabled = false; - _toast_controller.hide(); - break; - case ToastNotificationSettings.Mode.Flash: - _toast_notifications_enabled = true; - _toast_controller.flash_duration = s.notification.toast_notification.duration ?? _fallback_flash_duration; - break; - case ToastNotificationSettings.Mode.ManualClose: - _toast_notifications_enabled = true; - _toast_controller.flash_duration = null; - break; - } - _toast_controller.max_height = Math.Max(s.notification.toast_notification.max_height, _toast_notification_box_min_height); - }); + if (Configuration.get().enabled) { + _toast_controller = new ToastNotificationController(bus); + _settings_sub = settings_hub.subscribe_default_settings().StartWith(settings_hub.current).OnDispatcher().Subscribe(s => { + if (s == null || _disposer.has_dispose_started) + return; + _sound_notifications_enabled = s.notification.sound_notification.enabled; + switch (s.notification.toast_notification.mode) { + case ToastNotificationSettings.Mode.Disabled: + _toast_notifications_enabled = false; + _toast_controller.hide(); + break; + case ToastNotificationSettings.Mode.Flash: + _toast_notifications_enabled = true; + _toast_controller.flash_duration = s.notification.toast_notification.duration ?? _fallback_flash_duration; + break; + case ToastNotificationSettings.Mode.ManualClose: + _toast_notifications_enabled = true; + _toast_controller.flash_duration = null; + break; + } + _toast_controller.max_height = Math.Max(s.notification.toast_notification.max_height, _toast_notification_box_min_height); + }); + } // it is possible that dispose was called on another thread while we were initializing things above. if (_disposer.has_dispose_started) { Disposable.dispose(ref _settings_sub); @@ -99,8 +102,7 @@ namespace mbts.ui { (_dispatcher = Dispatcher.CurrentDispatcher).UnhandledException += _on_dispatcher_UnhandledException; Dispatcher.Run(); } - } - catch (Exception ex) { + } catch (Exception ex) { Log.assert(false, $"Exception in {Thread.CurrentThread.Name} thread: {ex}"); _disposer.Dispose(); } diff --git a/src/client/spark/Predicates/IPredicateBuilderVM.cs b/src/client/spark/Predicates/IPredicateBuilderVM.cs index 0788a523c..5e0469130 100644 --- a/src/client/spark/Predicates/IPredicateBuilderVM.cs +++ b/src/client/spark/Predicates/IPredicateBuilderVM.cs @@ -1,4 +1,5 @@ using mbts.collections.extensions; +using mbts.config; using mbts.spark; using mbts.ui.shell; using mbts.ui.spark; @@ -31,6 +32,8 @@ namespace mbts.ui.settings { } static class PredicateBuilderVMWrapper { + static readonly bool _toast_notifications_enabled_global = Configuration.get().enabled; + public static ITemplatedPropertyWrapperVM wrap_child_oneof( Func get, Action set, Func get_child_oneof, Dictionary> oneof_vms) where TChildOneof : struct @@ -104,7 +107,7 @@ namespace mbts.ui.settings { } } public ITemplatedPropertyWrapperVM selected_predicate => _selected_predicate.Value; - public bool can_enable_toast_notifications => _can_enable_toast_notifications.Value; + public bool can_enable_toast_notifications => _toast_notifications_enabled_global && _can_enable_toast_notifications.Value; public bool toast_notifications_enabled { get => _toast_notifications_enabled.Value; set => _toast_notifications_enabled.set(value); } string ITemplateSelectorKey.key => PredicateTemplateKeys.Recursive; diff --git a/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs b/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs index c3155d069..23c2cb0c7 100644 --- a/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs +++ b/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs @@ -17,7 +17,8 @@ namespace mbts.spark { [ProtoMember(1)] LadderSettings _ladder; - [ProtoMember(2)] + // removing NotificationSettings these from proto-serialization, since they are disabled by default for now. + // This way, when they are enabled, there won't be any backwards compatability issues to worry about, as no clients will have persisted them yet. NotificationSettings _notification; public UserSettings() { } diff --git a/src/lib/config/protos/toggles.proto b/src/lib/config/protos/toggles.proto index ac186df5d..f7277ca33 100644 --- a/src/lib/config/protos/toggles.proto +++ b/src/lib/config/protos/toggles.proto @@ -23,3 +23,7 @@ message FillsSoftCleanup{ message OrdersSoftCleanup{ optional bool enabled = 1 [default = true]; } + +message ToastNotifications { + optional bool enabled = 1 [default = false]; +} \ No newline at end of file From 677d1aaa77d82c8614ca7a39c3d1af1a7e60082d Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 30 Aug 2018 13:34:03 -0400 Subject: [PATCH 10/22] SPARK-1642 / SPARK-1657 order completed/canceled aren't playing --- .../spark/Predicates/Data/Events/OrderEventPredicateHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs b/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs index 9582b6089..c007e88de 100644 --- a/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs +++ b/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs @@ -19,7 +19,7 @@ namespace mbts { public static bool check_order_transition_trigger(OrderRecordTuple order, Func order_predicate_core, IPredicate security_predicate, INotificationServiceDataCache data_cache, out OrderRecordTuple oldval) { if (check_security_predicate(order, security_predicate) && order_predicate_core(order.order)) { oldval = data_cache.get_previous_order_state(order.order.Key); - return oldval == null ? !data_cache.is_first_order_update : order_predicate_core(oldval.order); + return oldval == null ? !data_cache.is_first_order_update : !order_predicate_core(oldval.order); } oldval = null; return false; From 6ffb8b630f7d56cdb9bd16a2e9ad5c97acc030d1 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Thu, 30 Aug 2018 13:12:05 -0500 Subject: [PATCH 11/22] SPARK-1651 cleanup collapse/exapnd all into 2 sepearate toolbar icons --- src/client/spark/Images/Icons.cs | 4 +-- src/client/spark/Images/Vector/Icons.xaml | 35 +++++++++++++++---- .../Modules/Trading/OrderBook/OrderBookVM.cs | 17 +++++---- .../Trading/OrderBook/OrderBookWindow.cs | 19 ++++++---- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/client/spark/Images/Icons.cs b/src/client/spark/Images/Icons.cs index 419d49708..f7f608d48 100644 --- a/src/client/spark/Images/Icons.cs +++ b/src/client/spark/Images/Icons.cs @@ -113,8 +113,8 @@ namespace mbts.ui { public static ImageSource Tools => create_icon(ToolsGeometryKey); public static ImageSource ViewSettings => (DrawingImage)_resources["ViewSettings"]; public static ImageSource Wrench { get { return (DrawingImage)_resources["Wrench"]; } } - public static ImageSource UpArrow { get { return (DrawingImage)_resources["UpArrow"]; } } - + public static ImageSource RightArrow { get { return ((DrawingImage)_resources["RightArrow"]); } } + public static ImageSource DownArrow { get { return ((DrawingImage)_resources["DownArrow"]); } } public static ImageSource Support => (DrawingImage)_resources["SupportIcon"]; public static ImageSource create_icon(string geometric_path_key) => create_icon(geometric_path_key, Brushes.Black); diff --git a/src/client/spark/Images/Vector/Icons.xaml b/src/client/spark/Images/Vector/Icons.xaml index ebc53742c..ccd920526 100644 --- a/src/client/spark/Images/Vector/Icons.xaml +++ b/src/client/spark/Images/Vector/Icons.xaml @@ -20,6 +20,10 @@ M4.9629898,25.440168C4.564003,25.440168 4.0650101,25.640182 3.7659989,25.939165 3.0680008,26.638176 3.0680008,27.635191 3.7659989,28.3342 4.4639969,29.032204 5.4620133,29.032204 6.1600113,28.3342 6.8589859,27.635191 6.8589859,26.638176 6.1600113,25.939165 5.760994,25.640182 5.3620072,25.440168 4.9629898,25.440168z M18.432014,18.457121L22.422005,22.447138 24.816994,22.946165 29.107002,29.431192 27.509987,31.027212 21.025002,26.737175 20.526985,24.343178 16.535988,20.352123z M8.1560135,18.357115L13.643013,23.84415C11.048988,26.638176 8.9539872,28.932196 7.9560013,29.930189 6.359993,31.526207 3.6659928,31.626215 2.070015,29.930189 0.47400668,28.3342 0.47400668,25.640182 2.070015,24.044165z M2.967995,6.7840408C2.768013,6.7840408 2.5690079,6.8840479 2.4690018,6.9840545 2.1699906,7.2830371 2.1699906,7.7820638 2.4690018,8.0810469L11.746986,17.359123C12.047005,17.659113 12.544991,17.659113 12.845009,17.359123 13.14399,17.06011 13.14399,16.561113 12.845009,16.2621L3.5659867,6.9840545C3.3670121,6.8840479,3.1669998,6.7840408,2.967995,6.7840408z M5.2620011,4.4890431C5.0629959,4.4890431 4.8630143,4.5890192 4.7640152,4.6890262 4.3649979,4.9880394 4.3649979,5.4870356 4.7640152,5.8860554L14.042,15.164101C14.341011,15.46409 14.840004,15.46409 15.139015,15.164101 15.439003,14.865087 15.439003,14.366092 15.139015,14.067109L5.8610001,4.6890262C5.661995,4.5890192,5.4620133,4.4890431,5.2620011,4.4890431z M4.3649979,2.3940283C5.4620133,2.3940281,6.5589981,2.7930175,7.3580094,3.5920337L19.328987,15.46409 13.342995,21.450153 1.2720107,9.6770657C-0.42400357,7.9810704 -0.42400357,5.2880291 1.2720107,3.6910337 2.1699906,2.7930175 3.267006,2.3940281 4.3649979,2.3940283z M24.217995,0C25.31501,-8.5992724E-08,26.312996,0.20001344,27.211006,0.59900296L23.021004,4.7890328C22.223,5.5870422,22.223,6.7840408,23.021004,7.4820436L24.617012,9.079069C25.414986,9.8770789,26.612007,9.8770789,27.311012,9.079069L31.501015,4.9880394C31.799995,5.8860554 32.000008,6.7840408 32.000008,7.7820638 32.000008,12.07207 28.508003,15.564097 24.217995,15.564097 19.927986,15.564097 16.436012,12.07207 16.436012,7.7820638 16.436012,3.4920272 19.927986,-8.5992724E-08 24.217995,0z + + + F1 M 78.1398,324.18L 52.5865,298.626C 51.6892,297.728 50.3385,297.459 49.1678,297.946C 47.9971,298.43 47.2305,299.574 47.2305,300.843L 60.6385,326.398L 47.2305,351.952C 47.2305,353.223 47.9971,354.364 49.1678,354.848C 49.5558,355.011 49.9638,355.09 50.3678,355.09C 51.1838,355.09 51.9852,354.77 52.5865,354.171L 78.1398,328.616C 78.7238,328.032 79.0598,327.224 79.0598,326.398C 79.0598,325.572 78.7238,324.764 78.1398,324.18 Z + @@ -763,20 +767,39 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z"> - + - + + + + + + + + + + + + + + + + + + + + + + - diff --git a/src/client/spark/Predicates/IPredicateBuilderVM.cs b/src/client/spark/Predicates/IPredicateBuilderVM.cs index 5e0469130..41e319b6c 100644 --- a/src/client/spark/Predicates/IPredicateBuilderVM.cs +++ b/src/client/spark/Predicates/IPredicateBuilderVM.cs @@ -109,6 +109,7 @@ namespace mbts.ui.settings { public ITemplatedPropertyWrapperVM selected_predicate => _selected_predicate.Value; public bool can_enable_toast_notifications => _toast_notifications_enabled_global && _can_enable_toast_notifications.Value; public bool toast_notifications_enabled { get => _toast_notifications_enabled.Value; set => _toast_notifications_enabled.set(value); } + public bool is_root => true; string ITemplateSelectorKey.key => PredicateTemplateKeys.Recursive; protected override void Dispose(bool disposing) => @@ -164,6 +165,7 @@ namespace mbts.ui.settings { } } public ITemplatedPropertyWrapperVM selected_predicate => _selected_predicate.Value; + public bool is_root => false; string ITemplateSelectorKey.key => _template_key; protected override void Dispose(bool disposing) { diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsVM.cs b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsVM.cs index 9be38cc1e..aa4264d68 100644 --- a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsVM.cs +++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsVM.cs @@ -133,12 +133,12 @@ namespace mbts.spark { } public class PredicateRowAnimationVM : DisposableViewModelBase, IValueFactory<(TPredicateBuilder predicate, IEnumerable animations, IEnumerable sounds)> { - readonly Property _show_animations, _play_sound; + readonly Property _show_animations/*, _play_sound*/; public PredicateRowAnimationVM(IPropertyWrapperVM predicate) { this.predicate = predicate; _show_animations = backing(nameof(show_animations), true); - _play_sound = backing(nameof(play_sound), true); + //_play_sound = backing(nameof(play_sound), true); animations = new ObservableEditableCollection(() => { var vm = new RowAnimationVM(); vm.selected_animation_type = vm.animation_types.FirstOrDefault(); @@ -152,13 +152,14 @@ namespace mbts.spark { public ObservableEditableCollection animations { get; } public IEnumerable animation_types { get; } = EnumHelper.get_values_except(CellAnimation.AnimationTypeOneofCase.None); public bool show_animations { get => _show_animations.Value; set => _show_animations.set(value); } - public bool play_sound { get => _play_sound.Value; set => _play_sound.set(value); } + //public bool play_sound { get => _play_sound.Value; set => _play_sound.set(value); } public IPropertyWrapperVM sound { get; } = SoundAnimationVM.create_system_sound_vm(); public (TPredicateBuilder predicate, IEnumerable animations, IEnumerable sounds) create() => (predicate.create_assigned(), animations.Select(a => a.create_assigned()), - EnumerableExtensions.return_if(play_sound, () => sound.create_assigned())); + new[] { sound.create_assigned() }); + //EnumerableExtensions.return_if(play_sound, () => sound.create_assigned())); public void load_from((TPredicateBuilder predicate, IEnumerable animations, IEnumerable sounds) args) { predicate.load_from(args.predicate); @@ -169,9 +170,9 @@ namespace mbts.spark { })); var en = args.sounds.GetEnumerator(); if (en.MoveNext()) { - _play_sound.set(true); + //_play_sound.set(true); sound.load_from(en.Current); - } else _play_sound.set(false); + } //else _play_sound.set(false); } } } diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml index 6676c3ed5..a6adf52c3 100644 --- a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml +++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml @@ -30,6 +30,7 @@ 8.0 16.0 140 + 176 240 70 88 @@ -133,7 +134,16 @@ - + + + + @@ -446,38 +456,44 @@ Grid.Row="4" Grid.Column="1" > - + - - - - + + - Play Sound - - + + + + + + Play + + + + - + diff --git a/src/client/spark/view/Resources/Buttons.xaml b/src/client/spark/view/Resources/Buttons.xaml index bb439a758..0619e4198 100644 --- a/src/client/spark/view/Resources/Buttons.xaml +++ b/src/client/spark/view/Resources/Buttons.xaml @@ -281,6 +281,64 @@ + + #8E8EDD + #B8B8B8 + + + + + - - #8E8EDD + #8E8EDD--> + #40DD40 #B8B8B8 - + --> +