예제 #1
0
        public void Execute(object parameter)
        {
            var currentId       = CurrentSettingsProvider.SelectedProfile.Guid;
            var printerMappings = CurrentSettingsProvider.Settings.ApplicationSettings.PrinterMappings;

            _usedPrintersMappings = printerMappings.Where(pm => pm.ProfileGuid.Equals(currentId)).ToList();

            var title = Translation.RemoveProfile;

            var sb = new StringBuilder();

            sb.AppendLine(CurrentSettingsProvider.SelectedProfile.Name);
            sb.AppendLine(Translation.RemoveProfileForSure);
            if (_usedPrintersMappings.Count > 0)
            {
                sb.AppendLine();
                sb.AppendLine(Translation.GetProfileIsMappedToMessage(_usedPrintersMappings.Count));
                foreach (var pm in _usedPrintersMappings)
                {
                    sb.AppendLine(pm.PrinterName);
                }
                sb.AppendLine();
                sb.AppendLine(Translation.GetPrinterWillBeMappedToMessage(_usedPrintersMappings.Count));
            }
            var message     = sb.ToString();
            var icon        = _usedPrintersMappings.Count > 0 ? MessageIcon.Warning : MessageIcon.Question;
            var interaction = new MessageInteraction(message, title, MessageOptions.YesNo, icon);

            InteractionRequest.Raise(interaction, RemoveProfileCallback);
        }
        public void OnlineActivationCommand_CurrentEditionIsValid_LicenseCheckerActivationIsNotValid_DoNotSaveNewActivationAndDoNotUpdateEditionAndInformUser()
        {
            _activationHelper.Activation.Returns(new Activation());

            _expectedLicenseKey = "not empty";
            _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do(
                x =>
            {
                var inputInteraction       = x.Arg <InputInteraction>();
                inputInteraction.Success   = true;
                inputInteraction.InputText = _expectedLicenseKey;
            });
            MessageInteraction messageInteraction = null;

            _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(
                x => messageInteraction = x[0] as MessageInteraction);
            var viewModel             = BuildViewModel();
            var propertyChangedEvents = new List <string>();

            viewModel.PropertyChanged += (sender, args) => propertyChangedEvents.Add(args.PropertyName);

            viewModel.OnlineActivationCommand.Execute(null);

            viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout);
            _activationHelper.DidNotReceive().SaveActivation();
            Assert.AreEqual(ActivationFailedString, messageInteraction.Title);
            Assert.AreEqual(MessageOptions.OK, messageInteraction.Buttons);
            Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon);
        }
        public void OnlineActivationCommand_CurrentEditionIsValid_LicenseCheckerActivationIsValid_SaveNewActivationAndUpdateEditionAndStoreLicenseForAllUsersQuery()
        {
            _expectedLicenseKey = "not empty";
            _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do(
                x =>
            {
                ((InputInteraction)x[0]).Success   = true;
                ((InputInteraction)x[0]).InputText = _expectedLicenseKey;
            });
            var messageInteraction = new MessageInteraction("", "", MessageOptions.OKCancel, MessageIcon.None);

            _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(
                x => messageInteraction = x[0] as MessageInteraction);

            _activationHelper
            .When(x => x.ActivateWithoutSavingActivation(_expectedLicenseKey))
            .Do(x =>
            {
                _activationHelper.IsLicenseValid.Returns(true);
            });

            var viewModel             = BuildViewModel();
            var propertyChangedEvents = new List <string>();

            viewModel.PropertyChanged += (sender, args) => propertyChangedEvents.Add(args.PropertyName);

            viewModel.OnlineActivationCommand.Execute(null);

            var success = viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout);

            Assert.IsTrue(success);
            _interactionInvoker.Received().Invoke(Arg.Any <StoreLicenseForAllUsersInteraction>());
        }
        public void Execute_UserProceedsDelition_FilesCantBeDeleted_NotifyUser_IsDoneIsCalledWithSuccess()
        {
            MessageInteraction secondMessageInteraction = null;
            var count = 0;

            _unitTestInteractionRequest.RegisterInteractionHandler <MessageInteraction>(i =>
            {
                count++;
                i.Response = MessageResponse.Yes; //proceed deletion
                if (count == 2)
                {
                    secondMessageInteraction = i;
                }
            });

            MacroCommandIsDoneEventArgs calledArgs = null;

            _deleteHistoricFilesCommand.IsDone += (sender, args) => calledArgs = args;
            _file.When(f => f.Delete(Arg.Any <string>())).Throw <Exception>();

            _deleteHistoricFilesCommand.Execute(_historicFiles);

            Assert.NotNull(secondMessageInteraction, "Request did not raise Second MessageInteraction");

            Assert.AreEqual(_translation.ErrorDuringDeletionTitle, secondMessageInteraction.Title, "Interaction Title");
            var expectedMessage = _translation.GetCouldNotDeleteTheFollowingFilesMessage(_historicFiles.Count)
                                  + "\r\n" + File1 + "\r\n" + File2;

            Assert.AreEqual(expectedMessage, secondMessageInteraction.Text, "Interaction Text");
            Assert.AreEqual(MessageOptions.OK, secondMessageInteraction.Buttons);
            Assert.AreEqual(MessageIcon.Error, secondMessageInteraction.Icon);

            Assert.AreEqual(ResponseStatus.Success, calledArgs.ResponseStatus);
        }
        public void OnlineActivationCommand_CurrentEditionIsNotValid_LicenseCheckerActivationIsNotValid_UpdateEditionWithGivenKeyDoNotSaveNewEditionAndInformUser()
        {
            _activationHelper.Activation.Returns(new Activation());

            _expectedLicenseKey = "given-key";
            _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do(
                x =>
            {
                ((InputInteraction)x[0]).Success   = true;
                ((InputInteraction)x[0]).InputText = _expectedLicenseKey;
            });
            var messageInteraction = new MessageInteraction("", "", MessageOptions.OKCancel, MessageIcon.None);

            _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(
                x => messageInteraction = x.Arg <MessageInteraction>());
            _activationHelper.LicenseStatus.Returns(LicenseStatus.Error);

            var viewModel             = BuildViewModel();
            var propertyChangedEvents = new List <string>();

            viewModel.PropertyChanged += (sender, args) => propertyChangedEvents.Add(args.PropertyName);

            viewModel.OnlineActivationCommand.Execute(null);

            viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout);
            _activationHelper.DidNotReceive().SaveActivation();
            Assert.AreEqual(_expectedLicenseKey.Replace("-", ""), viewModel.Activation.Key, "Given key not set in updated license");

            Assert.AreEqual(ActivationFailedString, messageInteraction.Title);
            Assert.AreEqual(MessageOptions.OK, messageInteraction.Buttons);
            Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon);
        }
