/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel( SettingsViewModel settingsViewModel, MarketsViewModel marketsViewModel, AccountsViewModel accountsViewModel, StrategiesViewModel strategiesViewModel, ResearchViewModel researchViewModel, LogViewModel logViewModel) { SettingsViewModel = settingsViewModel; MarketsViewModel = marketsViewModel; AccountsViewModel = accountsViewModel; StrategiesViewModel = strategiesViewModel; ResearchViewModel = researchViewModel; LogViewModel = logViewModel; SaveCommand = new RelayCommand(() => SaveConfig(), () => !IsBusy); SettingsCommand = new RelayCommand(async() => await DoSettings(), () => !IsBusy); ExitCommand = new RelayCommand <Window>(window => DoExit(window), window => !IsBusy); Messenger.Default.Register <NotificationMessage>(this, OnStatusMessage); // Set working directory string appData = MainService.GetAppDataFolder(); Directory.SetCurrentDirectory(appData); // Async initialize without blocking UI _initializer = Initialize(); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel( SettingsViewModel settingsViewModel, MarketsViewModel marketsViewModel, AccountsViewModel accountsViewModel, StrategiesViewModel strategiesViewModel, ResearchViewModel researchViewModel, LogViewModel logViewModel) { SettingsViewModel = settingsViewModel; MarketsViewModel = marketsViewModel; AccountsViewModel = accountsViewModel; StrategiesViewModel = strategiesViewModel; ResearchViewModel = researchViewModel; LogViewModel = logViewModel; SaveCommand = new RelayCommand(() => SaveAll(), () => !IsBusy); SettingsCommand = new RelayCommand(() => DoSettings(), () => !IsBusy); ExitCommand = new RelayCommand <Window>(window => DoExit(window), window => !IsBusy); Messenger.Default.Register <NotificationMessage>(this, OnStatusMessage); Config.Set("map-file-provider", "QuantConnect.Data.Auxiliary.LocalDiskMapFileProvider"); ProviderFactory.RegisterProviders(); // Initialize data folders MainService.InitializeFolders(); // Set working directory string appData = MainService.GetAppDataFolder(); Directory.SetCurrentDirectory(appData); // Read configuration _ = ReadConfigAsync(appData); }
public AccountViewModel(AccountsViewModel accountsViewModel, AccountModel accountModel) { _parent = accountsViewModel; Model = accountModel; ActiveCommand = new RelayCommand(() => DoActiveCommand(Model.Active), true); StartCommand = new RelayCommand(async() => await DoConnectAsync().ConfigureAwait(true), () => !Active); StopCommand = new RelayCommand(async() => await DoDisconnectAsync().ConfigureAwait(true), () => Active); DeleteCommand = new RelayCommand(() => _parent?.DoDeleteAccount(this), () => !Active); DataFromModel(); }