private void SignaturePasswordExecute(object obj)
        {
            var certFile = CurrentProfile.PdfSettings.Signature.CertificateFile;

            if (!_file.Exists(certFile))
            {
                ShowCertFileMessage();
                return;
            }

            var signaturePasswordInteraction = new SignaturePasswordInteraction(PasswordMiddleButton.Remove, certFile);

            signaturePasswordInteraction.Password = CurrentProfile.PdfSettings.Signature.SignaturePassword;

            _interactionRequest.Raise(signaturePasswordInteraction, interaction =>
            {
                if (interaction.Result == PasswordResult.StorePassword)
                {
                    CurrentProfile.PdfSettings.Signature.SignaturePassword = interaction.Password;
                }
                else if (interaction.Result == PasswordResult.RemovePassword)
                {
                    CurrentProfile.PdfSettings.Signature.SignaturePassword = "";
                }
            });
        }
        private void DisplayNoClientFoundMessage()
        {
            var caption = Translation.CheckMailClient;
            var message = Translation.NoMapiClientFound;

            var interaction = new MessageInteraction(message, caption, MessageOptions.OK, MessageIcon.Warning);

            _interactionRequest.Raise(interaction);
        }
        public void Execute(object parameter)
        {
            var titleReplacement = new TitleReplacement();
            var editTitleReplacementInteraction = new TitleReplacementEditInteraction(titleReplacement);

            _interactionRequest.Raise(editTitleReplacementInteraction, AddInteractionCallback);
        }
Пример #4
0
        public override void Execute(object parameter)
        {
            _currentAccount = parameter as DropboxAccount;
            if (_currentAccount == null)
            {
                return;
            }

            _usedInProfilesList = _profiles.Where(p => p.DropboxSettings.AccountId.Equals(_currentAccount.AccountId)).ToList();

            var title = Translation.RemoveDropboxAccount;

            var messageSb = new StringBuilder();

            messageSb.AppendLine(_currentAccount.AccountInfo);
            messageSb.AppendLine(Translation.SureYouWantToDeleteAccount);

            if (_usedInProfilesList.Count > 0)
            {
                messageSb.AppendLine();
                messageSb.AppendLine(Translation.GetAccountIsUsedInFollowingMessage(_usedInProfilesList.Count));
                messageSb.AppendLine();
                foreach (var profile in _usedInProfilesList)
                {
                    messageSb.AppendLine(profile.Name);
                }
                messageSb.AppendLine();
                messageSb.AppendLine(Translation.GetDropboxGetsDisabledMessage(_usedInProfilesList.Count));
            }
            var message     = messageSb.ToString();
            var icon        = _usedInProfilesList.Count > 0 ? MessageIcon.Warning : MessageIcon.Question;
            var interaction = new MessageInteraction(message, title, MessageOptions.YesNo, icon);

            _interactionRequest.Raise(interaction, DeleteAccountCallback);
        }
Пример #5
0
        public override void Execute(object obj)
        {
            var currentRegion = _regionHelper.CurrentRegionName;
            MessageInteraction interaction = null;

            if (currentRegion == MainRegionViewNames.SettingsView)
            {
                var currentSettings = _currentSettingsProvider.Settings;
                var result          = _appSettingsChecker.CheckDefaultViewers(currentSettings.ApplicationSettings);
                var resultDict      = new ActionResultDict();
                resultDict.Add(Translation.DefaultViewer, result);
                interaction = DetermineInteraction(resultDict, settingsChanged: false);
            }
            else if (currentRegion == MainRegionViewNames.ProfilesView)
            {
                var currentSettings = _currentSettingsProvider.Settings;
                var resultDict      = _profileChecker.CheckProfileList(currentSettings.ConversionProfiles, currentSettings.ApplicationSettings.Accounts);
                var settingsChanged = _settingsChanged.HaveChanged();
                interaction = DetermineInteraction(resultDict, settingsChanged);
            }

            if (interaction != null)
            {
                _interactionRequest.Raise(interaction, ResolveInteractionResult);
            }
            else
            {
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
            }
        }
Пример #6
0
        private void StoreLicenseInLmCommandExecute(object obj)
        {
            var success = _uacAssistant.StoreLicenseForAllUsers(Interaction.LicenseServerCode, Interaction.LicenseKey);

            if (success)
            {
                var text        = Translation.StoreForAllUsersSuccessful;
                var interaction = new MessageInteraction(text, Title, MessageOptions.OK, MessageIcon.PDFCreator);
                _interactionRequest.Raise(interaction);
            }
            else
            {
                var text        = Translation.StoreForAllUsersFailed;
                var interaction = new MessageInteraction(text, Title, MessageOptions.OK, MessageIcon.Error);
                _interactionRequest.Raise(interaction);
            }
            FinishInteraction();
        }