예제 #6
0
        public void OnlineActivationCommand_CurrentActivationIsValid_LicenseCheckerActivationIsValid_ShareLicenseForAllUsersDisabled__SaveLicenseAndInformUser()
        {
            _expectedLicenseKey = "not empty";
            _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do(
                x =>
            {
                ((InputInteraction)x[0]).Success   = true;
                ((InputInteraction)x[0]).InputText = _expectedLicenseKey;
            });

            _activationFromServer = BuildValidActivation(_expectedLicenseKey);

            var viewModel = BuildViewModel();

            viewModel.ShareLicenseForAllUsersEnabled = false; //Important for this test!!!!

            MessageInteraction messageInteraction = null;

            _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(
                x => messageInteraction = x[0] as MessageInteraction);
            viewModel.OnlineActivationCommand.Execute(null);

            viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout);

            _licenseChecker.Received().SaveActivation(_activationFromServer);
            _interactionInvoker.Received().Invoke(Arg.Any <MessageInteraction>());
            _interactionInvoker.DidNotReceive().Invoke(Arg.Any <StoreLicenseForAllUsersInteraction>());
            Assert.AreEqual(_translation.ActivationSuccessful, messageInteraction.Title);
            Assert.AreEqual(_translation.ActivationSuccessfulMessage, messageInteraction.Text);
            Assert.AreEqual(MessageOptions.OK, messageInteraction.Buttons);
            Assert.AreEqual(MessageIcon.PDFForge, messageInteraction.Icon);
        }
        private void DeleteFilesCallback(MessageInteraction interaction)
        {
            if (interaction.Response != MessageResponse.Yes)
            {
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel));
                return;
            }

            var notDeletedFiles = new List <HistoricFile>();

            foreach (var historicFile in _historicFiles)
            {
                try
                {
                    if (_file.Exists(historicFile.Path))
                    {
                        _file.Delete(historicFile.Path);
                    }
                }
                catch
                {
                    notDeletedFiles.Add(historicFile);
                }
            }

            if (notDeletedFiles.Count > 0)
            {
                NotfiyUserAboutNotDeletedFiles(notDeletedFiles);
            }

            IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
        }
