Пример #1
0
        public ATOrderMediator(IATOrderRepository atOrderRepository,
                               IServerFacade serverFacade,
                               IClOrdIDGenerator clOrdIDGenerator)
        {
            _atOrderRepository = atOrderRepository;
            _serverFacade = serverFacade;
            _clOrdIDGenerator = clOrdIDGenerator;

            _serverFacade.OrderExecutionEvent += OnOrderExecutionEvent;
        }
Пример #2
0
        public ATOrderMediator(IATOrderRepository atOrderRepository,
                               IServerFacade serverFacade,
                               IClOrdIDGenerator clOrdIDGenerator)
        {
            _atOrderRepository = atOrderRepository;
            _serverFacade      = serverFacade;
            _clOrdIDGenerator  = clOrdIDGenerator;

            _serverFacade.OrderExecutionEvent += OnOrderExecutionEvent;
        }
Пример #3
0
        public OrderBookViewModel(IServerFacade serverFacade,
                                  IClOrdIDGenerator clOrdIDGenerator,
            IMessageSink messageSink)
        {
            _clOrdIDGenerator = clOrdIDGenerator;
            _messageSink = messageSink;
            _serverFacade = serverFacade;
            OrderStack = new ObservableCollection<OrderStackRow>();

            _serverFacade.OrderExecutionEvent += HandleOrderExecutionEvent;
            _serverFacade.LogoutEvent += OnLogout;
        }
Пример #4
0
        public OrderBookViewModel(IServerFacade serverFacade,
                                  IClOrdIDGenerator clOrdIDGenerator,
                                  IMessageSink messageSink)
        {
            _clOrdIDGenerator = clOrdIDGenerator;
            _messageSink      = messageSink;
            _serverFacade     = serverFacade;
            OrderStack        = new ObservableCollection <OrderStackRow>();

            _serverFacade.OrderExecutionEvent += HandleOrderExecutionEvent;
            _serverFacade.LogoutEvent         += OnLogout;
        }
Пример #5
0
        public void Run(
            string configFilepath,
            IFixStrategy strategy,
            IFixMessageGenerator messageGenerator,
            IMessageSink messageSink,
            IExecIDGenerator execIDGenerator,
            IClOrdIDGenerator clOrdIDGenerator)
        {
            _server = ServerFacadeFactory.CreateFixServer(configFilepath,
                                                          strategy,
                                                          execIDGenerator,
                                                          messageGenerator,
                                                          messageSink);

            var atOrderRepository = new ATOrderRepository();
            var atOrderMediator   = new ATOrderMediator(atOrderRepository,
                                                        _server,
                                                        clOrdIDGenerator);

            // Setup the data contexts for the child views in the main view
            // Ideally we'd do this in each view but due to the need to pass _app and the
            // message sink to the view models for expediency purposes we do it here
            var mainWindow = new MainWindow
            {
                ATOrderBook =
                {
                    DataContext = new ATOrderBookViewModel(_server, atOrderMediator)
                },
                OrderBook =
                {
                    DataContext = new OrderBookViewModel(_server, clOrdIDGenerator, messageSink)
                },
                ConnectionView = { DataContext = new ConnectionViewModel(_server, messageSink) }
            };

            // Set the main UI dispatcher
            SmartDispatcher.SetDispatcher(mainWindow.Dispatcher);

            // Send messages to the status bar
            messageSink.SetMessageSink(
                s =>
            {
                var vm = (ConnectionViewModel)mainWindow.ConnectionView.DataContext;
                SmartDispatcher.Invoke(() => vm.StatusMessage = s);
            });

            _server.Start();
            mainWindow.Show();
        }
Пример #6
0
        public void Run(
            string configFilepath,
            IFixStrategy strategy,
            IFixMessageGenerator messageGenerator,
            IMessageSink messageSink,
            IExecIDGenerator execIDGenerator,
            IClOrdIDGenerator clOrdIDGenerator)
        {
            _server = ServerFacadeFactory.CreateFixServer(configFilepath,
                                                          strategy,
                                                          execIDGenerator,
                                                          messageGenerator,
                                                          messageSink);

            var atOrderRepository = new ATOrderRepository();
            var atOrderMediator = new ATOrderMediator(atOrderRepository,
                                                      _server,
                                                      clOrdIDGenerator);

            // Setup the data contexts for the child views in the main view
            // Ideally we'd do this in each view but due to the need to pass _app and the
            // message sink to the view models for expediency purposes we do it here
            var mainWindow = new MainWindow
            {
                ATOrderBook =
                {
                    DataContext = new ATOrderBookViewModel(_server, atOrderMediator)
                },
                OrderBook =
                {
                    DataContext = new OrderBookViewModel(_server, clOrdIDGenerator, messageSink)
                },
                ConnectionView = { DataContext = new ConnectionViewModel(_server, messageSink) }
            };

            // Set the main UI dispatcher
            SmartDispatcher.SetDispatcher(mainWindow.Dispatcher);

            // Send messages to the status bar
            messageSink.SetMessageSink(
                s =>
                {
                    var vm = (ConnectionViewModel) mainWindow.ConnectionView.DataContext;
                    SmartDispatcher.Invoke(() => vm.StatusMessage = s);
                });

            _server.Start();
            mainWindow.Show();
        }