private async void ExecuteDeleteEntryCommand() { ConfirmationServiceArgs args = new ConfirmationServiceArgs( Strings.Confirm, Strings.DoYouReallyWantToDeleteThisEntry, Strings.Yes, Strings.No ); if( !await ViewServices.Execute<IConfirmationService, bool>( args ) ) { return; } DeleteRequested?.Invoke( this, EventArgs.Empty ); }
public void ConstructorSetsCorrectProperties() { // Arrange // Act var csa = new ConfirmationServiceArgs( "title", "message", "ok", "cancel" ); // Assert Assert.AreEqual( "title", csa.Title ); Assert.AreEqual( "message", csa.Message ); Assert.AreEqual( "ok", csa.OkText ); Assert.AreEqual( "cancel", csa.CancelText ); }
public async Task <object> Execute(MetroWindow window, object args) { ConfirmationServiceArgs csa = args as ConfirmationServiceArgs; Debug.Assert(csa != null); MetroDialogSettings settings = new MetroDialogSettings { AffirmativeButtonText = csa.OkText, NegativeButtonText = csa.CancelText }; var result = await window.ShowMessageAsync(csa.Title, csa.Message, MessageDialogStyle.AffirmativeAndNegative, settings); return(result == MessageDialogResult.Affirmative); }
private async void ExecuteDeleteProjectCommand( ProjectViewModel arg ) { ConfirmationServiceArgs args = new ConfirmationServiceArgs( Strings.Confirm, string.Format( Strings.DoYouReallyWantToDeleteProjectXXX, arg.Model.Name ), Strings.Yes, Strings.No ); if( !await ViewServices.Execute<IConfirmationService, bool>( args ) ) { return; } arg.CurrentChanged -= Proj_CurrentChanged; Projects.Remove( arg ); ProjectRepo.Delete( arg.Model ); if( !Projects.Contains( CurrentProject ) ) { CurrentProject = Projects.FirstOrDefault(); if( CurrentProject != null ) { CurrentProject.IsCurrent = true; } } MessengerInstance.Send( new NotificationMessage( Strings.ProjectDeleted ) ); }
private async void ExecuteDeleteTagCommand( TagViewModel arg ) { ConfirmationServiceArgs args = new ConfirmationServiceArgs( Strings.Confirm, string.Format( Strings.DoYouReallyWantToDeleteTagXXX, arg.Model.Name ), Strings.Yes, Strings.No ); if( !await ViewServices.Execute<IConfirmationService, bool>( args ) ) { return; } TagRepo.Delete( arg.Model ); Tags.Remove( arg ); MessengerInstance.Send( new TagRemovedMessage( arg.Model ) ); MessengerInstance.Send( new NotificationMessage( Strings.TagDeleted ) ); ReadTagNames(); }