![]() |
VOOZH | about |
dotnet add package Darp.Utils.CodeMirror --version 1.20.0
NuGet\Install-Package Darp.Utils.CodeMirror -Version 1.20.0
<PackageReference Include="Darp.Utils.CodeMirror" Version="1.20.0" />
<PackageVersion Include="Darp.Utils.CodeMirror" Version="1.20.0" />Directory.Packages.props
<PackageReference Include="Darp.Utils.CodeMirror" />Project file
paket add Darp.Utils.CodeMirror --version 1.20.0
#r "nuget: Darp.Utils.CodeMirror, 1.20.0"
#:package Darp.Utils.CodeMirror@1.20.0
#addin nuget:?package=Darp.Utils.CodeMirror&version=1.20.0Install as a Cake Addin
#tool nuget:?package=Darp.Utils.CodeMirror&version=1.20.0Install as a Cake Tool
👁 Test (and publish)
👁 License
This repository bundles all open source c# helper modules of 'rosslight GmbH'. To extend, add a new project and test project.
A collection of simple interfaces for app assets targeting desktop apps.
Currently implemented:
FolderAssetsService: Read or write to a specific folder
DI extensions provide helpers for ApplicationData, ProgramData, and the App's BaseDirectoryEmbeddedResourceAssetsService: Read files marked as EmbeddedResource of a specific AssemblyMemoryAssetsService: InMemory service that can be used for testingWhen using DI, it is possible to retrieve the following services:
IAssetsFactory: A factory which is able to retrieve named asset servicesIReadOnlyAssets: The base interface which provides readonly access to your assetsIAssetsService: A writable view on your assets, extends IReadOnlyAssetsIFolderAssetsService: A writable view on your assets with helpers specific to a directoryNamed asset services:
IAssetFactory by supplying the nameExample:
// Add EmbeddedResources and AppData assets to the DI Container
ServiceProvider provider = new ServiceCollection()
.AddAppDataAssetsService(relativePath: "RelativePath")
.AddEmbeddedResourceAssetsService(name: "AssemblyResources", typeof(Test).Assembly)
.BuildServiceProvider();
// Example read and write operations with the app data
IAssetsService service = provider.GetRequiredService<IAssetsService>();
await service.SerializeJsonAsync("test.json", new Test("value"));
Test deserialized = await service.DeserializeJsonAsync<Test>("test.json");
await service.WriteTextAsync("test2.txt", "some content");
// Retrieve a named assets service and copy an embedded resource to the app data
IAssetsFactory factory = provider.GetRequiredService<IAssetsFactory>();
IReadOnlyAssetsService resourceService = factory.GetReadOnlyAssets("AssemblyResources");
await resourceService.CopyToAsync("test.json", service, "test.json");
file sealed record Test(string Prop1);
A writable configuration service. Can be registered using DI and injected into target services. Usage might include reading, writing and listening to changes via the INotifyPropertyChanged interface.
Example:
ServiceProvider provider = new ServiceCollection()
.AddAppDataAssetsService("RelativePath")
.AddConfigurationFile<TestConfig>("config.json")
.BuildServiceProvider();
IConfigurationService<TestConfig> service = provider.GetRequiredService<IConfigurationService<TestConfig>>();
TestConfig config = await service.LoadConfigurationAsync();
await service.WriteConfigurationAsync(config with { Setting = "NewValue" });
A code editor control that supports C# based on a WebView with CodeMirror.
First, create the backend service. It will host a minimal webserver which provides the backend. Afterwards, you can create the editor in the code behind or in xaml:
ICodeMirrorService codeMirrorService = new CodeMirrorService();
await vm.CodeMirror.StartBackendAsync(
onBuild: builder => builder.Services.AddLogging(loggingBuilder => loggingBuilder.AddConsole()),
onConfigureCSharp: options => options.SetScriptMode(true)
);
var editor = new CodeMirrorEditor();
editor.Address = codeMirrorService.Address;
editor.EditorText = "int i = 42";
editor.IsEditorReadOnly = false;
A lightweight dialog service which allows for opening dialogs from the ViewModel.
| Implementation | Description |
|---|---|
| 👁 NuGet |
Implementation based on FluentAvalonia |
Example:
ServiceProvider provider = new ServiceCollection()
.AddSingleton<IDialogService, AvaloniaDialogService>()
.BuildServiceProvider();
IDialogService dialogService = provider.GetRequiredService<IDialogService>();
// Specify the Type of the dataContext of the window the dialog is supposed to be shown on
// .WithDialogRoot<MainWindowViewModel>()
await dialogService.CreateMessageBoxDialog("Title", "Message").ShowAsync();
// Assumes you have registered a view for 'SomeViewModel' in a ViewLocator
// Works with any kind of content
var viewModel = new SomeViewModel();
await dialogService.CreateContentDialog("Title", viewModel)
.SetDefaultButton(ContentDialogButton.Primary)
.SetCloseButton("Close")
.SetPrimaryButton("Ok", onClick: model => model.IsModelValid)
.ShowAsync();
A collection of classes and methods to help reduce the boilerplate when working with Avalonia. These contain:
ViewLocatorBase: Resolve views at compile-timeUserControlBase, WindowBase: Add a ViewModel property to have typed access to the DataContextAvaloniaHelpers: A collection of helper methodsA source generator for generating strongly typed singleton resource classes from .resx files. Additional documentation here.
A library allowing for communication with a TestRail instance in a easy and modern way.
Core features:
ITestRailService is the core with a bunch of extension methods defining the actual APIITestRailService which can be mocked easilyGetting started:
var service = TestRailService.Create("https://[your-organization].testrail.io", "username", "passwordOrApiKey");
var projectsEnumerable = service.GetProjects(ProjectsFilter.ActiveProjectsOnly);
await foreach (var project in projectsEnumerable)
{
var casesEnumerable = service.GetCases(project.Id);
}
var caseResponse = await service.GetCaseAsync((CaseId)1);
var customProperty = caseResponse.Properties["custom_property"].GetString();
await service.UpdateCase(new UpdateCaseRequest { CaseId = caseResponse.Id, Title = "New Title" });
Extension methods:
public static async Task<GetCaseResponse> GetCaseAsync(this ITestRailService testRailService, CaseId caseId)
{
var jsonTypeInfo = YourSourceGenerationContext.Default.GetCaseResponse;
return await testRailService.GetAsync($"/get_case/{(int)caseId}", jsonTypeInfo, default(cancellationToken));
}
Usage with IHttpClientFactory for http client caching:
var provider = new ServiceCollection()
.AddHttpClient("TestRailClient", (provider, client) =>
{
client.BaseAddress = new Uri("https://[your-organization].testrail.io");
var authBytes = Encoding.UTF8.GetBytes("username:passwordOrApiKey");
var base64Authorization = Convert.ToBase64String(authBytes);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64Authorization);
client.DefaultRequestHeaders.Add("Accept", "application/json");
})
.AddSingleton<ITestRailService>(provider => new TestRailService<IHttpClientFactory>(
provider.GetRequiredService<IHttpClientFactory>(),
factory => factory.CreateClient("TestRailClient"),
NullLogger.Instance))
.BuildServiceProvider();
var service = provider.GetRequiredService<ITestRailService>();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.