Esempio n. 1
0
        /// <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();
        }
Esempio n. 2
0
        /// <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);
        }