postit: guard app navigation paths in circle member flows
This commit is contained in:
parent
285996ac1a
commit
3e37a857c5
3 changed files with 8 additions and 12 deletions
|
|
@ -122,14 +122,16 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Confirmed?.Invoke(this, Selected);
|
Confirmed?.Invoke(this, Selected);
|
||||||
var app = App.Current as App;
|
var app = App.Current as App
|
||||||
|
?? throw new InvalidOperationException("Application PostIt indisponible.");
|
||||||
await app.GoBackAsync();
|
await app.GoBackAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
public async Task CloseAsync()
|
public async Task CloseAsync()
|
||||||
{
|
{
|
||||||
var app = App.Current as App;
|
var app = App.Current as App
|
||||||
|
?? throw new InvalidOperationException("Application PostIt indisponible.");
|
||||||
await app.GoBackAsync();
|
await app.GoBackAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,10 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
internal async Task OpenAddMemberAsync()
|
internal async Task OpenAddMemberAsync()
|
||||||
{
|
{
|
||||||
var app = Application.Current as App;
|
var app = Application.Current as App
|
||||||
var services = app?.ServiceProvider;
|
?? throw new InvalidOperationException("Application PostIt indisponible.");
|
||||||
|
var services = app.ServiceProvider
|
||||||
|
?? throw new InvalidOperationException("ServiceProvider PostIt indisponible.");
|
||||||
var directory = services.GetRequiredService<IUserDirectory>();
|
var directory = services.GetRequiredService<IUserDirectory>();
|
||||||
AddCircleMemberDialogViewModel model =
|
AddCircleMemberDialogViewModel model =
|
||||||
new AddCircleMemberDialogViewModel(directory);
|
new AddCircleMemberDialogViewModel(directory);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
|
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
using PostIt.Services;
|
using PostIt.Services;
|
||||||
using PostIt.ViewModels;
|
using PostIt.ViewModels;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PostIt.Views;
|
namespace PostIt.Views;
|
||||||
|
|
||||||
|
|
@ -41,10 +39,4 @@ public partial class AddCircleMemberDialog : Avalonia.Controls.ContentPage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AddCircleMemberDialogViewModel? ViewModel
|
public AddCircleMemberDialogViewModel? ViewModel
|
||||||
=> DataContext as AddCircleMemberDialogViewModel;
|
=> DataContext as AddCircleMemberDialogViewModel;
|
||||||
|
|
||||||
private async Task OnCloseClicked(object? sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
App app = App.Current! as App;
|
|
||||||
await app!.GoBackAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue