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 OpenEditDialog(string targetView, string title) { var settingsCopy = _selectedProfileProvider.SelectedProfile.Copy(); var workflowEditorOverlayInteraction = new WorkflowEditorOverlayInteraction(false, title, targetView); await _interactionRequest.RaiseAsync(workflowEditorOverlayInteraction); if (!workflowEditorOverlayInteraction.Success && !settingsCopy.Equals(_selectedProfileProvider.SelectedProfile)) { _selectedProfileProvider.SelectedProfile.ReplaceWith(settingsCopy); } GenerateCollectionViewsOfActions(); UpdateConfigurationProperties(); }
private async Task AddAdditionalAttachmentExecute(object obj) { var interaction = new SelectFileInteraction(_getSelectFileInteractionTitle(), "", false, _tokens, _filter); var interactionResult = await _interactionRequest.RaiseAsync(interaction); if (interactionResult.Result != SelectFileInteractionResult.Apply) { return; } AddFilePath(interactionResult.File); RaisePropertyChanged(nameof(FileListDictionary)); RaisePropertyChanged(nameof(FileList)); }
private async Task ShowAppRestartMessageAsync(string downloadedFile) { var interaction = new RestartApplicationInteraction(); await _interactionRequest.RaiseAsync(interaction); EvaluateUserInputAppRestartMessage(interaction, downloadedFile); }
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, "")); }
public async void Execute(object parameter) { var actionFacade = (IPresenterActionFacade)parameter; var profile = _selectedProfileProvider.SelectedProfile; if (!profile.ActionOrder.Exists(x => x == actionFacade.SettingsType.Name)) { var isDisabled = false; if (IsSupported(actionFacade)) { actionFacade.IsEnabled = true; profile.ActionOrder.Add(actionFacade.SettingsType.Name); } else { isDisabled = true; } _actionOrderHelper.EnsureEncryptionAndSignatureOrder(profile); var interaction = await _interactionRequest.RaiseAsync(new WorkflowEditorOverlayInteraction(actionFacade.Translation, actionFacade.OverlayView, isDisabled, true)); if (interaction.Result != WorkflowEditorOverlayResult.Success) { actionFacade.IsEnabled = false; _selectedProfileProvider.SelectedProfile.ActionOrder.RemoveAll(x => x == actionFacade.SettingsType.Name); if ("CoverPage" == actionFacade.SettingsType.Name) { _selectedProfileProvider.SelectedProfile.CoverPage.Files = new List <string>(); } } _eventAggregator.GetEvent <ActionAddedToWorkflowEvent>().Publish(); if (interaction.Result == WorkflowEditorOverlayResult.Back) { await _interactionRequest.RaiseAsync(new AddActionOverlayInteraction()); } } }
protected virtual async Task OfflineActivationCommandExecute(object obj) { if (_offlineActivator == null) { return; } var lastActivationKey = LicenseKey; if (string.IsNullOrWhiteSpace(lastActivationKey)) { lastActivationKey = _licenseChecker.GetSavedLicenseKey().ValueOr(""); } var interaction = new OfflineActivationInteraction(lastActivationKey); await _interactionRequest.RaiseAsync(interaction); if (interaction.Success) { var activation = _offlineActivator.ValidateOfflineActivationString(interaction.LicenseServerAnswer); try { activation.MatchSome(a => _offlineActivator.SaveActivation(a)); } catch (SecurityException) { _logger.Info("Can't save activation. Please share the license for all users."); } //Just to show in UI //LicenseChecker in UpdateActivation can't save activation await UpdateActivation(activation); RaiseLicensePropertyChangedEvents(); } }
private async Task <QueryResult <OutputFilenameResult> > GetFileOrRetry(string dir, string file, OutputFormat format) { while (true) { try { return(_fileNameQuery.GetFileName(dir, file, format)); } catch (PathTooLongException) { _translation = _translationFactory.UpdateOrCreateTranslation(_translation); var interaction = new MessageInteraction(_translation.PathTooLongText, _translation.PathTooLongTitle, MessageOptions.OK, MessageIcon.Exclamation); await _interactionRequest.RaiseAsync(interaction); } } }
private async Task <QueryResult <OutputFilenameResult> > GetFileOrRetry() { // Retry while there is a PathTooLongException while (true) { try { return(_saveFileQuery.GetFileName(OutputFolder, OutputFilename, OutputFormat)); } catch (PathTooLongException) { var interaction = new MessageInteraction(Translation.PathTooLongText, Translation.PathTooLongTitle, MessageOptions.OK, MessageIcon.Exclamation); await _interactionRequest.RaiseAsync(interaction); } } }
public override async Task <MacroCommandIsDoneEventArgs> ExecuteWaitableAsync(object parameter) { var settingsCopy = _selectedProfileProvider.SelectedProfile.Copy(); var translation = _translationFactory.CreateTranslation <WorkflowEditorTranslation>(); var title = _getTitle(translation); var interaction = new WorkflowEditorOverlayInteraction(title, _view, false, false); await _interactionRequest.RaiseAsync(interaction); if (interaction.Result != WorkflowEditorOverlayResult.Success && !settingsCopy.Equals(_selectedProfileProvider.SelectedProfile)) { _selectedProfileProvider.SelectedProfile.ReplaceWith(settingsCopy); } _eventAggregator.GetEvent <WorkflowSettingsChanged>().Publish(); var status = interaction.Result == WorkflowEditorOverlayResult.Success ? ResponseStatus.Success : ResponseStatus.Cancel; return(new MacroCommandIsDoneEventArgs(status)); }
public override async Task ExecuteAsync(object parameter) { _isExecuting = true; try { if (_currentSettingsProvider.SelectedProfile.EnableWorkflowEditor) { var messageText = Translation.WarningLayoutSwitchCopy + Environment.NewLine + Translation.WantToContinue; var messageInteraction = new MessageInteraction(messageText, Translation.WarningLayoutSwitchTitle, MessageOptions.YesNo, MessageIcon.Warning); var interaction = await _interactionRequest.RaiseAsync(messageInteraction); if (interaction.Response != MessageResponse.Yes) { return; } } //switch state _currentSettingsProvider.SelectedProfile.EnableWorkflowEditor = !_currentSettingsProvider.SelectedProfile.EnableWorkflowEditor; foreach (var conversionProfile in _profiles.Settings) { _actionOrderHelper.ForceDefaultOrder(conversionProfile); } if (_currentSettingsProvider.SelectedProfile.EnableWorkflowEditor) { _regionManager.RequestNavigate(RegionNames.ProfileLayoutRegion, nameof(WorkflowEditorView)); } else { _regionManager.RequestNavigate(RegionNames.ProfileLayoutRegion, nameof(TabBasedProfileLayoutView)); } _eventAggregator.GetEvent <SwitchWorkflowLayoutEvent>().Publish(); } finally { _isExecuting = false; } }
public override async void Execute(object parameter) { var settingsCheckResult = _tabSwitchSettingsCheck.CheckAllSettings(); if (settingsCheckResult.SettingsHaveChanged) { var title = Translation.Settings; var text = Translation.UnsavedChanges + Environment.NewLine + Translation.WantToSave; var messageInteraction = new MessageInteraction(text, title, MessageOptions.YesCancel, MessageIcon.Question); await _interactionRequest.RaiseAsync(messageInteraction); if (messageInteraction.Response != MessageResponse.Yes) { IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel)); } } IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success)); }
public async void Execute(object parameter) { var actionFacade = (IPresenterActionFacade)parameter; var profile = _selectedProfileProvider.SelectedProfile; if (!profile.ActionOrder.Exists(x => x == actionFacade.SettingsType.Name)) { if (!_editionHelper.IsFreeEdition || !typeof(IBusinessFeatureAction).IsAssignableFrom(actionFacade.Action)) { actionFacade.IsEnabled = true; profile.ActionOrder.Add(actionFacade.SettingsType.Name); } _actionOrderHelper.EnsureEncryptionAndSignatureOrder(profile); if (profile.EnableWorkflowEditor) { var result = await _interactionRequest.RaiseAsync(new WorkflowEditorOverlayInteraction(false, actionFacade.Translation, actionFacade.OverlayView)); if (!result.Success) { actionFacade.IsEnabled = false; _selectedProfileProvider.SelectedProfile.ActionOrder.RemoveAll(x => x == actionFacade.SettingsType.Name); if ("CoverPage" == actionFacade.SettingsType.Name) { _selectedProfileProvider.SelectedProfile.CoverPage.File = string.Empty; } } } else { _actionOrderHelper.ForceDefaultOrder(profile); } _eventAggregator.GetEvent <ActionAddedToWorkflowEvent>().Publish(); } }
private async void OpenAddActionOverview(object obj) { await _interactionRequest.RaiseAsync(new AddActionOverlayInteraction()); }