This commit is contained in:
2026-05-22 10:50:25 +02:00
parent 45377ea61c
commit f510cfb5ad
50 changed files with 15186 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using DevExpress.DataAccess.Json;
using DevExpress.DataAccess.Web;
using DevExpress.DataAccess.Wizard.Services;
namespace EnvelopeGenerator.ReceiverUI.Services
{
public class CustomDataSourceWizardJsonDataConnectionStorage : IDataSourceWizardJsonConnectionStorage
{
public static JsonDataConnection GetDefaultConnection() {
var uriJsonSource = new UriJsonSource() {
Uri = new Uri(@"https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json"),
};
return new JsonDataConnection(uriJsonSource) { StoreConnectionNameOnly = true, Name = "NWindProductsJson" };
}
public static List<JsonDataConnection> GetConnections() {
var connections = new List<JsonDataConnection> {
GetDefaultConnection()
};
return connections;
}
bool IJsonConnectionStorageService.CanSaveConnection => false;
bool IJsonConnectionStorageService.ContainsConnection(string connectionName) {
return GetConnections().Any(x => x.Name == connectionName);
}
IEnumerable<JsonDataConnection> IJsonConnectionStorageService.GetConnections() {
return GetConnections();
}
JsonDataConnection IJsonDataConnectionProviderService.GetJsonDataConnection(string name) {
var connection = GetConnections().FirstOrDefault(x => x.Name == name);
if(connection == null)
throw new InvalidOperationException();
return connection;
}
void IJsonConnectionStorageService.SaveConnection(string connectionName, JsonDataConnection connection, bool saveCredentials) { }
}
}

View File

@@ -0,0 +1,24 @@
using DevExpress.DataAccess.Json;
using DevExpress.DataAccess.Web;
namespace EnvelopeGenerator.ReceiverUI.Services
{
public class CustomJsonDataConnectionProviderFactory : IJsonDataConnectionProviderFactory {
public IJsonDataConnectionProviderService Create() {
return new WebDocumentViewerJsonDataConnectionProvider(CustomDataSourceWizardJsonDataConnectionStorage.GetConnections());
}
}
public class WebDocumentViewerJsonDataConnectionProvider : IJsonDataConnectionProviderService
{
readonly List<JsonDataConnection> jsonDataConnections;
public WebDocumentViewerJsonDataConnectionProvider(List<JsonDataConnection> jsonDataConnections) {
this.jsonDataConnections = jsonDataConnections;
}
public JsonDataConnection GetJsonDataConnection(string name) {
var connection = jsonDataConnections.FirstOrDefault(x => x.Name == name);
if(connection == null)
throw new InvalidOperationException();
return connection;
}
}
}

View File

@@ -0,0 +1,12 @@
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Services;
using EnvelopeGenerator.ReceiverUI.PredefinedReports;
namespace EnvelopeGenerator.ReceiverUI.Services
{
public class CustomReportProvider : IReportProviderAsync {
public Task<XtraReport> GetReportAsync(string id, ReportProviderContext context) {
return Task.FromResult(ReportsFactory.GetReport(id));
}
}
}

View File

@@ -0,0 +1,12 @@
using DevExpress.Drawing;
namespace EnvelopeGenerator.ReceiverUI.Services {
public static class FontLoader {
public async static Task LoadFonts(HttpClient httpClient, List<string> fontNames) {
foreach(var fontName in fontNames) {
var fontBytes = await httpClient.GetByteArrayAsync($"fonts/{fontName}");
DXFontRepository.Instance.AddFont(fontBytes);
}
}
}
}

View File

@@ -0,0 +1,9 @@
using DevExpress.DataAccess.Web;
namespace EnvelopeGenerator.ReceiverUI.Services {
public class ObjectDataSourceWizardCustomTypeProvider : IObjectDataSourceWizardTypeProvider {
public IEnumerable<Type> GetAvailableTypes(string context) {
return new[] { typeof(Data.DataItemList) };
}
}
}