예제 #1
0
        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));
        }