-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#18 Make SIQuester.ViewModel cross-platform; enable new format for ne…
…w packages; add more localization
- Loading branch information
1 parent
4730b6b
commit 29a1181
Showing
29 changed files
with
346 additions
and
203 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
16 changes: 16 additions & 0 deletions
16
src/SIQuester/SIQuester.ViewModel/Contracts/IDocumentViewModelFactory.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 SIPackages; | ||
|
||
namespace SIQuester.ViewModel.Contracts; | ||
|
||
/// <summary> | ||
/// Provides method for creating documents. | ||
/// </summary> | ||
public interface IDocumentViewModelFactory | ||
{ | ||
/// <summary> | ||
/// Creates view model for the document. | ||
/// </summary> | ||
/// <param name="document">Package document.</param> | ||
/// <param name="fileName">Package file name.</param> | ||
QDocument CreateViewModelFor(SIDocument document, string? fileName = null); | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/SIQuester/SIQuester.ViewModel/ServiceCollectionExtensions.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,26 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using SIQuester.ViewModel.Contracts; | ||
using SIQuester.ViewModel.Services; | ||
using SIStorageService.ViewModel; | ||
|
||
namespace SIQuester.ViewModel; | ||
|
||
/// <summary> | ||
/// Allows to register SIQuester view model in <see cref="IServiceCollection" />. | ||
/// </summary> | ||
public static class ServiceCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Registers SIQuester view model in <see cref="IServiceCollection" />. | ||
/// </summary> | ||
/// <param name="services">Services collection.</param> | ||
public static IServiceCollection AddSIQuester(this IServiceCollection services) | ||
{ | ||
services.AddSingleton<IPackageTemplatesRepository, PackageTemplatesRepository>(); | ||
services.AddSingleton<StorageViewModel>(); | ||
services.AddSingleton<StorageContextViewModel>(); | ||
services.AddSingleton<IDocumentViewModelFactory, DocumentViewModelFactory>(); | ||
|
||
return services; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/SIQuester/SIQuester.ViewModel/Services/DocumentViewModelFactory.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,29 @@ | ||
using Microsoft.Extensions.Logging; | ||
using SIPackages; | ||
using SIQuester.ViewModel.Contracts; | ||
using SIQuester.ViewModel.Contracts.Host; | ||
|
||
namespace SIQuester.ViewModel.Services; | ||
|
||
/// <inheritdoc /> | ||
internal class DocumentViewModelFactory : IDocumentViewModelFactory | ||
{ | ||
private readonly StorageContextViewModel _storageContextViewModel; | ||
private readonly IClipboardService _clipboardService; | ||
private readonly ILoggerFactory _loggerFactory; | ||
|
||
public DocumentViewModelFactory( | ||
StorageContextViewModel storageContextViewModel, | ||
IClipboardService clipboardService, | ||
ILoggerFactory loggerFactory) | ||
{ | ||
_storageContextViewModel = storageContextViewModel; | ||
_clipboardService = clipboardService; | ||
_loggerFactory = loggerFactory; | ||
} | ||
|
||
public QDocument CreateViewModelFor(SIDocument document, string? fileName = null) => new(document, _storageContextViewModel, _clipboardService, _loggerFactory) | ||
{ | ||
FileName = fileName ?? document.Package.Name | ||
}; | ||
} |
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
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
Oops, something went wrong.