예제 #8
0
        public void OnlineActivationCommand_CurrentActivationIsValid_ReActivationBlocksCurrentKey_SaveNewActivationAndInformUser()
        {
            _savedActivation          = BuildValidActivation("saved activation key");
            _activationFromServer     = new Activation(true);
            _activationFromServer.Key = "saved activation key";
            _activationFromServer.SetResult(Result.BLOCKED, "Blocked");

            _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do(
                x =>
            {
                var inputInteraction       = x.Arg <InputInteraction>();
                inputInteraction.Success   = true;
                inputInteraction.InputText = "not null or empty";
            });
            MessageInteraction messageInteraction = null;

            _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(
                x => messageInteraction = x[0] as MessageInteraction);
            var viewModel = BuildViewModel();

            viewModel.OnlineActivationCommand.Execute(null);

            viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout);
            _licenseChecker.Received().SaveActivation(_activationFromServer);
            Assert.AreEqual(_translation.ActivationFailed, messageInteraction.Title);
            Assert.AreEqual(MessageOptions.OK, messageInteraction.Buttons);
            Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon);
        }
예제 #9
0
        public void OnlineActivationCommand_CurrentActivationIsValid_LicenseCheckerActivationIsNotValid_DoNotSaveNewActivationAndInformUser()
        {
            _savedActivation = null;

            _expectedLicenseKey = "not empty";
            _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do(
                x =>
            {
                var inputInteraction       = x.Arg <InputInteraction>();
                inputInteraction.Success   = true;
                inputInteraction.InputText = _expectedLicenseKey;
            });
            MessageInteraction messageInteraction = null;

            _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(
                x => messageInteraction = x[0] as MessageInteraction);
            var viewModel = BuildViewModel();

            viewModel.OnlineActivationCommand.Execute(null);

            viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout);
            _licenseChecker.DidNotReceive().SaveActivation(Arg.Any <Activation>());
            Assert.AreEqual(_translation.ActivationFailed, messageInteraction.Title);
            Assert.AreEqual(MessageOptions.OK, messageInteraction.Buttons);
            Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon);
        }
