From f16ccbe9e9821b5827081e357d1fdf1d6e71c094 Mon Sep 17 00:00:00 2001 From: Hope-Parnell Date: Mon, 28 Oct 2024 12:30:23 -0500 Subject: [PATCH] namespace fixes --- .../Services/IPersistentStateService.cs | 8 +--- .../Services/PeristentStateService.cs | 2 +- .../Services/PrintService.cs | 41 +++++++++---------- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs b/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs index d9d04c0..13425ec 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace AstroPanda.Blazor.Toolkit +namespace AstroPanda.Blazor.Toolkit; public interface IPersistentStateService { diff --git a/src/AstroPanda.Blazor.Toolkit/Services/PeristentStateService.cs b/src/AstroPanda.Blazor.Toolkit/Services/PeristentStateService.cs index 994d437..a21ae69 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/PeristentStateService.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/PeristentStateService.cs @@ -1,6 +1,6 @@ using Blazored.LocalStorage; -namespace AstroPanda.Blazor.Toolkit +namespace AstroPanda.Blazor.Toolkit; public class PersistentStateService : IPersistentStateService where T: new() { diff --git a/src/AstroPanda.Blazor.Toolkit/Services/PrintService.cs b/src/AstroPanda.Blazor.Toolkit/Services/PrintService.cs index 076d2d4..d3de6b3 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/PrintService.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/PrintService.cs @@ -1,31 +1,30 @@ using Microsoft.JSInterop; -namespace AstroPanda.Blazor.Toolkit +namespace AstroPanda.Blazor.Toolkit; + +public class PrintService : IPrintService, IAsyncDisposable { - public class PrintService : IPrintService, IAsyncDisposable - { - private readonly Lazy> _embedPrintServiceTask; + private readonly Lazy> _embedPrintServiceTask; - public PrintService(IJSRuntime js) - { - _embedPrintServiceTask = new(() => js.InvokeAsync("import", "./_content/AstroPanda.Blazor.Toolkit/printService.js").AsTask()); - } + public PrintService(IJSRuntime js) + { + _embedPrintServiceTask = new(() => js.InvokeAsync("import", "./_content/AstroPanda.Blazor.Toolkit/printService.js").AsTask()); + } - public async ValueTask DisposeAsync() + public async ValueTask DisposeAsync() + { + if (_embedPrintServiceTask.IsValueCreated) { - if (_embedPrintServiceTask.IsValueCreated) - { - var module = await _embedPrintServiceTask.Value; - await module.DisposeAsync(); - } - } + var module = await _embedPrintServiceTask.Value; + await module.DisposeAsync(); + } + } - public async Task Print(string targetElementId) - { - - var printService = await _embedPrintServiceTask.Value; + public async Task Print(string targetElementId) + { + + var printService = await _embedPrintServiceTask.Value; - await printService.InvokeVoidAsync("print", targetElementId); - } + await printService.InvokeVoidAsync("print", targetElementId); } }