Skip to content

Commit

Permalink
fixing background tap dismissal
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jun 6, 2019
1 parent c20beae commit 1a49f73
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<StackLayout>
<Label Text="{x:Static i18n:Resources.LoremIpsum}" />
<Button Text="Show Demo Dialog"
Command="{prism:ShowDialog 'DemoDialog?message=Hello%20From%20Prism%20DialogService!'}"
Command="{prism:ShowDialog 'DemoDialog?message=Hello%20From%20Prism%20DialogService!&amp;closeOnBackgroundTapped=true'}"
HorizontalOptions="Center" />
<Button Text="Show User Alert"
Command="{Binding ShowUserAlertCommand}"
Expand Down
7 changes: 0 additions & 7 deletions Source/Xamarin/Prism.Forms/Services/Dialogs/DialogResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ namespace Prism.Services.Dialogs
{
internal class DialogResult : IDialogResult
{
private bool _success;
public bool Success
{
get => Exception is null ? _success : false;
set => _success = value;
}

public Exception Exception { get; set; }
public IDialogParameters Parameters { get; set; }
}
Expand Down
3 changes: 1 addition & 2 deletions Source/Xamarin/Prism.Forms/Services/Dialogs/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ private IDialogResult CloseDialog(IDialogParameters parameters, ContentPage curr

return new DialogResult
{
Success = true,
Parameters = parameters
};
}
Expand Down Expand Up @@ -250,7 +249,7 @@ private void InsertPopupViewInCurrentPage(ContentPage currentPage, View popupVie

if (hideOnBackgroundTapped)
{
var dismissCommand = new Command(() => CloseDialog(new DialogParameters(), currentPage));
var dismissCommand = new Command(() => callback(new DialogParameters()));
mask.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = dismissCommand
Expand Down
5 changes: 3 additions & 2 deletions Source/Xamarin/Prism.Forms/Services/Dialogs/IDialogResult.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Prism.Navigation;
using System;

namespace Prism.Services.Dialogs
{
public interface IDialogResult : INavigationResult
public interface IDialogResult
{
Exception Exception { get; }
IDialogParameters Parameters { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void DialogClosedCallback(IDialogResult result)

protected virtual void OnDialogClosed(IDialogResult result)
{
if (!result.Success)
if (result.Exception != null)
{
Log.Warning("Warning", $"Dialog '{Name}' closed with an error:\n{result.Exception}");
}
Expand Down

0 comments on commit 1a49f73

Please sign in to comment.