예제 #10
0
        public void OnlineActivationCommand_CurrentActivationIsNotValid_LicenseCheckerActivationIsNotValid_DoNotSaveNewEditionAndInformUser()
        {
            _savedActivation = null;

            _expectedLicenseKey = "given-key";
            _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do(
                x =>
            {
                ((InputInteraction)x[0]).Success   = true;
                ((InputInteraction)x[0]).InputText = _expectedLicenseKey;
            });
            var messageInteraction = new MessageInteraction("", "", MessageOptions.OKCancel, MessageIcon.None);

            _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(
                x => messageInteraction = x.Arg <MessageInteraction>());

            _activationFromServer     = new Activation(acceptExpiredActivation: true);
            _activationFromServer.Key = _expectedLicenseKey.Replace("-", "");
            _activationFromServer.SetResult(Result.LICENSE_EXPIRED, "Expired");

            var viewModel = BuildViewModel();

            viewModel.OnlineActivationCommand.Execute(null);

            viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout);
            _licenseChecker.DidNotReceive().SaveActivation(Arg.Any <Activation>());

            Assert.AreEqual(_translation.ActivationFailed, messageInteraction.Title);
            Assert.AreEqual(MessageOptions.OK, messageInteraction.Buttons);
            Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon);
        }
        public async Task <FileExistCheckResult> CheckIfFileExistsWithResultInOverlay(Job job, string latestConfirmedPath)
        {
            var filePath = job.OutputFileTemplate;

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

            if (job.Profile.SaveFileTemporary || !_file.Exists(filePath))
            {
                return(new FileExistCheckResult(true, latestConfirmedPath));
            }

            _translation = _translationFactory.UpdateOrCreateTranslation(_translation);
            var title = _translation.ConfirmSaveAs.ToUpper(CultureInfo.CurrentCulture);
            var text  = _translation.GetFileAlreadyExists(filePath);

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

            var result = await _interactionRequest.RaiseAsync(interaction);

            if (result.Response == MessageResponse.Yes)
            {
                return(new FileExistCheckResult(true, filePath));
            }

            return(new FileExistCheckResult(false, ""));
        }
        private bool QuerySaveModifiedSettings()
        {
            if (!AppSettingsAreModified())
            {
                return(true); //No changes -> proceed
            }
            var message = Translator.GetTranslation("ApplicationSettingsWindow", "AskSaveModifiedSettings");
            var caption = Translator.GetTranslation("ApplicationSettingsWindow", "AppSettings");

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

            _invoker.Invoke(interaction);

            var response = interaction.Response;

            if (response == MessageResponse.Yes) //Proceed with saved settings
            {
                SaveAppSettings();
                return(true);
            }
            if (response == MessageResponse.No) //Proceed with old settings
            {
                return(true);
            }
            return(false); //Cancel Testprinting
        }
예제 #13
0
        private MessageResponse ShowMessage(string message, string title, MessageOptions options, MessageIcon icon)
        {
            var interaction = new MessageInteraction(message, title, options, icon);

            InteractionInvoker.Invoke(interaction);
            return(interaction.Response);
        }
예제 #14
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));
            }
        }
        private async Task<MessageResponse> ShowMessage(string message, string title, MessageOptions buttons, MessageIcon icon)
        {
            var interaction = new MessageInteraction(message, title, buttons, icon);

            await _interactionRequest.RaiseAsync(interaction);
            return interaction.Response;
        }
        private async Task InvokeActivationResponse(Option <Activation, LicenseError> activation)
        {
            if (!activation.Exists(a => a.IsActivationStillValid()))
            {
                var failedTitle       = Translation.ActivationFailed;
                var failedMessage     = Translation.ActivationFailedMessage + Environment.NewLine + DetermineLicenseStatusText(activation);
                var failedInteraction = new MessageInteraction(failedMessage, failedTitle, MessageOptions.OK, MessageIcon.Error);
                await _interactionRequest.RaiseAsync(failedInteraction);
            }
            else if (ShareLicenseForAllUsersEnabled)
            {
                //StoreLicenseForAllUsersQuery is also a Successful Message
                if (activation.HasValue)
                {
                    var a = activation.ValueOr(() => null);
                    await StoreLicenseForAllUsersQuery(a);

                    RaiseCloseWindow();
                }
            }
            else
            {
                var successTitle       = Translation.ActivationSuccessful;
                var successMessage     = Translation.ActivationSuccessfulMessage;
                var successInteraction = new MessageInteraction(successMessage, successTitle, MessageOptions.OK, MessageIcon.PDFForge);
                await _interactionRequest.RaiseAsync(successInteraction);

                RaiseCloseWindow();
            }
        }
예제 #17
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);
        }
