Skip to content

Commit

Permalink
More minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Jan 29, 2025
1 parent 132d8f1 commit 7abfdce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
15 changes: 8 additions & 7 deletions samples/Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public static MauiApp CreateMauiApp()

.AddResiliencyMiddleware(builder.Configuration)
// Cache - you can only have one
// .AddPersistentCache()
.AddMemoryCaching(y =>
{
y.ExpirationScanFrequency = TimeSpan.FromSeconds(5);
})
.AddMauiPersistentCache()
// .AddMemoryCaching(y =>
// {
// y.ExpirationScanFrequency = TimeSpan.FromSeconds(5);
// })
);
builder.Services.AddSingletonAsImplementedInterfaces<MyRequestMiddleware>();
builder.Services.AddDiscoveredMediatorHandlersFromSample();
Expand All @@ -75,7 +75,8 @@ public static MauiApp CreateMauiApp()
builder.Services.RegisterForNavigation<EventPage, EventViewModel>();
builder.Services.RegisterForNavigation<BlazorPage, BlazorViewModel>();
builder.Services.RegisterForNavigation<AnotherPage, AnotherViewModel>();

return builder.Build();

var app = builder.Build();
return app;
}
}
3 changes: 1 addition & 2 deletions samples/Sample/TriggerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Sample;

public partial class TriggerViewModel(
IMediator mediator,
IMemoryCache cache,
AppSqliteConnection data,
IPageDialogService dialogs
) : ObservableObject, IEventHandler<MyMessageEvent>
Expand Down Expand Up @@ -111,7 +110,7 @@ async Task CacheRequest()
[RelayCommand]
async Task CacheClear()
{
cache.Clear();
await mediator.Publish(new FlushAllStoresEvent());
await dialogs.DisplayAlertAsync("Cache Cleared", "DONE", "Ok");
}
[ObservableProperty] string cacheValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class AppSupportExecutionContextExtensions
internal static void UserErrorNotification(this IMediatorContext context, UserErrorNotificationContext info)
=> context.Add(nameof(UserErrorNotification), info);

public static OfflineAvailableContext? Offline(this IMediatorContext context)
public static OfflineAvailableContext? Offline(this RequestContext context)
=> context.TryGetValue<OfflineAvailableContext>("Offline");

internal static void Offline(this RequestContext context, OfflineAvailableContext offlineContext)
Expand Down

0 comments on commit 7abfdce

Please sign in to comment.