Пример #7
0
        private bool FilePathShortEnoughElseNotifyUser()
        {
            var filePath = _pathSafe.Combine(OutputFolder, OutputFilename);

            if (filePath.Length < _pathUtil.MAX_PATH)
            {
                return(true);
            }

            var title = Translation.FilePathTooLongTitle.ToUpper(CultureInfo.CurrentCulture);
            var text  = Translation.FormatFilePathTooLongDescription(_pathUtil.MAX_PATH);

            var interaction = new MessageInteraction(text, title, MessageOptions.OK, MessageIcon.Exclamation);

            _interactionRequest.Raise(interaction);

            return(false);
        }
Пример #8
0
        public override void Execute(object parameter)
        {
            var newAccount = new FtpAccount();

            newAccount.AccountId = Guid.NewGuid().ToString();

            var interaction = new FtpAccountInteraction(newAccount, Translation.AddFtpAccount);

            _interactionRequest.Raise(interaction, AddFtpAccountCallback);
        }
        private void SecurityPasswordExecute(object obj)
        {
            var askUserPassword = CurrentProfile.PdfSettings.Security.RequireUserPassword;

            var interaction = new EncryptionPasswordInteraction(false, true, askUserPassword);

            interaction.OwnerPassword = CurrentProfile.PdfSettings.Security.OwnerPassword;
            interaction.UserPassword  = CurrentProfile.PdfSettings.Security.UserPassword;

            _interactionRequest.Raise(interaction, securityPasswordsCallback);
        }
Пример #10
0
        public override void Execute(object parameter)
        {
            var interaction = new DropboxAccountInteraction();

            interaction.Result = DropboxAccountInteractionResult.UserCanceled; //required as default for [X]-Button
            _interactionInvoker.Invoke(interaction);

            switch (interaction.Result)
            {
            case DropboxAccountInteractionResult.Success:
                break;

            case DropboxAccountInteractionResult.AccesTokenParsingError:
                var parseErrorMessageInteraction = new MessageInteraction(Translation.DropboxAccountSeverResponseErrorMessage, Translation.AddDropboxAccount, MessageOptions.OK, MessageIcon.Warning);
                _interactionRequest.Raise(parseErrorMessageInteraction, IsDoneWithErrorCallback);
                return;

            case DropboxAccountInteractionResult.Error:
                var errorMessageInteraction = new MessageInteraction(Translation.DropboxAccountCreationErrorMessage, Translation.AddDropboxAccount, MessageOptions.OK, MessageIcon.Warning);
                _interactionRequest.Raise(errorMessageInteraction, IsDoneWithErrorCallback);
                return;

            case DropboxAccountInteractionResult.UserCanceled:
            default:
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel));
                return;
            }

            var newAccount = interaction.DropboxAccount;

            var accountWithSameID = _droboxAccounts.FirstOrDefault(a => a.AccountId == newAccount.AccountId);

            if (accountWithSameID != null)
            {
                _droboxAccounts.Remove(accountWithSameID);
            }

            _droboxAccounts.Add(newAccount);

            IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
        }
