This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
31 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
KoeBook.Core/Contracts/Services/IDisplayStateChangeService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using KoeBook.Core.Models; | ||
|
||
namespace KoeBook.Core.Contracts.Services; | ||
|
||
public interface IDisplayStateChangeService | ||
{ | ||
/// <summary> | ||
/// 状態を更新します | ||
/// </summary> | ||
void UpdateState(BookProperties bookProperties, GenerationState state); | ||
|
||
/// <summary> | ||
/// プログレスバーを更新します | ||
/// </summary> | ||
void UpdateProgress(BookProperties bookProperties, int progress, int maximum); | ||
} |
11 changes: 0 additions & 11 deletions
11
KoeBook.Core/Contracts/Services/INotifyStateChangedService.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using KoeBook.Contracts.Services; | ||
using KoeBook.Core.Contracts.Services; | ||
using KoeBook.Core.Models; | ||
|
||
namespace KoeBook.Services; | ||
|
||
internal class DisplayStateChangeService(IGenerationTaskService taskService) : IDisplayStateChangeService | ||
{ | ||
private readonly IGenerationTaskService _taskService = taskService; | ||
|
||
public void UpdateProgress(BookProperties bookProperties, int progress, int maximum) | ||
{ | ||
var taskService = _taskService; // thisをキャプチャしないようにする | ||
_ = App.MainWindow.DispatcherQueue.TryEnqueue(() => | ||
{ | ||
var task = taskService.GetProcessingTask(bookProperties.Id); | ||
task.MaximumProgress = maximum; | ||
task.Progress = progress; | ||
}); | ||
} | ||
|
||
public void UpdateState(BookProperties bookProperties, GenerationState state) | ||
{ | ||
var taskService = _taskService; // thisをキャプチャしないようにする | ||
_ = App.MainWindow.DispatcherQueue.TryEnqueue(() => | ||
{ | ||
taskService.GetProcessingTask(bookProperties.Id).State = state; | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.