Beispiel #1
0
        private void OpenWindow(object obj)
        {
            dynamic item;

            if (SelectedOrder != null)
            {
                item = SelectedOrder;
            }
            else
            {
                item = SelectedStoporder;
            }
            switch (obj.ToString())
            {
            case "level2":
            {
                var view = new Level2();
                view.DataContext = new Level2ViewModel(item.Board, item.Seccode, view);
                view.Show();
                break;
            }

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

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

            case "orders":
                if (MainWindowViewModel.CheckIfWindowIsOpened(typeof(ClientOrders)))
                {
                    break;
                }
                new ClientOrders {
                    DataContext = MainWindowViewModel.ClientOrdersViewModel
                }.Show();
                break;

            case "stoporders":
                if (MainWindowViewModel.CheckIfWindowIsOpened(typeof(ClientStoporders)))
                {
                    break;
                }
                new ClientStoporders {
                    DataContext = MainWindowViewModel.ClientOrdersViewModel
                }.Show();
                break;
            }
        }
Beispiel #2
0
        public override void Next()
        {
            Hide();
            Level2 level2 = new Level2(GetScore(), GetLives(), SplashHold);

            level2.Closed += (s, args) => SplashHold.Close();
            level2.Show();
            Dispose();
        }
Beispiel #3
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;
            }
            }
        }
        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;
            }
            }
        }