Пример #1
0
        private void Button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Button btn = sender as Button;

            if (btn != null)
            {
                ComposedFutureViewModel fvm = btn.Tag as ComposedFutureViewModel;
                if (fvm != null)
                {
                    _composition.Remove(fvm);
                }
            }
        }
Пример #2
0
        private void xamGridAvailContracts_SelectedRowsCollectionChanged(object sender, Infragistics.Controls.Grids.SelectionCollectionChangedEventArgs <Infragistics.Controls.Grids.SelectedRowsCollection> e)
        {
            if (e.NewSelectedItems.Count > 0)
            {
                Row row = e.NewSelectedItems[0];
                FutureContractItem futureItem = row.Data as FutureContractItem;

                if (_composition.Count > 1)
                {
                    _composition.RemoveAt(1);
                }

                ComposedFutureViewModel fvm = new ComposedFutureViewModel();
                fvm.ID     = futureItem.FutureCode;
                fvm.Name   = futureItem.FutureName;
                fvm.Last   = futureItem.Last;
                fvm.Action = _composition.Count == 0 ? TradeAction.LongEntry : TradeAction.ShortEntry;

                _composition.Add(fvm);
            }
        }