private void BuildCommand_Execute() { if (Apk == null) { return; } if (!Apk.HasJava()) { MessBox.ShowDial(StringResources.JavaNotFoundError, StringResources.ErrorLower); return; } ClearVisLog(); bool success = false; var errors = new List <Error>(); LoadingWindow.ShowWindow( beforeStarting: () => IsBusy = true, threadActions: source => success = Apk.Compile(out errors), finishActions: () => { IsBusy = false; VisLog(LogLine); VisLog(success ? StringResources.Finished : StringResources.ErrorWhileCompiling); VisLog(LogLine); if (GlobalVariables.AppSettings.ShowNotifications) { NotificationService.Instance.ShowMessage(StringResources.CompilationFinished); } if (!success && errors.Any(error => error.Type != Error.ErrorType.None)) { if (MessBox.ShowDial("Обнаружены ошибки. Попробовать исправить?", "", MessBox.MessageButtons.Yes, MessBox.MessageButtons.No) == MessBox.MessageButtons.Yes) { Apktools.FixErrors(errors); BuildCommand_Execute(); } } else { VisLog(StringResources.FileIsSituatedIn + " " + Apk.NewApk); } RaiseCommandsCanExecute(); }, cancelVisibility: Visibility.Collapsed, ownerWindow: _window ); }
private void SignCommand_Execute() { if (Apk?.NewApk == null) { return; } if (!Apk.HasJava()) { MessBox.ShowDial(StringResources.JavaNotFoundError, StringResources.ErrorLower); return; } bool success = false; LoadingWindow.ShowWindow( beforeStarting: () => IsBusy = true, threadActions: source => success = Apk.Sign(), finishActions: () => { IsBusy = false; VisLog(LogLine); VisLog(success ? StringResources.Finished : StringResources.ErrorWhileSigning); if (success) { string message = $"{StringResources.FileIsSituatedIn} {Apk.SignedApk}"; VisLog(message); string dir = Path.GetDirectoryName(Apk.SignedApk); if (dir != null && MessBox.ShowDial(message, StringResources.Finished, MessBox.MessageButtons.OK, StringResources.Open) == StringResources.Open) { Process.Start(dir); } } }, cancelVisibility: Visibility.Collapsed, ownerWindow: _window ); VisLog(string.Format("{0}{1}Signing...{1}{0}", LogLine, Environment.NewLine)); }