private void PrepInstaller() { DisableButtons(); installer = new AppxInstaller(GetResourcePath(info.appxBundlePath), GetResourcePath(info.certPath), GetResourcePath(info.dependenciesPath)); installer.ProgressChanged += OnInstallProgressChanged; installer.StateChanged += OnInstallStateChanged; installer.InstallationComplete += OnInstallComplete; }
private async void OnInstallStateChanged(AppxInstaller sender, StateChangedEventArgs args) { if (args.STATE == AppxInstallerState.ERROR) { UpdateProgressInvoke(100, "Installation failed with a fatal error: " + (args.EXCEPTION is null ? "null" : args.EXCEPTION.Message)); Dispatcher.Invoke(() => EnableButtons()); } else if (args.STATE == AppxInstallerState.SUCCESS && Dispatcher.Invoke(() => startOnceDone_chbx.IsChecked) == true) { await LauchUwpxAsync(); } }
private void OnInstallComplete(AppxInstaller sender, InstallationCompleteEventArgs args) { string msg; if (args.RESULT is null) { msg = "Installation failed with a fatal error!"; } else if (args.RESULT.IsRegistered) { msg = "Done"; } else { msg = "Installation failed with: " + args.RESULT.ErrorText; } UpdateProgressInvoke(100, msg); Dispatcher.Invoke(() => EnableButtons()); }
private void OnInstallProgressChanged(AppxInstaller sender, ProgressChangedEventArgs args) { UpdateProgressInvoke(args.PROGRESS.percentage, args.PROGRESS.state.ToString()); }