Пример #11
0
        private bool TrySetJobPasswords(Job job, ConversionProfile profile)
        {
            var smtpAccount = job.Accounts.GetSmtpAccount(profile);

            if (smtpAccount == null)
            {
                var message = new MessageInteraction(_translation.NoAccount, "PDFCreator", MessageOptions.OK, MessageIcon.Error);
                _interactionRequest.Raise(message);
                return(false);
            }

            job.Passwords.SmtpPassword = smtpAccount.Password;

            if (!string.IsNullOrWhiteSpace(job.Passwords.SmtpPassword))
            {
                return(true);
            }

            var sb = new StringBuilder();

            sb.AppendLine(_translation.RecipientsLabel);
            sb.AppendLine(profile.EmailSmtpSettings.Recipients);

            var title       = _translation.SetSmtpServerPassword;
            var description = _translation.SmtpServerPasswordLabel;

            var interaction = new PasswordOverlayInteraction(PasswordMiddleButton.None, title, description, false);

            interaction.IntroText = sb.ToString();

            // TODO: Can this be done with IInteractionRequest? (it's hard to wait for the response!)
            _interactionInvoker.Invoke(interaction);

            if (interaction.Result != PasswordResult.StorePassword)
            {
                return(false);
            }

            job.Passwords.SmtpPassword = interaction.Password;
            return(true);
        }
 public override void Execute(object parameter)
 {
     if (!_settingsProvider.Settings.Equals(_mainSettingsProvider.Settings))
     {
         var interaction = new ValidateContinueWithSavingInteraction(Translation.Description, Translation.Title);
         _interactionRequest.Raise(interaction, ResolveInteractionResult);
     }
     else
     {
         IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
     }
 }
        private void DeleteFilesWithQuery()
        {
            const int maxDisplayFiles = 5;
            var       title           = Translation.GetDeleteFilesTitle(_historicFiles.Count);
            var       message         = Translation.GetAreYouSureYouWantToDeleteFilesMessage(_historicFiles.Count);

            foreach (var historicFile in _historicFiles.Take(maxDisplayFiles))
            {
                message += "\r\n" + historicFile.Path;
            }

            var remainingFiles = _historicFiles.Skip(maxDisplayFiles).Count();

            if (remainingFiles > 0)
            {
                message += "\r\n" + Translation.GetAndXMoreMessage(remainingFiles);
            }

            var interaction = new MessageInteraction(message, title, MessageOptions.YesNo, MessageIcon.Question);

            _interactionRequest.Raise(interaction, DeleteFilesCallback);
        }
Пример #14
0
        private bool TrySetJobPasswords(Job job, ConversionProfile profile)
        {
            var smtpAccount = job.Accounts.GetSmtpAccount(profile);

            if (smtpAccount == null)
            {
                var message = new MessageInteraction(_translation.NoAccount, "PDFCreator", MessageOptions.OK, MessageIcon.Error);
                _interactionRequest.Raise(message);
                return(false);
            }

            job.Passwords.SmtpPassword = smtpAccount.Password;

            if (!string.IsNullOrWhiteSpace(job.Passwords.SmtpPassword))
            {
                return(true);
            }

            var recipientsString = GetRecipientsString(job.Profile.EmailSmtpSettings, job.TokenReplacer);

            var title       = _translation.SetSmtpServerPassword;
            var description = _translation.SmtpServerPasswordLabel;

            var interaction = new PasswordOverlayInteraction(PasswordMiddleButton.None, title, description, false);

            interaction.IntroText = recipientsString;

            // TODO:Use IInteractionRequest
            _interactionInvoker.Invoke(interaction);

            if (interaction.Result != PasswordResult.StorePassword)
            {
                return(false);
            }

            job.Passwords.SmtpPassword = interaction.Password;
            return(true);
        }
Пример #15
0
        public override void Execute(object obj)
        {
            var result      = EvaluateRelevantSettings();
            var interaction = DetermineInteraction(result);

            if (interaction != null)
            {
                _interactionRequest.Raise(interaction, ResolveInteractionResult);
            }
            else
            {
                RaiseIsDone(ResponseStatus.Success);
            }
        }
Пример #16
0
        public void Execute(object parameter)
        {
            var profileCheckResult = _profileChecker.ProfileCheckDict(_currentSettingsProvider.Profiles, _currentSettingsProvider.Settings.ApplicationSettings.Accounts);

            if (!profileCheckResult)
            {
                var interaction = new ProfileProblemsInteraction(profileCheckResult);
                _interactionRequest.Raise(interaction, MessageInteractionCompleted);
            }
            else
            {
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
            }
        }
Пример #17
0
        private void RestoreDefaultSettingsExecute(object obj)
        {
            var title              = Translation.RestoreDefaultSettingsTitle;
            var message            = Translation.RestoreDefaultSettingsMessage;
            var messageInteraction = new MessageInteraction(message, title, MessageOptions.YesNo, MessageIcon.Question);

            _request.Raise(messageInteraction, interaction =>
            {
                if (messageInteraction.Response == MessageResponse.Yes)
                {
                    var profileBuilder  = new DefaultSettingsBuilder();
                    var defaultSettings = profileBuilder.CreateDefaultSettings(SettingsProvider.Settings);
                    ApplySettingsProcedure(defaultSettings);
                }
            });
        }
Пример #18
0
        private void EditMailTextExecute(object obj)
        {
            var interaction = new EditEmailTextInteraction(EmailSmtpSettings.Subject, EmailSmtpSettings.Content, EmailSmtpSettings.AddSignature, EmailSmtpSettings.Html);

            _interactionRequest.Raise(interaction, EditEmailTextCallback);

            if (!interaction.Success)
            {
                return;
            }

            EmailSmtpSettings.AddSignature = interaction.AddSignature;
            EmailSmtpSettings.Content      = interaction.Content;
            EmailSmtpSettings.Subject      = interaction.Subject;
            EmailSmtpSettings.Html         = interaction.Html;
        }
