diff --git a/src/client/spark/Daemons/SecurityPickerDaemon.cs b/src/client/spark/Daemons/SecurityPickerDaemon.cs
index 39b4c2fe7..d85d45a37 100644
--- a/src/client/spark/Daemons/SecurityPickerDaemon.cs
+++ b/src/client/spark/Daemons/SecurityPickerDaemon.cs
@@ -44,7 +44,7 @@ namespace bts {
view.Height = Double.NaN;
view.Width = Double.NaN;
- vm.close_action = () => {
+ vm.ok_action = () => {
picker.Close();
message.complete(vm.result).execute(_bus);
};
@@ -68,7 +68,7 @@ namespace bts {
view.Height = Double.NaN;
view.Width = Double.NaN;
- vm.close_action = () => {
+ vm.ok_action = () => {
picker.Close();
message.complete(vm.result_criteria).execute(_bus);
};
@@ -91,7 +91,7 @@ namespace bts {
view.Height = Double.NaN;
view.Width = Double.NaN;
- vm.close_action = () => {
+ vm.ok_action = () => {
picker.Close();
message_and_data.message.complete(vm.result_criteria).execute(_bus);
};
diff --git a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml
index 6bf5b35da..f0dbb45f5 100644
--- a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml
+++ b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml
@@ -221,8 +221,8 @@
IsOpen="{Binding IsNewLegPopupOpen, RelativeSource={RelativeSource AncestorType=usp:ExecutionStrategyEditor}, Mode=TwoWay}"
>
diff --git a/src/client/spark/Modules/Spreader/VM/SyntheticEditorVM.cs b/src/client/spark/Modules/Spreader/VM/SyntheticEditorVM.cs
index 8399981fa..431550708 100644
--- a/src/client/spark/Modules/Spreader/VM/SyntheticEditorVM.cs
+++ b/src/client/spark/Modules/Spreader/VM/SyntheticEditorVM.cs
@@ -46,11 +46,11 @@ namespace mbts.spark {
title = "Create Synthetic";
icon = Icons.Tetris;
contract_picker_model = new ContractPickerModel(bus, false, null);
- contract_picker_model.close_action = () => {
+ contract_picker_model.cancel_action = _close_new_leg_popup;
+ contract_picker_model.ok_action = () => {
if (!leg_tuples.Any(l => l.leg.Security.Id == contract_picker_model.result.security.Id)) {
leg_tuples.Add(leg_tuple_factory(contract_picker_model.result.security));
- is_new_leg_popup_open = false;
- RaisePropertyChanged(nameof(is_new_leg_popup_open));
+ _close_new_leg_popup();
}
};
remove_leg = new DelegateCommand(s => leg_tuples.removeFirst(l => l.leg.Security.Id == s.Id));
@@ -154,5 +154,10 @@ namespace mbts.spark {
_tick_factors = TickUtils.deduce_ticks(leg_tuples.Select(l => l.leg.Security.ContractSpec));
RaisePropertyChanged(nameof(tick_factors));
}
+
+ void _close_new_leg_popup() {
+ is_new_leg_popup_open = false;
+ RaisePropertyChanged(nameof(is_new_leg_popup_open));
+ }
}
}
\ No newline at end of file
diff --git a/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml b/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml
index 0f65ba4ed..9008edf0e 100644
--- a/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml
+++ b/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml
@@ -32,6 +32,9 @@
diff --git a/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml.cs b/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml.cs
index 0d22249b7..77f5f1e42 100644
--- a/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml.cs
+++ b/src/client/spark/view/Controls/DialogSkirts/DialogSkirtOKCancel.xaml.cs
@@ -3,27 +3,65 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
-namespace mbts.ui.controls
-{
+namespace mbts.ui.controls {
///
/// Interaction logic for DialogSkirtOKCancel.xaml
///
- public class DialogSkirtOKCancel : Control
- {
- static DialogSkirtOKCancel() {
+ class DialogSkirtOKCancel : Control {
+ static DialogSkirtOKCancel() =>
DefaultStyleKeyProperty.OverrideMetadata(typeof(DialogSkirtOKCancel), new FrameworkPropertyMetadata(typeof(DialogSkirtOKCancel)));
- }
- public static readonly DependencyProperty IsOkDefaultProperty = DependencyProperty.Register("IsOkDefault", typeof(bool), typeof(DialogSkirtOKCancel), new PropertyMetadata(true));
- public static readonly DependencyProperty OKCommandProperty = DependencyProperty.Register("OKCommand", typeof(ICommand), typeof(DialogSkirtOKCancel));
- public static readonly DependencyProperty OKCommandParameterProperty = DependencyProperty.Register("OKCommandParameter", typeof(object), typeof(DialogSkirtOKCancel));
- public static readonly DependencyProperty CloseOnOKProperty = DependencyProperty.Register(nameof(CloseOnOK), typeof(bool), typeof(DialogSkirtOKCancel), new PropertyMetadata(true));
+ #region IsOKDefault
+ public static readonly DependencyProperty IsOkDefaultProperty =
+ DependencyProperty.Register(nameof(IsOkDefault), typeof(bool), typeof(DialogSkirtOKCancel), new PropertyMetadata(true));
public bool IsOkDefault { get { return (bool)GetValue(IsOkDefaultProperty); } set { SetValue(IsOkDefaultProperty, value); } }
+ #endregion
+
+ #region OKCommand
+ public static readonly DependencyProperty OKCommandProperty =
+ DependencyProperty.Register(nameof(OKCommand), typeof(ICommand), typeof(DialogSkirtOKCancel));
+
[Bindable(true)]
public ICommand OKCommand { get { return GetValue(OKCommandProperty) as ICommand; } set { SetValue(OKCommandProperty, value); } }
+ #endregion
+
+ #region OKCommandParameter
+ public static readonly DependencyProperty OKCommandParameterProperty =
+ DependencyProperty.Register(nameof(OKCommandParameter), typeof(object), typeof(DialogSkirtOKCancel));
+
[Bindable(true)]
public object OKCommandParameter { get { return GetValue(OKCommandParameterProperty); } set { SetValue(OKCommandParameterProperty, value); } }
+ #endregion
+
+ #region CancelCommand
+ public static readonly DependencyProperty CancelCommandProperty =
+ DependencyProperty.Register(nameof(CancelCommand), typeof(ICommand), typeof(DialogSkirtOKCancel));
+
+ [Bindable(true)]
+ public ICommand CancelCommand { get { return GetValue(CancelCommandProperty) as ICommand; } set { SetValue(CancelCommandProperty, value); } }
+ #endregion
+
+ #region CancelCommandParameter
+ public static readonly DependencyProperty CancelCommandParameterProperty =
+ DependencyProperty.Register(nameof(CancelCommandParameter), typeof(object), typeof(DialogSkirtOKCancel));
+
+ [Bindable(true)]
+ public object CancelCommandParameter { get { return GetValue(CancelCommandParameterProperty); } set { SetValue(CancelCommandParameterProperty, value); } }
+ #endregion
+
+ #region CloseOnOK
+ public static readonly DependencyProperty CloseOnOKProperty =
+ DependencyProperty.Register(nameof(CloseOnOK), typeof(bool), typeof(DialogSkirtOKCancel), new PropertyMetadata(true));
+
public bool CloseOnOK { get => (bool)GetValue(CloseOnOKProperty); set => SetValue(CloseOnOKProperty, value); }
+ #endregion
+
+ #region CloseOnCancel
+ public static readonly DependencyProperty CloseOnCancelProperty =
+ DependencyProperty.Register(nameof(CloseOnCancel), typeof(bool), typeof(DialogSkirtOKCancel), new PropertyMetadata(true));
+
+ public bool CloseOnCancel { get => (bool)GetValue(CloseOnCancelProperty); set => SetValue(CloseOnCancelProperty, value); }
+ #endregion
}
}
\ No newline at end of file
diff --git a/src/client/spark/view/Spark/ContractPicker/ContractPickerModel.cs b/src/client/spark/view/Spark/ContractPicker/ContractPickerModel.cs
index eb00c7249..c482f0ef5 100644
--- a/src/client/spark/view/Spark/ContractPicker/ContractPickerModel.cs
+++ b/src/client/spark/view/Spark/ContractPicker/ContractPickerModel.cs
@@ -83,7 +83,7 @@ namespace mbts.spark
);
ok_button_command = new DelegateCommand(
- execute: _ => { close_action?.Invoke(); },
+ execute: _ => { ok_action?.Invoke(); },
can_execute: _ => {
if (!is_edit_mode) {
return (selected_securities.Count > 0);
@@ -93,6 +93,8 @@ namespace mbts.spark
}
);
+ cancel_button_command = new DelegateCommand(() => cancel_action?.Invoke());
+
add_symbol_command = new DelegateCommand(symbol => {
_compose_criteria_clause_name(true);
if (!security_criteria_clauses.Any(x => x.pretty_name == _criteria_input_name_from_double_click)) {
@@ -244,6 +246,7 @@ namespace mbts.spark
public ICommand add_criteria_command { get; }
public ICommand remove_criteria_command { get; }
public ICommand ok_button_command { get; }
+ public ICommand cancel_button_command { get; }
public ICommand add_symbol_command { get; }
public ICommand add_security_type_command { get; }
public ICommand add_exchange_command { get; }
@@ -277,7 +280,8 @@ namespace mbts.spark
}
}
- public Action close_action { get; set; }
+ public Action ok_action { get; set; }
+ public Action cancel_action { get; set; }
public bool is_edit_mode { get; set; }
diff --git a/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml b/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml
index 7963c43c6..5aa13e095 100644
--- a/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml
+++ b/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml
@@ -181,7 +181,13 @@
-
+
diff --git a/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml.cs b/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml.cs
index 99cf55cf9..f582f25ab 100644
--- a/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml.cs
+++ b/src/client/spark/view/Spark/ContractPicker/ContractPickerView.xaml.cs
@@ -17,6 +17,7 @@ using System.IO;
using bts.api;
using System.ComponentModel.Composition;
using bts.spark;
+using mbts.ui.controls;
namespace mbts.spark
{
@@ -107,8 +108,19 @@ namespace mbts.spark
((ContractPickerModel)DataContext).criteria_selection_changed(_criteria.SelectedItems.Cast());
}
- public static readonly DependencyProperty CloseOnOKProperty = DependencyProperty.Register(nameof(CloseOnOK), typeof(bool), typeof(ContractPickerView), new PropertyMetadata(true));
+ #region CloseOnOK
+ public static readonly DependencyProperty CloseOnOKProperty =
+ DialogSkirtOKCancel.CloseOnOKProperty.AddOwner(typeof(ContractPickerView));
+
public bool CloseOnOK { get => (bool)GetValue(CloseOnOKProperty); set => SetValue(CloseOnOKProperty, value); }
+ #endregion
+
+ #region CloseOnCancel
+ public static readonly DependencyProperty CloseOnCancelProperty =
+ DialogSkirtOKCancel.CloseOnCancelProperty.AddOwner(typeof(ContractPickerView));
+
+ public bool CloseOnCancel { get => (bool)GetValue(CloseOnCancelProperty); set => SetValue(CloseOnCancelProperty, value); }
+ #endregion
}
//[Export(typeof(IShellModule))]