public MainWindowViewModel(DeviceModel dm, MainWindow view) { _view = view; }
private async void Application_Startup(object sender, StartupEventArgs e) { var startTime = DateTime.UtcNow; ShowSplashScreen(); SetCurrentActivity("Initializing..."); if (Settings.Default.IsFirstRun) DoFirstRunActivities(); if (Settings.Default.CheckForUpdates) CheckForUpdates(); await InitializeAsync(); var endTime = DateTime.UtcNow; if (endTime - startTime < TimeSpan.FromSeconds(4)) { // Does it seem cruel to force startup to take four seconds? // Well, otherwise, in a best-case startup scenario, the splash screen is visible // for too short a time to fully perceive and the user may think they missed something // important when it flashes by SetCurrentActivity("Initializing..."); Thread.Sleep(endTime - startTime); } var mainWindow = new Views.MainWindow(); this.MainWindow = mainWindow; HideSplashScreen(); mainWindow.Show(); }