protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (this.ShutdownMode != ShutdownMode.OnExplicitShutdown) { this.ShutdownMode = ShutdownMode.OnExplicitShutdown; } var languageSettings = new LanguageSettings(); var chooseLanguageView = new ChooseLanguageView() { DataContext = languageSettings }; var result = chooseLanguageView.ShowDialog(); if (result == true) { bool dokanInstalled = DetectDokan.DokanDriverUtility.QueryVersion(out uint dokanVersion); if (!dokanInstalled || dokanVersion < 0x190) { DokanDriverState driverState = new DokanDriverState(languageSettings.SelectedLanguage); var installDokanView = new InstallDokanView(languageSettings.SelectedLanguage, dokanVersion) { DataContext = driverState }; installDokanView.Left = chooseLanguageView.Left; installDokanView.Top = chooseLanguageView.Top; installDokanView.WindowStartupLocation = WindowStartupLocation.Manual; result = installDokanView.ShowDialog(); if (result == true) { MessageBox.Show((driverState.SelectedActionIndex == 1) ? "Action: Install driver" : "Action: Do NOT install driver", "Result", MessageBoxButton.OK); } else { MessageBox.Show("Action: Cancelled", "Result", MessageBoxButton.OK); } } else { MessageBox.Show("Dokan driver is already installed", "Result", MessageBoxButton.OK); } } else { MessageBox.Show("Action: Cancelled", "Result", MessageBoxButton.OK); } this.Shutdown(); }
/// <summary> /// Entry point that is called when the bootstrapper application is ready to run. /// </summary> protected override void Run() { var packageState = this.DetectMainPackage(); var launchAction = this.Command.Action; if (launchAction == LaunchAction.Install && packageState == PackageState.Present) { MessageBox.Show("Personal Cloud is already installed"); Engine.Quit(0); return; } if (launchAction == LaunchAction.Install) { var chooseLanguageView = new ChooseLanguageView() { DataContext = this }; var result = chooseLanguageView.ShowDialog(); if (result == true) { bool dokanInstalled = DokanDriverUtility.QueryVersion(out uint dokanVersion); if (!dokanInstalled || dokanVersion < 0x190) { Engine.StringVariables["InstallDokanDriver"] = "yes"; } } if (result == true) { Engine.StringVariables["ProductLanguage"] = $"{SelectedLanguage.LCID}"; Engine.Plan(launchAction); Engine.Apply(new WindowInteropHelper(chooseLanguageView).Handle); Dispatcher.CurrentDispatcher.VerifyAccess(); Dispatcher.Run(); } } Engine.Quit(0); }