Skip to content

Commit

Permalink
Minor fixes to Uno alert service
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Feb 20, 2025
1 parent 4b9ea8e commit 59f776b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,41 +91,6 @@ async Task DoRemove(
if (writeState)
await this.WriteState().ConfigureAwait(false);
}

// public async Task RemoveByPrefix(string prefix)
// {
// var changed = false;
// var indexes = await this.GetFileIndexes().ConfigureAwait(false);
// var indexCopy = indexes.ToList();
//
// foreach (var (key, value) in indexCopy)
// {
// if (key.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase))
// {
// await this.DeleteFile(key);
// indexes.TryRemove(key, out _);
// changed = true;
// }
// }
//
// if (changed)
// await this.WriteState().ConfigureAwait(false);
// }

// public async Task Clear()
// {
// var indexes = await this.GetFileIndexes().ConfigureAwait(false);
//
// foreach (var value in indexes.Values)
// {
// await this
// .DeleteFile(value)
// .ConfigureAwait(false);
// }
// indexes.Clear();
// await this.WriteState().ConfigureAwait(false);
// }


protected virtual async Task WriteObject<T>(string fileName, T value)
{
Expand Down
36 changes: 6 additions & 30 deletions src/Shiny.Mediator.Uno/Infrastructure/AlertDialogService.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
using Microsoft.UI.Xaml;
using Uno.Extensions.Hosting;
using Uno.Extensions.Navigation;
using Windows.UI.Popups;

namespace Shiny.Mediator.Infrastructure;


public class AlertDialogService(IRouteNotifier routeNotifier) : IAlertDialogService, IServiceInitialize
public class AlertDialogService : IAlertDialogService
{
public void Initialize()
public async void Display(string title, string message)
{
routeNotifier.RouteChanged += (sender, args) =>
{
var view = args.Region.View;
Console.WriteLine("View: " + view?.GetType().FullName);
Console.WriteLine("DC: " + args.Region.View?.DataContext?.GetType().FullName);
};
}

public void Display(string title, string message)
{
// new Navigator(null, null, )
// Window.Current.CoreWindow
// try
// {
// await navigator.ShowMessageDialogAsync(
// this,
// title: title,
// content: message
// );
//
// }
// catch (Exception ex)
// {
// Console.WriteLine(ex);
// }
var dialog = new MessageDialog(message, title);
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
}
}

0 comments on commit 59f776b

Please sign in to comment.