-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from r-koubou/refavtor/find_usecase
FindUseCaseの改修
- Loading branch information
Showing
10 changed files
with
96 additions
and
106 deletions.
There are no files selected for viewing
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
1 change: 1 addition & 0 deletions
1
...er/Sources/Runtime/Applications/Standalone.Core/Controllers/Find/FindControllerFactory.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
46 changes: 0 additions & 46 deletions
46
...tchManager/Sources/Runtime/Applications/Standalone.Core/Controllers/Find/FindPresenter.cs
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
KeySwitchManager/Sources/Runtime/Applications/Standalone.Core/Presenters/FindPresenter.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,43 @@ | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
using KeySwitchManager.Applications.Standalone.Core.Views.LogView; | ||
using KeySwitchManager.UseCase.KeySwitches.Find; | ||
|
||
namespace KeySwitchManager.Applications.Standalone.Core.Presenters | ||
{ | ||
public sealed class FindPresenter : IFindPresenter | ||
{ | ||
private ILogTextView TextView { get; } | ||
|
||
public FindPresenter( ILogTextView textView ) | ||
{ | ||
TextView = textView; | ||
} | ||
|
||
public async Task HandleAsync( FindOutputData outputData, CancellationToken cancellationToken = default ) | ||
{ | ||
var sb = new StringBuilder( 128 ); | ||
var keySwitches = outputData.Value.Result; | ||
|
||
foreach( var k in keySwitches.OrderBy( x => x.DeveloperName.Value ) | ||
.ThenBy( x => x.ProductName.Value ) | ||
.ThenBy( x => x.InstrumentName.Value ) ) | ||
{ | ||
sb.Clear(); | ||
sb.Append( k ); | ||
TextView.Append( sb.ToString() ); | ||
} | ||
|
||
TextView.Append( "---------------------------------" ); | ||
TextView.Append( $"{keySwitches.Count} record(s) found" ); | ||
TextView.Append( "Complete" ); | ||
|
||
TextView.ScrollToEnd(); | ||
|
||
await Task.CompletedTask; | ||
} | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Find/FindOutputData.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,9 @@ | ||
using KeySwitchManager.UseCase.Commons; | ||
|
||
namespace KeySwitchManager.UseCase.KeySwitches.Find | ||
{ | ||
public sealed class FindOutputData : InputData<FindOutputValue> | ||
{ | ||
public FindOutputData( FindOutputValue value ) : base( value ) {} | ||
} | ||
} |
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
11 changes: 2 additions & 9 deletions
11
KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Find/IFindUseCase.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 |
---|---|---|
@@ -1,13 +1,6 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using KeySwitchManager.UseCase.Commons; | ||
|
||
namespace KeySwitchManager.UseCase.KeySwitches.Find | ||
{ | ||
public interface IFindUseCase | ||
{ | ||
public FindResponse Execute( FindRequest request ) | ||
=> ExecuteAsync( request ).GetAwaiter().GetResult(); | ||
|
||
public Task<FindResponse> ExecuteAsync( FindRequest request, CancellationToken cancellationToken = default ); | ||
} | ||
public interface IFindUseCase : IInputPort<FindInputData> {} | ||
} |