public PositionManagerViewModel(PositionManager owner) //, NinjaTrader.Indicator.NadexBoxer parentIndicator) { //Positions.Add(new NadexPosition { DisplayName = "Spread 1", IsActive = true, Expiration = DateTime.Now.AddHours(1), SpreadCeiling = 1425, SpreadFloor = 1423, // Quantity = 1, PricePaid = 1423.50, CurrentPnL = 12.00d }); owner.CommandBindings.Add(new CommandBinding(AddPositionCommand, OnAddPositionCommand)); owner.CommandBindings.Add(new CommandBinding(RemovePositionCommand, OnRemovePositionCommand, (o, e) => e.CanExecute = _selectedItem != null)); owner.Dispatcher.BeginInvoke(new Action(() => LoadPositionsFromXml()), DispatcherPriority.Background); }
protected override void OnStartUp() { #if DEBUG Print("NadexBoxer::OnStartUp"); #endif // you have to do this or else keyboard input wont work in the wpf control!! jesus christ _positionManager = new PositionManager(); _positionManager.Closing += (o,e) => _positionManager = null; System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(_positionManager); _positionManager.Show(); _positionManager.ViewModel.Indicator = this; _positionManager.ViewModel.LoadPositionsFromXml(); }
public PositionManagerViewModel(PositionManager owner) //, NinjaTrader.Indicator.NadexBoxer parentIndicator) { //Positions.Add(new NadexPosition { DisplayName = "Spread 1", IsActive = true, Expiration = DateTime.Now.AddHours(1), SpreadCeiling = 1425, SpreadFloor = 1423, // Quantity = 1, PricePaid = 1423.50, CurrentPnL = 12.00d }); owner.CommandBindings.Add(new CommandBinding(AddPositionCommand, OnAddPositionCommand)); owner.CommandBindings.Add(new CommandBinding(RemovePositionCommand, OnRemovePositionCommand, (o,e) => e.CanExecute = _selectedItem != null )); owner.Dispatcher.BeginInvoke(new Action(() => LoadPositionsFromXml()), DispatcherPriority.Background); }