Пример #19
0
        public override void Execute(object parameter)
        {
            _currentAccount = parameter as SmtpAccount;
            if (_currentAccount == null)
            {
                return;
            }
            if (!SmtpAccounts.Contains(_currentAccount))
            {
                return;
            }

            var interaction = new SmtpAccountInteraction(_currentAccount.Copy(), Translation.EditSmtpAccount);

            _interactionRequest.Raise(interaction, UpdateSmtpAccountsCallback);
        }
Пример #20
0
        private void RaisePasswordOverlayInteraction(JobLoginFailedEventArgs args, ManualResetEventSlim interactionFinishedEvent)
        {
            var invalidPasswordMessage = _passwordOverlayTranslation.FormatInvalidPasswordMessage(args.ActionDisplayName);
            var interaction            = new PasswordOverlayInteraction(PasswordMiddleButton.None, _passwordOverlayTranslation.ReenterPassword, invalidPasswordMessage, false);

            _interactionRequest.Raise(interaction, delegate(PasswordOverlayInteraction overlayInteraction)
            {
                if (overlayInteraction.Result == PasswordResult.StorePassword)
                {
                    args.ContinueAction(interaction.Password);
                }
                else
                {
                    args.AbortAction();
                }
                interactionFinishedEvent.Set();
            });
        }
        public override void Execute(object parameter)
        {
            _currentAccount = parameter as HttpAccount;
            if (_currentAccount == null)
            {
                return;
            }

            var httpAccounts = _currentSettingsProvider.Settings.ApplicationSettings.Accounts.HttpAccounts;

            if (!httpAccounts.Contains(_currentAccount))
            {
                return;
            }

            var interaction = new HttpAccountInteraction(_currentAccount.Copy(), Translation.EditHttpAccount);

            _interactionRequest.Raise(interaction, UpdateHttpAccountsCallback);
        }
        public override async void Execute(object parameter)
        {
            var newAccount = new DropboxAccount();

            try
            {
                var userInfo = await _dropboxUserInfoManager.GetDropboxUserInfo();

                if (userInfo.AccessToken != null)
                {
                    newAccount.AccountId   = userInfo.AccountId;
                    newAccount.AccessToken = userInfo.AccessToken;
                    newAccount.AccountInfo = userInfo.AccountInfo;
                }
            }
            catch (DropboxAccessDeniedException)
            {
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel));
                return;
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "An error occured trying to add Dropbox account.");
                var errorMessageInteraction = new MessageInteraction(Translation.DropboxAccountCreationErrorMessage, Translation.AddDropboxAccount, MessageOptions.OK, MessageIcon.Warning);
                _interactionRequest.Raise(errorMessageInteraction, IsDoneWithErrorCallback);
                return;
            }

            var accountWithSameId = _accountsProvider.Settings.DropboxAccounts.FirstOrDefault(a => a.AccountId == newAccount.AccountId);

            if (accountWithSameId != null)
            {
                _accountsProvider.Settings.DropboxAccounts.Remove(accountWithSameId);
            }

            _accountsProvider.Settings.DropboxAccounts.Add(newAccount);

            IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
        }
Пример #23
0
        private bool CheckIfFileExistsElseNotifyUser()
        {
            var filePath = _pathSafe.Combine(OutputFolder, OutputFilename);

            //Do not inform user, if SaveFileDialog already did
            if (filePath == _latestDialogFilePath)
            {
                return(true);
            }

            if (!_file.Exists(filePath))
            {
                return(true);
            }

            var title = Translation.ConfirmSaveAs.ToUpper(CultureInfo.CurrentCulture);
            var text  = Translation.GetFileAlreadyExists(filePath);

            var interaction = new MessageInteraction(text, title, MessageOptions.YesNo, MessageIcon.Exclamation);

            _interactionRequest.Raise(interaction, NotifyFileExistsCallback);

            return(false);
        }
 private void LaunchOverlay(MessageInteraction interaction)
 {
     _interactionRequest.Raise(interaction);
 }
Пример #25
0
        private void EditEmailTextExecute(object obj)
        {
            var interaction = new EditEmailTextInteraction(EmailClientSettings.Subject, EmailClientSettings.Content, EmailClientSettings.AddSignature, EmailClientSettings.Html);

            _interactionRequest.Raise(interaction, EditEmailTextCallback);
        }