Ejemplo n.º 1
0
        public void HandleOpenFile(string filePath)
        {
            FreePassphraseViewController();
            FreeDecryptionViewController();
            FreeFilePresenter();
            FreeFeedbackViewController();

            passphraseController     = new PassphraseController(filePath);
            decryptionViewController = new DecryptionViewController(filePath);
            filePresenter            = new FilePresenter();

            passphraseController.Done          += decryptionViewController.Decrypt;
            passphraseController.Cancelled     += FreeViewControllers;
            decryptionViewController.Succeeded += targetFileName => {
                FreeViewControllers();

                if (fileListingViewController != null)
                {
                    appViewController.DismissViewController(true, (NSAction) delegate {
                        FreeFileListingViewController();
                        filePresenter.Present(targetFileName, appViewController);
                    });
                    return;
                }
                filePresenter.Present(targetFileName, appViewController);
            };
            decryptionViewController.Failed += passphraseController.AskForPassword;
            filePresenter.Done += delegate {
                FreeViewControllers();
                FreeFilePresenter();
            };

            passphraseController.AskForPassword();
        }
Ejemplo n.º 2
0
 void FreePassphraseViewController()
 {
     if (passphraseController == null)
     {
         return;
     }
     passphraseController.Dispose();
     passphraseController = null;
 }