Skip to content

Commit

Permalink
Merge pull request #850 from LittleFish-233/master
Browse files Browse the repository at this point in the history
修改是否背景图将会实时生效
  • Loading branch information
LittleFish-233 authored Nov 18, 2024
2 parents 97f6053 + 045dbbc commit 9fb15b8
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CnGalWebSite/CnGalWebSite.Components/wwwroot/css/bundle.css
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ html {
}

.theme--light.m-application {
background-color: var(--md-sys-color-background);
background-color: transparent;
color: var(--md-sys-color-on-background);
}

Expand All @@ -968,6 +968,7 @@ html {
text-shadow: none;
}


.m-toast-detail {
white-space: pre-line;
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ html {
}

.theme--light.m-application {
background-color: var(--md-sys-color-background);
background-color: transparent;
color: var(--md-sys-color-on-background);
}

Expand All @@ -49,6 +49,7 @@ html {
text-shadow: none;
}


.m-toast-detail {
white-space: pre-line;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@inject IDataCacheService _dataCacheService
@inject IHttpService _httpService
@inject IEventService _eventService
@implements IDisposable


@if (_dataCacheService.ThemeSetting.IsTransparent)
Expand All @@ -22,6 +24,10 @@

protected override async Task OnInitializedAsync()
{
_eventService.ThemeChanged -= OnThemeChanged;
_eventService.ThemeChanged += OnThemeChanged;


var user = await authenticationStateTask;
if (user.User.Identity.IsAuthenticated&& Model==null)
{
Expand All @@ -41,5 +47,20 @@

}
}


}

public async void OnThemeChanged()
{
await InvokeAsync(StateHasChanged);
}

#region 释放实例
public void Dispose()
{
_eventService.ThemeChanged -= OnThemeChanged;
GC.SuppressFinalize(this);
}
#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ else if (_dataCacheService.ThemeSetting.ThemeMode == ThemeMode.Light)
{
<style>
body {
font-family: @_dataCacheService.ThemeSetting.FontFamily !important;
font-family: @_dataCacheService.ThemeSetting.FontFamily !important;
}
</style>
}
Expand All @@ -55,8 +55,8 @@ else if (_dataCacheService.ThemeSetting.ThemeMode == ThemeMode.Light)
{
<style>
.variable.container {
max-width: none;
padding: 0;
max-width: none;
padding: 0;
}
</style>
}
Expand Down Expand Up @@ -170,6 +170,7 @@ else if (_dataCacheService.ThemeSetting.ThemeMode == ThemeMode.Light)
{
await InvokeAsync(StateHasChanged);
_eventService.OnKanbanChanged();
_eventService.OnThemeChanged();
}

#region 释放实例
Expand Down
7 changes: 7 additions & 0 deletions CnGalWebSite/CnGalWebSite.Shared.Service/EventService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class EventService : IEventService
public event Action KanbanChanged;
public event Action UserInfoChanged;
public event Action UserCommodityChanged;
public event Action ThemeChanged;

private readonly IMauiService _mauiService;
private readonly IJSRuntime JS;
Expand Down Expand Up @@ -52,6 +53,12 @@ public void OnKanbanChanged()
KanbanChanged?.Invoke();
}

//主题设置修改
public void OnThemeChanged()
{
ThemeChanged?.Invoke();
}

//切换词条样式
public void OnSwitchStyle()
{
Expand Down
3 changes: 3 additions & 0 deletions CnGalWebSite/CnGalWebSite.Shared.Service/IEventService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface IEventService
event Action KanbanChanged;
event Action UserInfoChanged;
event Action UserCommodityChanged;
event Action ThemeChanged;

void OnKanbanChanged();

Expand All @@ -37,5 +38,7 @@ public interface IEventService
void OnUserInfoChanged();

void OnUserCommodityChanged();

void OnThemeChanged();
}
}
3 changes: 2 additions & 1 deletion CnGalWebSite/CnGalWebSite.Shared/wwwroot/css/bundle.css
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ html {
}

.theme--light.m-application {
background-color: var(--md-sys-color-background);
background-color: transparent;
color: var(--md-sys-color-on-background);
}

Expand All @@ -968,6 +968,7 @@ html {
text-shadow: none;
}


.m-toast-detail {
white-space: pre-line;
}
Expand Down

Large diffs are not rendered by default.

0 comments on commit 9fb15b8

Please sign in to comment.