From 2de91865691d59833eadfa5f35797bf393a90e83 Mon Sep 17 00:00:00 2001 From: Hope-Parnell Date: Mon, 28 Oct 2024 12:27:25 -0500 Subject: [PATCH] change namespace --- .../Components/ContextMenu.razor | 4 +- .../Components/ContextMenu.razor.cs | 2 +- .../Components/ContextMenuProvider.razor | 5 +- .../Components/ContextMenuProvider.razor.cs | 86 +++++++++---------- .../Extensions/ServiceCollectionExtensions.cs | 1 - .../ContextMenu/ContextMenuReference.cs | 5 +- .../ContextMenu/ContextMenuService.cs | 5 +- .../ContextMenu/IContextMenuReference.cs | 2 +- .../ContextMenu/IContextMenuService.cs | 2 +- .../Services/IPersistentStateService.cs | 2 +- .../Services/PeristentStateService.cs | 2 +- .../Components/ExampleContextMenu.razor | 2 +- .../Layout/MainLayout.razor | 2 - src/BlazorToolkit.Wasm/Pages/Home.razor | 2 +- 14 files changed, 60 insertions(+), 62 deletions(-) diff --git a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor index 0fc208c..3cc7eb5 100644 --- a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor +++ b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor @@ -1,4 +1,6 @@ -
@Content
\ No newline at end of file diff --git a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor.cs b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor.cs index 324c7d7..10878a3 100644 --- a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor.cs +++ b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenu.razor.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components; -namespace AstroPanda.Blazor.Toolkit.Components +namespace AstroPanda.Blazor.Toolkit { public partial class ContextMenu { diff --git a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor index 7e3a2f7..a4b02a2 100644 --- a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor +++ b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor @@ -1,4 +1,7 @@ - + +@namespace AstroPanda.Blazor.Toolkit + + @foreach (var item in _contextMenus) { @item.Content diff --git a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor.cs b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor.cs index 4a5bd42..3a88f46 100644 --- a/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor.cs +++ b/src/AstroPanda.Blazor.Toolkit/Components/ContextMenuProvider.razor.cs @@ -1,51 +1,49 @@ using Microsoft.AspNetCore.Components.Routing; using Microsoft.AspNetCore.Components; -using AstroPanda.Blazor.Toolkit.Services; -namespace AstroPanda.Blazor.Toolkit.Components +namespace AstroPanda.Blazor.Toolkit; + +public partial class ContextMenuProvider : IDisposable { - public partial class ContextMenuProvider : IDisposable + [Inject] + private IContextMenuService _contextMenuService { get; set; } + + [Inject] + private NavigationManager _navigationManager { get; set; } + + private List _contextMenus { get; set; } = new List(); + + + protected override void OnInitialized() + { + ((ContextMenuService)_contextMenuService).OnInstanceAdded += AddInstance; + ((ContextMenuService)_contextMenuService).OnInstanceCloseRequested += CloseAll; + + if (_navigationManager != null) + _navigationManager.LocationChanged += HandleLocationChanged; + } + + private void AddInstance(ContextMenuReference contextMenu) + { + _contextMenus.Clear(); + _contextMenus.Add(contextMenu); + StateHasChanged(); + } + + public void CloseAll() + { + _contextMenus.Clear(); + StateHasChanged(); + } + + private void HandleLocationChanged(object sender, LocationChangedEventArgs args) + { + CloseAll(); + } + + public void Dispose() { - [Inject] - private IContextMenuService _contextMenuService { get; set; } - - [Inject] - private NavigationManager _navigationManager { get; set; } - - private List _contextMenus { get; set; } = new List(); - - - protected override void OnInitialized() - { - ((ContextMenuService)_contextMenuService).OnInstanceAdded += AddInstance; - ((ContextMenuService)_contextMenuService).OnInstanceCloseRequested += CloseAll; - - if (_navigationManager != null) - _navigationManager.LocationChanged += HandleLocationChanged; - } - - private void AddInstance(ContextMenuReference contextMenu) - { - _contextMenus.Clear(); - _contextMenus.Add(contextMenu); - StateHasChanged(); - } - - public void CloseAll() - { - _contextMenus.Clear(); - StateHasChanged(); - } - - private void HandleLocationChanged(object sender, LocationChangedEventArgs args) - { - CloseAll(); - } - - public void Dispose() - { - if (_navigationManager != null) - _navigationManager.LocationChanged -= HandleLocationChanged; - } + if (_navigationManager != null) + _navigationManager.LocationChanged -= HandleLocationChanged; } } diff --git a/src/AstroPanda.Blazor.Toolkit/Extensions/ServiceCollectionExtensions.cs b/src/AstroPanda.Blazor.Toolkit/Extensions/ServiceCollectionExtensions.cs index fdf3835..e2cc698 100644 --- a/src/AstroPanda.Blazor.Toolkit/Extensions/ServiceCollectionExtensions.cs +++ b/src/AstroPanda.Blazor.Toolkit/Extensions/ServiceCollectionExtensions.cs @@ -1,4 +1,3 @@ -using AstroPanda.Blazor.Toolkit.Services; using BlazorComponentBus; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuReference.cs b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuReference.cs index 8b540f2..4ac37f1 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuReference.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuReference.cs @@ -1,7 +1,6 @@ -using AstroPanda.Blazor.Toolkit.Components; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; -namespace AstroPanda.Blazor.Toolkit.Services; +namespace AstroPanda.Blazor.Toolkit; public class ContextMenuReference : IContextMenuReference { diff --git a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuService.cs b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuService.cs index 7042b4e..a0a5ea6 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuService.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/ContextMenuService.cs @@ -1,7 +1,6 @@ -using AstroPanda.Blazor.Toolkit.Components; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; -namespace AstroPanda.Blazor.Toolkit.Services; +namespace AstroPanda.Blazor.Toolkit; public class ContextMenuService : IContextMenuService { diff --git a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuReference.cs b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuReference.cs index 6a01f01..17c371c 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuReference.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuReference.cs @@ -1,5 +1,5 @@  -namespace AstroPanda.Blazor.Toolkit.Services; +namespace AstroPanda.Blazor.Toolkit; public interface IContextMenuReference { diff --git a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuService.cs b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuService.cs index 6138138..13cfe60 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuService.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/ContextMenu/IContextMenuService.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components; -namespace AstroPanda.Blazor.Toolkit.Services; +namespace AstroPanda.Blazor.Toolkit; public interface IContextMenuService { diff --git a/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs b/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs index ec553ed..d9d04c0 100644 --- a/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs +++ b/src/AstroPanda.Blazor.Toolkit/Services/IPersistentStateService.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace AstroPanda.Blazor.Toolkit.Services; +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 87de674..994d437 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.Services; +namespace AstroPanda.Blazor.Toolkit public class PersistentStateService : IPersistentStateService where T: new() { diff --git a/src/BlazorToolkit.Wasm/Components/ExampleContextMenu.razor b/src/BlazorToolkit.Wasm/Components/ExampleContextMenu.razor index 970859e..f63e86a 100644 --- a/src/BlazorToolkit.Wasm/Components/ExampleContextMenu.razor +++ b/src/BlazorToolkit.Wasm/Components/ExampleContextMenu.razor @@ -1,4 +1,4 @@ -@using AstroPanda.Blazor.Toolkit.Services +@using AstroPanda.Blazor.Toolkit Close diff --git a/src/BlazorToolkit.Wasm/Layout/MainLayout.razor b/src/BlazorToolkit.Wasm/Layout/MainLayout.razor index b843723..8c25f88 100644 --- a/src/BlazorToolkit.Wasm/Layout/MainLayout.razor +++ b/src/BlazorToolkit.Wasm/Layout/MainLayout.razor @@ -1,8 +1,6 @@ @inherits LayoutComponentBase @using AstroPanda.Blazor.Toolkit -@using AstroPanda.Blazor.Toolkit.Services @using BlazorToolkit.Wasm.Components -@using AstroPanda.Blazor.Toolkit.Components @using MudBlazor diff --git a/src/BlazorToolkit.Wasm/Pages/Home.razor b/src/BlazorToolkit.Wasm/Pages/Home.razor index 1ca96e6..2adaac8 100644 --- a/src/BlazorToolkit.Wasm/Pages/Home.razor +++ b/src/BlazorToolkit.Wasm/Pages/Home.razor @@ -1,5 +1,5 @@ @page "/" -@using AstroPanda.Blazor.Toolkit.Components +@using AstroPanda.Blazor.Toolkit Home