예제 #18
0
        private void DeleteAccountCallback(MessageInteraction interaction)
        {
            if (interaction.Response != MessageResponse.Yes)
            {
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel));
                return;
            }

            if (_accountsProvider.Settings.DropboxAccounts.Contains(_currentAccount))
            {
                _accountsProvider.Settings.DropboxAccounts.Remove(_currentAccount);
            }

            foreach (var profile in _usedInProfilesList)
            {
                profile.DropboxSettings.AccountId = "";
                profile.DropboxSettings.Enabled   = false;
                profile.ActionOrder.Remove(nameof(DropboxSettings));
            }

            try
            {
                _dropboxService.RevokeToken(_currentAccount.AccessToken);
            }
            catch (Exception)
            {
                // ignored
            }

            IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
        }
        private void OpenWithArchictectExecute(object obj)
        {
            if (!CurrentProfile.OpenWithPdfArchitect)
            {
                return;
            }

            if (_pdfArchitectCheck.IsInstalled())
            {
                return;
            }

            const string caption = "PDF Architect";
            var          message = Translator.GetTranslation("OpenViewerSettings", "ArchitectNotInstalled");

            var interaction = new MessageInteraction(message, caption, MessageOptions.YesNo, MessageIcon.PDFForge);

            _interactionInvoker.Invoke(interaction);

            if (interaction.Response == MessageResponse.Yes)
            {
                _processStarter.Start(Urls.ArchitectDownloadUrl);
            }

            CurrentProfile.OpenWithPdfArchitect = false;
            RaisePropertyChanged(nameof(CurrentProfile));
        }
        protected override async Task <bool> TrySetJobPasswords(Job job)
        {
            var smtpAccount = job.Accounts.GetSmtpAccount(job.Profile);

            if (smtpAccount == null) //The account must be checked, since it is executed before the Action.Check...
            {
                var message = new MessageInteraction(Translation.NoAccount, Translation.SendTestMail, 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);
            var title            = Translation.SetSmtpServerPassword;
            var description      = Translation.SmtpServerPasswordLabel;
            var interaction      = new PasswordOverlayInteraction(PasswordMiddleButton.None, title, description, false);

            interaction.IntroText = recipientsString;

            await InteractionRequest.RaiseAsync(interaction);

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

            job.Passwords.SmtpPassword = interaction.Password;
            return(true);
        }
예제 #21
0
        public void CopyToClipBoard_CopyToClipboardisCalledWithCorrectText()
        {
            var actionResultDict     = new ActionResultDict();
            var excpetedError        = _errorCodeInterpreter.GetErrorText(ErrorCode.Attachment_NoPdf, false);
            var oneErrorActionResult = new ActionResult(ErrorCode.Attachment_NoPdf);

            actionResultDict.Add("RegionWithOneError", oneErrorActionResult);
            var twoErrorsActionResult = new ActionResult(ErrorCode.Attachment_NoPdf);

            twoErrorsActionResult.Add(ErrorCode.Attachment_NoPdf);
            actionResultDict.Add("RegionWithTwoErrors", twoErrorsActionResult);
            var interaction = new MessageInteraction("text", "title", MessageOptions.OK, MessageIcon.Info, actionResultDict, "second text");

            _viewModel.SetInteraction(interaction);

            var receivedText = "";

            _clipboardService.SetDataObject(Arg.Do <object>(o => receivedText = o as string));

            _viewModel.CopyToClipboard_CommandBinding(null, null);

            var expectedText = new StringBuilder()
                               .AppendLine("text")
                               .AppendLine("RegionWithOneError")
                               .AppendLine("- " + excpetedError)
                               .AppendLine("RegionWithTwoErrors")
                               .AppendLine("- " + excpetedError)
                               .AppendLine("- " + excpetedError)
                               .AppendLine("second text")
                               .ToString();

            Assert.AreEqual(receivedText, expectedText);
        }
예제 #22
0
        public void SetInteractionWithActionResultDict_ErrorListVisibiltyIsVisible_ErrorListIsBuild_RaisesPropertyChanged()
        {
            var actionResultDict     = new ActionResultDict();
            var excpetedError        = _errorCodeInterpreter.GetErrorText(ErrorCode.Attachment_NoPdf, false);
            var oneErrorActionResult = new ActionResult(ErrorCode.Attachment_NoPdf);

            actionResultDict.Add("RegionWithOneError", oneErrorActionResult);
            var twoErrorsActionResult = new ActionResult(ErrorCode.Attachment_NoPdf);

            twoErrorsActionResult.Add(ErrorCode.Attachment_NoPdf);
            actionResultDict.Add("RegionWithTwoErrors", twoErrorsActionResult);
            var interaction = new MessageInteraction("", "", MessageOptions.OK, MessageIcon.Info, actionResultDict);

            var propertyChangedList = new List <string>();

            _viewModel.PropertyChanged += (sender, args) => propertyChangedList.Add(args.PropertyName);

            _viewModel.SetInteraction(interaction);

            Assert.AreEqual("RegionWithOneError", _viewModel.ErrorList[0].Region);
            Assert.AreEqual(excpetedError, _viewModel.ErrorList[0].Error);
            Assert.AreEqual("RegionWithTwoErrors", _viewModel.ErrorList[1].Region);
            Assert.AreEqual(excpetedError, _viewModel.ErrorList[1].Error);
            Assert.AreEqual("RegionWithTwoErrors", _viewModel.ErrorList[2].Region);
            Assert.AreEqual(excpetedError, _viewModel.ErrorList[2].Error);

            Assert.AreEqual(Visibility.Visible, _viewModel.ErrorListVisibility);
            Assert.Contains(nameof(_viewModel.ErrorListVisibility), propertyChangedList);
        }
예제 #23
0
        private void DisplayFontError()
        {
            var message = Translation.FontFileNotSupported;

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

            _interactionInvoker.Invoke(interaction);
        }
        public void CorrectButtonsAreActivatedForMessageOptions(MessageOptions option, bool middleActive, bool rightActive)
        {
            var interaction = new MessageInteraction("message", "title", option, MessageIcon.Info);

            _viewModel.SetInteraction(interaction);

            Assert.AreEqual(rightActive, _viewModel.ButtonRightCommand.IsExecutable);
        }
        public void ForWarningIcon_PlaysCorrectSound()
        {
            var interaction = new MessageInteraction("message", "title", MessageOptions.OK, MessageIcon.Warning);

            _viewModel.SetInteraction(interaction);

            _soundPlayer.Received().Play(SystemSounds.Exclamation);
        }
        public void ForInfoIcon_PlaysCorrectSound()
        {
            var interaction = new MessageInteraction("message", "title", MessageOptions.OK, MessageIcon.Info);

            _viewModel.SetInteraction(interaction);

            _soundPlayer.Received().Play(SystemSounds.Asterisk);
        }
        protected override void ShowSuccess(Job job)
        {
            var title       = Translation.SendTestMail;
            var message     = Translation.TestMailSent + "\n" + GetRecipientsString(job.Profile.EmailSmtpSettings);
            var interaction = new MessageInteraction(message, title, MessageOptions.OK, MessageIcon.Info);

            InteractionRequest.Raise(interaction);
        }
예제 #28
0
        public void Check_ShowMiddleButton(MessageOptions option, bool isVisible)
        {
            var interaction = new MessageInteraction("message", "title", option, MessageIcon.Info);

            _viewModel.SetInteraction(interaction);

            Assert.AreEqual(isVisible, _viewModel.MiddleButtonCommand.IsExecutable);
        }
예제 #29
0
 private void NotifyFileExistsCallback(MessageInteraction interaction)
 {
     if (interaction.Response == MessageResponse.Yes)
     {
         CallFinishInteraction();
     }
     _latestDialogFilePath = "";
 }
        private void DisplayFontError()
        {
            var message = Translator.GetTranslation("ProfileSettingsWindow", "FontFileNotSupported");

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

            _interactionInvoker.Invoke(interaction);
        }