/// <summary> /// Initializes a new instance of the <see cref="CommissionPanel"/>. /// </summary> public CommissionPanel() { InitializeComponent(); var itemsSource = new ObservableCollectionEx <RuleItem>(); RuleGrid.ItemsSource = itemsSource; _rules = new ConvertibleObservableCollection <ICommissionRule, RuleItem>(new ThreadSafeObservableCollection <RuleItem>(itemsSource), CreateItem); var ruleTypes = new[] { typeof(CommissionPerOrderCountRule), typeof(CommissionPerOrderRule), typeof(CommissionPerOrderVolumeRule), typeof(CommissionPerTradeCountRule), typeof(CommissionPerTradePriceRule), typeof(CommissionPerTradeRule), typeof(CommissionPerTradeVolumeRule), typeof(CommissionSecurityIdRule), typeof(CommissionSecurityTypeRule), typeof(CommissionTurnOverRule), typeof(CommissionBoardCodeRule) }; _names.AddRange(ruleTypes.ToDictionary(t => t, t => t.GetDisplayName())); TypeCtrl.ItemsSource = _names; TypeCtrl.SelectedIndex = 0; }
/// <summary> /// Initializes a new instance of the <see cref="RiskPanel"/>. /// </summary> public RiskPanel() { InitializeComponent(); var ruleTypes = new[] { typeof(RiskCommissionRule), typeof(RiskOrderFreqRule), typeof(RiskOrderPriceRule), typeof(RiskOrderVolumeRule), typeof(RiskPnLRule), typeof(RiskPositionSizeRule), typeof(RiskPositionTimeRule), typeof(RiskSlippageRule), typeof(RiskTradeFreqRule), typeof(RiskTradePriceRule), typeof(RiskTradeVolumeRule) }; _names.AddRange(ruleTypes.ToDictionary(t => t, t => t.GetDisplayName())); TypeCtrl.ItemsSource = _names; TypeCtrl.SelectedIndex = 0; var itemsSource = new ObservableCollectionEx <RuleItem>(); RuleGrid.ItemsSource = itemsSource; _rules = new ConvertibleObservableCollection <IRiskRule, RuleItem>(new ThreadSafeObservableCollection <RuleItem>(itemsSource), CreateItem); }
/// <summary> /// Initializes a new instance of the <see cref="CommissionPanel"/>. /// </summary> public CommissionPanel() { InitializeComponent(); var itemsSource = new ObservableCollectionEx<RuleItem>(); RuleGrid.ItemsSource = itemsSource; _rules = new ConvertibleObservableCollection<ICommissionRule, RuleItem>(new ThreadSafeObservableCollection<RuleItem>(itemsSource), CreateItem); var ruleTypes = new[] { typeof(CommissionPerOrderCountRule), typeof(CommissionPerOrderRule), typeof(CommissionPerOrderVolumeRule), typeof(CommissionPerTradeCountRule), typeof(CommissionPerTradePriceRule), typeof(CommissionPerTradeRule), typeof(CommissionPerTradeVolumeRule), typeof(CommissionSecurityIdRule), typeof(CommissionSecurityTypeRule), typeof(CommissionTurnOverRule), typeof(CommissionBoardCodeRule) }; _names.AddRange(ruleTypes.ToDictionary(t => t, t => t.GetDisplayName())); TypeCtrl.ItemsSource = _names; TypeCtrl.SelectedIndex = 0; }
/// <summary> /// Initializes a new instance of the <see cref="RiskPanel"/>. /// </summary> public RiskPanel() { InitializeComponent(); var ruleTypes = new[] { typeof(RiskCommissionRule), typeof(RiskOrderFreqRule), typeof(RiskOrderPriceRule), typeof(RiskOrderVolumeRule), typeof(RiskPnLRule), typeof(RiskPositionSizeRule), typeof(RiskPositionTimeRule), typeof(RiskSlippageRule), typeof(RiskTradeFreqRule), typeof(RiskTradePriceRule), typeof(RiskTradeVolumeRule) }; _names.AddRange(ruleTypes.ToDictionary(t => t, t => t.GetDisplayName())); TypeCtrl.ItemsSource = _names; TypeCtrl.SelectedIndex = 0; var itemsSource = new ObservableCollectionEx<RuleItem>(); RuleGrid.ItemsSource = itemsSource; _rules = new ConvertibleObservableCollection<IRiskRule, RuleItem>(new ThreadSafeObservableCollection<RuleItem>(itemsSource), CreateItem); }
/// <summary> /// Создать <see cref="PortfolioGrid"/>. /// </summary> public PortfolioGrid() { InitializeComponent(); var itemsSource = new ObservableCollectionEx<PositionItem>(); ItemsSource = itemsSource; _positions = new ConvertibleObservableCollection<BasePosition, PositionItem>(new ThreadSafeObservableCollection<PositionItem>(itemsSource), p => new PositionItem(p)); GroupingColumns.Add(Columns[0]); }
/// <summary> /// Создать <see cref="PortfolioGrid"/>. /// </summary> public PortfolioGrid() { InitializeComponent(); var itemsSource = new ObservableCollectionEx <PositionItem>(); ItemsSource = itemsSource; _positions = new ConvertibleObservableCollection <BasePosition, PositionItem>(new ThreadSafeObservableCollection <PositionItem>(itemsSource), p => new PositionItem(p)); GroupingColumns.Add(Columns[0]); }
/// <summary> /// Initializes a new instance of the <see cref="SecurityGrid"/>. /// </summary> public SecurityGrid() { InitializeComponent(); var itemsSource = new ObservableCollectionEx <SecurityItem>(); ItemsSource = itemsSource; _securities = new ConvertibleObservableCollection <Security, SecurityItem>(new ThreadSafeObservableCollection <SecurityItem>(itemsSource), CreateItem); _selectedSecurities = new SelectedSecurityList(this); }
/// <summary> /// Создать <see cref="SecurityGrid"/>. /// </summary> public SecurityGrid() { InitializeComponent(); var itemsSource = new ObservableCollectionEx <SecurityItem>(); //var itemsSource = new ObservableCollection<SecurityItem>(); //itemsSource.CollectionChanged += (sender, args) => //{ // var newCount = args.NewItems == null ? 0 : args.NewItems.Count; // var oldCount = args.OldItems == null ? 0 : args.OldItems.Count; // Console.WriteLine("{0:X4} ColChange={1} NewCnt={2} OldCnt={3} NewIdx={4} OldIdx={5}", // GetHashCode(), args.Action, newCount, oldCount, // args.NewStartingIndex, args.OldStartingIndex); //}; //((INotifyPropertyChanged)itemsSource).PropertyChanged += (sender, args) => //{ // Console.WriteLine("{0:X4} PropChange {1}", GetHashCode(), args.PropertyName); //}; ItemsSource = itemsSource; _securities = new ConvertibleObservableCollection <Security, SecurityItem>(new ThreadSafeObservableCollection <SecurityItem>(itemsSource), CreateItem); _selectedSecurities = new SelectedSecurityList(this); MarketDataProvider = ConfigManager.TryGetService <IMarketDataProvider>(); if (MarketDataProvider == null) { ConfigManager.ServiceRegistered += (t, s) => { if (MarketDataProvider != null || typeof(IMarketDataProvider) != t) { return; } MarketDataProvider = (IMarketDataProvider)s; itemsSource.ForEach(item => UpdateData(item.Security, item)); }; } }
/// <summary> /// Initializes a new instance of the <see cref="OrderGrid"/>. /// </summary> public OrderGrid() { InitializeComponent(); var itemsSource = new ObservableCollectionEx <OrderItem>(); ItemsSource = itemsSource; _orders = new ConvertibleObservableCollection <Order, OrderItem>(new ThreadSafeObservableCollection <OrderItem>(itemsSource), order => new OrderItem { Order = order, Condition = FormatCondition(order.Condition), }) { MaxCount = 100000 }; ContextMenu.Items.Add(new Separator()); ContextMenu.Items.Add(new MenuItem { Header = LocalizedStrings.Str1566, Command = RegisterOrderCommand, CommandTarget = this }); }
/// <summary> /// Создать <see cref="OrderGrid"/>. /// </summary> public OrderGrid() { InitializeComponent(); var itemsSource = new ObservableCollectionEx<OrderItem>(); ItemsSource = itemsSource; _orders = new ConvertibleObservableCollection<Order, OrderItem>(new ThreadSafeObservableCollection<OrderItem>(itemsSource), order => new OrderItem { Order = order, Condition = FormatCondition(order.Condition), }) { MaxCount = 100000 }; ContextMenu.Items.Add(new Separator()); ContextMenu.Items.Add(new MenuItem { Header = LocalizedStrings.Str1566, Command = RegisterOrderCommand, CommandTarget = this}); }