public AccountMgrVM(IEventAggregator evtAgg, ServerAddressRepoVM serverAddrRepoVm) { evtAgg.GetEvent <AppShutDown>().Subscribe(OnAppShutDown); evtAgg.GetEvent <AccountChangedEvent>().Subscribe(OnCertainAccountChanged); evtAgg.GetEvent <CloseMlOrderEvent>().Subscribe(OnClosePosition); evtAgg.GetEvent <CancelOrderEvent>().Subscribe(OnCancelOrder); _addAccountCommand = new DelegateCommand(OnAddAccount); _editAccountCommand = new DelegateCommand <XamDataTree>(OnEditAccount); _removeAccountCommand = new DelegateCommand <XamDataTree>(OnRemoveAccount); //_accounts.Add(new AccountVM() { BrokerId="0240", InvestorId="0240050008", Password="******" }); // load server address list ServerAddrRepoVM = serverAddrRepoVm; serverAddrRepoVm.LoadServerList(); Load(); }
public AccountMgrVM(IEventAggregator evtAgg, ServerAddressRepoVM serverAddrRepoVm) { evtAgg.GetEvent <AppShutDown>().Subscribe(OnAppShutDown); evtAgg.GetEvent <AccountChangedEvent>().Subscribe(OnCertainAccountChanged); evtAgg.GetEvent <CloseMlOrderEvent>().Subscribe(OnClosePosition); evtAgg.GetEvent <CancelOrderEvent>().Subscribe(OnCancelOrder); _addAccountCommand = new DelegateCommand(OnAddAccount); _editAccountCommand = new DelegateCommand <XamDataTree>(OnEditAccount); _removeAccountCommand = new DelegateCommand <XamDataTree>(OnRemoveAccount); StartAccountCommand = new DelegateCommand(OnStartAllAccount); StopAccountCommand = new DelegateCommand(OnStopAllAccount); // load server address list ServerAddrRepoVM = serverAddrRepoVm; serverAddrRepoVm.LoadServerList(); Load(); }
public AccountVM() { AddPortfolioCommand = new DelegateCommand <AccountVM>(OnAddPortfolio); ConnectCommand = new DelegateCommand <AccountVM>(OnConnectHost); DisconnectCommand = new DelegateCommand <AccountVM>(OnDisconnectHost); RemovePortfolioCommand = new DelegateCommand <XamDataGrid>(OnRemovePortfolio); DetachCommand = new DelegateCommand <AccountVM>(OnDetachHost); _host = new NativeHost(); EventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); AddressRepo = ServiceLocator.Current.GetInstance <ServerAddressRepoVM>(); _client = new Client(); _client.OnError += new Action <string>(_client_OnError); _client.OnQuoteReceived += new Action <entity.Quote>(_client_OnQuoteReceived); _client.OnPortfolioItemUpdated += new Action <entity.PortfolioItem>(_client_OnPortfolioItemUpdated); _client.OnMultiLegOrderUpdated += new Action <trade.MultiLegOrder>(_client_OnMultiLegOrderUpdated); _client.OnLegOrderUpdated += new Action <string, string, string, trade.Order>(_client_OnLegOrderUpdated); _client.OnTradeUpdated += new Action <trade.Trade>(_client_OnTradeUpdated); _client.OnPositionDetialReturn += new Action <trade.PositionDetailInfo>(_client_OnPositionDetialReturn); }
public ServerAddrConfigDlg(ServerAddressRepoVM viewModel) { InitializeComponent(); this.DataContext = viewModel; }