2025-02-23 10:18:38 +03:00
|
|
|
using System;
|
2025-02-20 16:10:09 +03:00
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2025-02-05 18:04:35 +03:00
|
|
|
using Example.Shared;
|
|
|
|
|
using mROA.Implementation;
|
|
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
namespace Example.Backend
|
2025-02-05 18:04:35 +03:00
|
|
|
{
|
2025-02-20 16:10:09 +03:00
|
|
|
public class Printer : IPrinter
|
2025-02-05 18:04:35 +03:00
|
|
|
{
|
2025-02-20 16:10:09 +03:00
|
|
|
public string Name;
|
2025-03-07 09:01:21 +03:00
|
|
|
|
2025-03-10 00:00:24 +03:00
|
|
|
public void OnPrintExternal(IPage p0, RequestContext p1)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-08 23:22:59 +03:00
|
|
|
public double Resource { get; set; } = 100d;
|
2025-03-08 19:46:59 +03:00
|
|
|
|
2025-02-20 16:10:09 +03:00
|
|
|
public string GetName()
|
|
|
|
|
{
|
|
|
|
|
return Name;
|
|
|
|
|
}
|
2025-02-05 18:04:35 +03:00
|
|
|
|
2025-03-10 00:00:24 +03:00
|
|
|
public async Task<IPage> Print(string text, bool some, RequestContext context,
|
|
|
|
|
CancellationToken cancellationToken = default)
|
2025-02-20 16:10:09 +03:00
|
|
|
{
|
|
|
|
|
// throw new Exception("The method or operation is not implemented.");
|
2025-03-07 09:01:21 +03:00
|
|
|
var page = new Page { Text = text };
|
2025-03-10 00:00:24 +03:00
|
|
|
Console.WriteLine($"Request id : :{context.RequestId}");
|
|
|
|
|
OnPrint?.Invoke(page, context);
|
2025-03-08 23:22:59 +03:00
|
|
|
Resource /= 1.5;
|
2025-03-07 09:01:21 +03:00
|
|
|
return page;
|
2025-02-20 16:10:09 +03:00
|
|
|
}
|
2025-02-23 10:18:38 +03:00
|
|
|
|
2025-03-10 00:00:24 +03:00
|
|
|
public event Action<IPage, RequestContext>? OnPrint;
|
2025-03-07 09:01:21 +03:00
|
|
|
|
2025-02-23 10:18:38 +03:00
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2025-03-07 09:01:21 +03:00
|
|
|
Console.WriteLine(
|
|
|
|
|
"Dispose printer with name {0}, Dispose works, Dispose works, Dispose works, Dispose works,", Name);
|
2025-02-23 10:18:38 +03:00
|
|
|
}
|
2025-02-05 18:04:35 +03:00
|
|
|
}
|
|
|
|
|
}
|