예제 #1
0
        //open a window which requires security data
        private void ShowWindow(string board, string seccode, string window)
        {
            switch (window)
            {
            case "level2":
            {
                var view = new Level2();
                view.DataContext = new Level2ViewModel(board, seccode, view);
                view.Show();
                break;
            }

            case "logbook":
            {
                var view = new LogBook();
                view.DataContext = new LogBookViewModel(board, seccode, view);
                view.Show();
                break;
            }

            case "allTrades":
            {
                var view = new AllTrades();
                view.DataContext = new AllTradesViewModel(board, seccode, view);
                view.Show();
                break;
            }

            case "allTradesSimple":
            {
                var view = new AllTradesSimple();
                view.DataContext = new AllTradesSimpleViewModel(board, seccode, view);
                view.Show();
                break;
            }

            case "allTradesCounter":
            {
                new AllTradesCounterWindow {
                    DataContext = new AllTradesCounterViewModel(board, seccode)
                }.Show();
                break;
            }

            case "counterLMT":
            {
                new AllTradesCounterWindow {
                    DataContext = new AllTradesCounterViewModel(board, seccode, true)
                }.Show();
                break;
            }

            case "scichart":
            {
                var view = new SciChartWindow();
                view.DataContext = new SciChartViewModel(board, seccode, view);
                view.Show();
                break;
            }

            case "spread":
            {
                new Spread {
                    DataContext = new SpreadViewModel(board, seccode)
                }.Show();
                break;
            }
            }
        }
예제 #2
0
        private void ContextMenuAction(object param)
        {
            if (SelectedItem == null)
            {
                return;
            }
            var str = param.ToString().Split('/');

            switch (str[0])
            {
            case "add":
                AddToWatchlist();
                break;

            case "Logbook":
            {
                var view = new LogBook();
                view.DataContext = new LogBookViewModel(SelectedItem.Board, SelectedItem.Seccode, view);
                view.Show();
                break;
            }

            case "Level2":
            {
                var view = new Level2();
                view.DataContext = new Level2ViewModel(SelectedItem.Board, SelectedItem.Seccode, view);
                view.Show();
                break;
            }

            case "AllTrades":
            {
                var view = new AllTradesSimple();
                view.DataContext = new AllTradesSimpleViewModel(SelectedItem.Board, SelectedItem.Seccode, view);
                view.Show();
                break;
            }

            case "AllTradesPro":
            {
                var view = new AllTrades();
                view.DataContext = new AllTradesViewModel(SelectedItem.Board, SelectedItem.Seccode, view);
                view.Show();
                break;
            }

            case "TradesCounter":
            {
                new AllTradesCounterWindow {
                    DataContext = new AllTradesCounterViewModel(SelectedItem.Board, SelectedItem.Seccode)
                }.Show();
                break;
            }

            case "Chart":
            {
                var view = new SciChartWindow();
                view.DataContext = new SciChartViewModel(SelectedItem.Board, SelectedItem.Seccode, view);
                view.Show();
                break;
            }

            case "NewOrder":
            {
                new NewOrder
                {
                    DataContext = new NewOrderViewModel
                    {
                        Board   = SelectedItem.Board,
                        Seccode = SelectedItem.Seccode
                    }
                }.Show();
                break;
            }

            case "NewStoporder":
            {
                new NewStopOrder
                {
                    DataContext = new NewStopOrderViewModel
                    {
                        Board   = SelectedItem.Board,
                        Seccode = SelectedItem.Seccode
                    }
                }.Show();
                break;
            }

            case "Cart":
                Application.Current.Dispatcher.Invoke(
                    () => ((MainWindowViewModel)Application.Current.MainWindow.DataContext).CartViewModel.Orders
                    .Add(new CartItem
                {
                    Board   = SelectedItem.Board,
                    Seccode = SelectedItem.Seccode,
                    Client  = SelectClient(SelectedItem.Board)[0],
                    Union   = SelectClient(SelectedItem.Board)[1],
                    Mkt     = true
                }));
                break;

            case "Spread":
            {
                new Spread
                {
                    DataContext = new SpreadViewModel(SelectedItem.Board, SelectedItem.Seccode)
                }.Show();
                break;
            }

            case "FastOrder":
            {
                var view = new FastOrder();
                view.DataContext = new FastOrderViewModel(SelectedItem.Board, SelectedItem.Seccode, view);
                view.Show();
                break;
            }
            }
        }