private void OnConfermaExecute() { NpceOperationResult result = null; switch (TipoServizio.Descrizione) { //case "Posta1": //case "Posta4": // { // result = ConfermaLolExecute(); // } // break; //case "Raccomandata": // { // result = ConfermaRolExecute(); // } // break; case "Mol1": case "MOL4": case "COL1": case "COL4": { result = ConfermaPostaEvo(); } break; } string message; if (result.Success) { message = $"Operazione {result.Operation.ToString()} completata con successo"; } else { message = $"Si è verificato il seguente errore:\nCode: {result.Errors[0].Code}\n Description: {result.Errors[0].Description}"; } _messageDialogService.ShowOkCancelDialogAsync(message, "Info"); if (result.Success) { Servizio.IdRichiesta = result.IdRichiesta; Servizio.IdOrdine = result.IdOrdine; // TODO: AutoConferma var statoCreated = AutoConfirm ? _statoServizioRepository.GetByDescription("Confermato") : _statoServizioRepository.GetByDescription("PreConfermato"); Servizio.Model.StatoServizioId = statoCreated.Id; OnSaveExecute(); } }
private async void SelectFileExecute() { FolderBrowserDialog _openFileDialog = new FolderBrowserDialog() { Description = UserMessages.FolderBrowserDialogDescription }; DialogResult result = _openFileDialog.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(_openFileDialog.SelectedPath)) { var newHelper = new FileDirectoryHelpers(); var filesInPath = newHelper.GetFilesInfoInPath(_openFileDialog.SelectedPath); var dialog = await _messageDialogService .ShowOkCancelDialogAsync( $"You selected path {_openFileDialog.SelectedPath}, " + $"which contain {filesInPath.FileNumbers} " + $"files in {filesInPath.FilesList.Select(s => s.Extension).Distinct().Count()} " + $"different types. Do you want to continue with selection?", "Question"); if (dialog == MessageDialogResult.OK) { SavePathInProject(_openFileDialog.SelectedPath); } else { //TODO: Recomanded to create new catalog with defoult name } } }
// Viene riusato sia per visualizzare un'anagrafica esistente sia per crearne una nuova. // In questo secondo caso viene passato null come parametro private async void OnOpenDetailEvent(OpenDetailViewEventargs args) { var detailViewModel = DetailViewModels.SingleOrDefault(vm => vm.Id == args.Id && vm.GetType().Name == args.ViewModelName); if (detailViewModel == null) { detailViewModel = _detailViewModelCreator[args.ViewModelName]; await detailViewModel.LoadAsync(args.Id); DetailViewModels.Add(detailViewModel); } // Prima di aggiornare il ViewModel corrente Verificare se il view model corrente HasChanges if (SelectedDetailViewModel != null && SelectedDetailViewModel.HasChanges) { var result = await _messageDialogservice.ShowOkCancelDialogAsync("You've made changes. Navigate away ?", "Question"); if (result == MessageDialogResult.Cancel) { return; } } SelectedDetailViewModel = detailViewModel; }
public async Task DeleteVideoAsync() { try { var isOk = await _messageDialogService.ShowOkCancelDialogAsync($"Delete the video {_cloudBlockBlob.Name}?", "Question"); if (isOk) { _mainViewModel.StartLoading($"Deleting your video {BlobName}"); await _coffeeVideoStorage.DeleteVideoAsync(_cloudBlockBlob); _mainViewModel.RemoveCoffeeVideoViewModel(this); _mainViewModel.StopLoading(); _mainViewModel = null; } } catch (Exception ex) { await _messageDialogService.ShowInfoDialogAsync(ex.Message, "Error"); } finally { if (_mainViewModel != null) { _mainViewModel.StopLoading(); } } }
protected async virtual void OnCloseDetailViewExecute() { if (HasChanges) { var result = await MessageDialogService.ShowOkCancelDialogAsync("You've made changes. Close this item?", "Question"); if (result == MessageDialogResult.Cancel) { return; } } EventAggregator.GetEvent <AfterDetailClosedEvent>() .Publish(new AfterDetailClosedEventArgs { Id = this.Id, ViewModelName = this.GetType().Name }); }
protected async override Task OnCloseDetailAsync(CancelEventArgs args) { if (HasChanges) { var result = await _messageDialogService.ShowOkCancelDialogAsync("You'll loose your changes when you close this tab (Yeah, I know, there's no save-button yet ;-)). Continue?"); args.Cancel = result == MessageDialogResult.Cancel; } }
public override async void OnDeleteExecute() { var result = await MessageDialogService.ShowOkCancelDialogAsync($"Do you really want to delete this supplier {_selectedEmployee.Name}?", "Question"); if (result == MessageDialogResult.OK) { await _employeeDS.RemoveEmployeeAsync(_selectedEmployee.Id); await LoadAsync(Id, true); } }
protected async virtual void OnCloseDetailViewExecute() { if (HasChanges) { var result = await MessageDialogService.ShowOkCancelDialogAsync( "Вие направихте промени. Наистина ли искате да затворите този прозорец?", "Въпрос"); if (result == MessageDialogResult.Cancel) { return; } } EventAggregator.GetEvent <AfterDetailClosedEvent>() .Publish(new AfterDetailClosedEventArgs { Id = this.Id, ViewModelName = this.GetType().Name }); }
protected virtual async void OnCloseDetailViewExecute() { if (HasChanges) { var result = await MessageDialogService.ShowOkCancelDialogAsync( "Все несохраненные изменения будут утеряны. Продолжить?", "Внимание"); if (result == MessageDialogResult.Cancel) { return; } } EventAggregator.GetEvent <AfterDetailClosedEvent>() .Publish(new AfterDetailClosedEventArgs { Id = this.Id, ViewModelName = this.GetType().Name }); }
protected override async void OnDeleteExecute() { var result = await _messageDialogService.ShowOkCancelDialogAsync($"Do you really want to delete the project {Project.ProjectName}?", "Question"); if (result == MessageDialogResult.OK) { _projectRepository.Remove(Project.Model); await _projectRepository.SaveAsync(); RaiseDetailDeletedEvent(Project.Id); } }
protected async override void OnDeleteExecute() { var result = await _messageDialogService.ShowOkCancelDialogAsync($"Do you really want to delete the meeting {Meeting.Title}?", "Question"); if (result == MessageDialogResult.OK) { _meetingRepository.Remove(Meeting.Model); await _meetingRepository.SaveAsync(); RaiseDetailDeletedEvent(Meeting.Id); } }
/// <summary>Metoda wywoływana podczas usuwania wydarzenia. Wyświetla okno dialogowe z pytaniem potwierdzającym ten ruch użytkownika.</summary> private async void OnDeleteExecute() { var result = await _messageDialogService.ShowOkCancelDialogAsync($"Zmiana planów? Naprawdę chcesz usunąć wydarzenie {Incident.Title}?", "Pytanko"); if (result == MessageDialogResult.OK) { _incidentRepository.Remove(Incident.Model); await _incidentRepository.SaveAsync(); _eventAggregator.GetEvent <AfterIncidentDeletedEvent>().Publish(Incident.Id); } }
/// <summary>Metoda wywoływana podczas próby opuszczenia edycji bieżącego wydarzenia. Wyświetla okno dialogowe z zapytaniem.</summary> /// <param name="incidentId">Identyfikator wydarzenia.</param> private async void OnOpenIncidentDetailView(int?incidentId) { if (IncidentDetailViewModel != null && IncidentDetailViewModel.HasChanges) { var result = await _messageDialogService.ShowOkCancelDialogAsync("Poczyniłeś pewne zmiany w wydarzeniu, które nie zostaną zapisane. Na pewno chcesz porzucić to wydarzenie?", "Pytanko"); if (result == MessageDialogResult.Anuluj) { return; } } IncidentDetailViewModel = _incidentDetailViewModelCreator(); await IncidentDetailViewModel.LoadAsync(incidentId); }
private async void OnOpenDetailView(OpenDetailViewEventArgs args) { if (DetailViewModel != null && DetailViewModel.HasChanges) { var result = await _messageDialogService.ShowOkCancelDialogAsync("You've made changes. Navigate away?", "Question"); if (result == MessageDialogResult.Cancel) { return; } } DetailViewModel = _detailViewModelCreator[args.ViewModelName]; await DetailViewModel.LoadAsync(args.Id); }
protected virtual async void OnCloseDetailViewExecute() { if (HasChanges) { var result = await _messageDialogService.ShowOkCancelDialogAsync( "You have some unsaved changes. Are you sure, you want to close?", "Question" ); if (result == MessageDialogResult.Cancel) { return; } } EventAggregator.GetEvent <AfterDetailClosedEvent>().Publish(new AfterDetailClosedEventArgs() { Id = this.Id, ViewModelName = this.GetType().Name }); }
protected override async void OnDeleteExecute() { if (await _friendRepository.HasMeetingsAsync(Friend.Id)) { await _messageDialogService.ShowInfoDialogAsync($"{Friend.FirstName} {Friend.LastName} can't be deleted, as this friend is part of at least one meeting"); return; } var result = await _messageDialogService.ShowOkCancelDialogAsync($"Do you really want to delete the friend {Friend.FirstName} {Friend.LastName}?", "Question"); if (result == MessageDialogResult.OK) { _friendRepository.Remove(Friend.Model); await _friendRepository.SaveAsync(); RaiseDetailDeletedEvent(Friend.Id); } }