Exemple #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();
        }
Exemple #2
0
 void FreeFilePresenter()
 {
     if (filePresenter == null)
     {
         return;
     }
     filePresenter.Dispose();
     filePresenter = null;
 }