Codemaid
This commit is contained in:
@@ -4,7 +4,7 @@ using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
namespace Toolkit.Avalonia;
|
||||
|
||||
public class ContentDialogHandler(IDispatcher dispatcher) :
|
||||
public class ContentDialogHandler :
|
||||
INotificationHandler<NavigateEventArgs<ContentDialog>>
|
||||
{
|
||||
public async Task Handle(NavigateEventArgs<ContentDialog> args)
|
||||
@@ -83,7 +83,7 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
|
||||
{
|
||||
await deactivating.OnDeactivating();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ public class FileProvider(ITopLevelProvider topLevelProvider) :
|
||||
}
|
||||
});
|
||||
|
||||
return storageFiles.Select(file => file.Path.LocalPath).ToList();
|
||||
return storageFiles.Select(file => file.Path.LocalPath).ToList();
|
||||
}
|
||||
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class FrameHandler :
|
||||
|
||||
if (args.Parameters is not null)
|
||||
{
|
||||
if (args.Parameters.TryGetValue("Transition",
|
||||
if (args.Parameters.TryGetValue("Transition",
|
||||
out object? transition))
|
||||
{
|
||||
switch ($"{transition}")
|
||||
@@ -142,6 +142,7 @@ public class FrameHandler :
|
||||
navigationOptions.TransitionInfoOverride =
|
||||
new SuppressNavigationTransitionInfo();
|
||||
break;
|
||||
|
||||
case "FromLeft":
|
||||
case "FromRight":
|
||||
case "FromTop":
|
||||
@@ -155,7 +156,7 @@ public class FrameHandler :
|
||||
}
|
||||
}
|
||||
|
||||
if (args.Parameters.TryGetValue("IsBackStackEnabled",
|
||||
if (args.Parameters.TryGetValue("IsBackStackEnabled",
|
||||
out object? isBackStackEnabled))
|
||||
{
|
||||
if (isBackStackEnabled is bool value)
|
||||
@@ -164,7 +165,7 @@ public class FrameHandler :
|
||||
}
|
||||
}
|
||||
|
||||
if (args.Parameters.TryGetValue("ClearBackStack",
|
||||
if (args.Parameters.TryGetValue("ClearBackStack",
|
||||
out object? clearBackStack))
|
||||
{
|
||||
if (clearBackStack is bool clearBool)
|
||||
@@ -177,7 +178,7 @@ public class FrameHandler :
|
||||
|
||||
if (clearBackStack is string clearString)
|
||||
{
|
||||
if (clearString.StartsWith('[') && clearString.EndsWith(']') &&
|
||||
if (clearString.StartsWith('[') && clearString.EndsWith(']') &&
|
||||
clearString.Contains('-'))
|
||||
{
|
||||
string range = clearString.Trim('[', ']');
|
||||
@@ -197,7 +198,7 @@ public class FrameHandler :
|
||||
{
|
||||
postNavigateActions.Add(() => CleanUp(1, frame.BackStack.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,4 +8,4 @@ public interface IImageResizer
|
||||
int targetWidth,
|
||||
int targetHeight,
|
||||
bool maintainAspectRatio);
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public static class IServiceCollectionExtensions
|
||||
|
||||
services.AddTransient<IClipboardWriter, ClipboardWriter>();
|
||||
|
||||
services.AddTransient<IImageReader, ImageReader>();
|
||||
services.AddTransient<IImageReader, ImageReader>();
|
||||
services.AddTransient<IImageWriter, ImageWriter>();
|
||||
services.AddTransient<IImageResizer, ImageResizer>();
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@ namespace Toolkit.Avalonia;
|
||||
public interface ITopLevelProvider
|
||||
{
|
||||
TopLevel? Get();
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,15 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Toolkit.Avalonia;
|
||||
|
||||
public class ImageReader(IImageResizer imageResizer) :
|
||||
public class ImageReader(IImageResizer imageResizer) :
|
||||
IImageReader
|
||||
{
|
||||
public IImageDescriptor Get(Stream stream,
|
||||
int width,
|
||||
int height,
|
||||
public IImageDescriptor Get(Stream stream,
|
||||
int width,
|
||||
int height,
|
||||
bool maintainAspectRatio)
|
||||
{
|
||||
Bitmap resizedImage = imageResizer.Resize(stream, width, height, maintainAspectRatio);
|
||||
return new ImageDescriptor(resizedImage, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,4 @@ public class ImageWriter :
|
||||
bitmap.Save(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,4 @@ public class TopLevelProvider :
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user