Skip to content

Commit

Permalink
moving to mudblazor
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Dec 19, 2024
1 parent 14c32fe commit c292f05
Show file tree
Hide file tree
Showing 68 changed files with 440 additions and 1,340 deletions.
4 changes: 1 addition & 3 deletions AudioCuesheetEditor/AudioCuesheetEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blazorise.Bootstrap5" Version="1.7.1" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.7.1" />
<PackageReference Include="MetaBrainz.MusicBrainz" Version="6.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
<PackageReference Include="BlazorDownloadFile" Version="2.4.0.2" />
<PackageReference Include="Blazorise.Components" Version="1.7.1" />
<PackageReference Include="Howler.Blazor" Version="0.9.8" />
<PackageReference Include="Markdig" Version="0.39.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.0" />
<PackageReference Include="MudBlazor" Version="7.15.0" />
<PackageReference Include="Toolbelt.Blazor.HotKeys2" Version="5.1.0" />
<PackageReference Include="z440.atl.core" Version="6.10.0" />
</ItemGroup>
Expand Down
13 changes: 4 additions & 9 deletions AudioCuesheetEditor/Extensions/WebAssemblyHostExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@
//You should have received a copy of the GNU General Public License
//along with Foobar. If not, see
//<http: //www.gnu.org/licenses />.
using AudioCuesheetEditor.Data.Options;
using AudioCuesheetEditor.Model.Options;
using AudioCuesheetEditor.Services.UI;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using System.Globalization;

namespace AudioCuesheetEditor.Extensions
{
public static class WebAssemblyHostExtension
{
public async static Task SetDefaultCulture(this WebAssemblyHost host)
public async static Task SetCultureFromConfigurationAsync(this WebAssemblyHost host)
{
var localStorageOptionsProvider = host.Services.GetRequiredService<ILocalStorageOptionsProvider>();
var options = await localStorageOptionsProvider.GetOptions<ApplicationOptions>();

CultureInfo.DefaultThreadCurrentCulture = options.Culture;
CultureInfo.DefaultThreadCurrentUICulture = options.Culture;
var localizationService = host.Services.GetRequiredService<LocalizationService>();
await localizationService.SetCultureFromConfigurationAsync();
}
}
}
13 changes: 0 additions & 13 deletions AudioCuesheetEditor/Model/Options/ApplicationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@ public enum TimeSensitivityMode
public class ApplicationOptions : Validateable<ApplicationOptions>, IOptions
{
public const String DefaultCultureName = "en-US";

public static IReadOnlyCollection<CultureInfo> AvailableCultures
{
get
{
var cultures = new List<CultureInfo>
{
new("en-US"),
new("de-DE")
};
return cultures.AsReadOnly();
}
}
public String? CuesheetFilename { get; set; } = Exportfile.DefaultCuesheetFilename;
public String? CultureName { get; set; } = DefaultCultureName;
[JsonIgnore]
Expand Down
26 changes: 14 additions & 12 deletions AudioCuesheetEditor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,28 @@
using AudioCuesheetEditor.Services.IO;
using AudioCuesheetEditor.Services.UI;
using BlazorDownloadFile;
using Blazorise;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
using Howler.Blazor.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;
using Toolbelt.Blazor.Extensions.DependencyInjection;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddLocalization();
builder.Services.AddMudServices();

builder.Services.AddBlazorise(options =>
{
options.Debounce = true;
options.DebounceInterval = 300;
})
.AddBootstrap5Providers()
.AddFontAwesomeIcons();
//TODO
//builder.Services.AddBlazorise(options =>
//{
// options.Debounce = true;
// options.DebounceInterval = 300;
//})
//.AddBootstrap5Providers()
//.AddFontAwesomeIcons();

builder.Services.AddScoped<IHowl, Howl>();
builder.Services.AddScoped<IHowlGlobal, HowlGlobal>();
Expand All @@ -57,6 +58,7 @@
builder.Services.AddScoped<TextImportService>();
builder.Services.AddScoped<CuesheetImportService>();
builder.Services.AddScoped<ApplicationOptionsTimeSpanParser>();
builder.Services.AddScoped<LocalizationService>();

builder.Services.AddLogging();
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
Expand All @@ -65,6 +67,6 @@

var host = builder.Build();

await host.SetDefaultCulture();
await host.SetCultureFromConfigurationAsync();

await builder.Build().RunAsync();
await host.RunAsync();
11 changes: 0 additions & 11 deletions AudioCuesheetEditor/Resources/Localization/About/de.json

This file was deleted.

11 changes: 0 additions & 11 deletions AudioCuesheetEditor/Resources/Localization/About/en.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions AudioCuesheetEditor/Resources/Localization/CuesheetData/de.json

This file was deleted.

16 changes: 0 additions & 16 deletions AudioCuesheetEditor/Resources/Localization/CuesheetData/en.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions AudioCuesheetEditor/Resources/Localization/EditSections/de.json

This file was deleted.

17 changes: 0 additions & 17 deletions AudioCuesheetEditor/Resources/Localization/EditSections/en.json

This file was deleted.

26 changes: 0 additions & 26 deletions AudioCuesheetEditor/Resources/Localization/EditTrackModal/de.json

This file was deleted.

Loading

0 comments on commit c292f05

Please sign in to comment.