Skip to content

Commit

Permalink
namespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hope-Parnell committed Oct 28, 2024
1 parent 2de9186 commit d5010c6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -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<T>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Blazored.LocalStorage;

namespace AstroPanda.Blazor.Toolkit
namespace AstroPanda.Blazor.Toolkit;

public class PersistentStateService<T> : IPersistentStateService<T> where T: new()
{
Expand Down
41 changes: 20 additions & 21 deletions src/AstroPanda.Blazor.Toolkit/Services/PrintService.cs
Original file line number Diff line number Diff line change
@@ -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<Task<IJSObjectReference>> _embedPrintServiceTask;
private readonly Lazy<Task<IJSObjectReference>> _embedPrintServiceTask;

public PrintService(IJSRuntime js)
{
_embedPrintServiceTask = new(() => js.InvokeAsync<IJSObjectReference>("import", "./_content/AstroPanda.Blazor.Toolkit/printService.js").AsTask());
}
public PrintService(IJSRuntime js)
{
_embedPrintServiceTask = new(() => js.InvokeAsync<IJSObjectReference>("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);
}
}

0 comments on commit d5010c6

Please sign in to comment.