Files

61 lines
1.6 KiB
C#
Raw Permalink Normal View History

2025-02-23 10:18:38 +03:00
using System;
using System.Threading;
using System.Threading.Tasks;
using Example.Shared;
using mROA.Implementation;
namespace Example.Backend
{
public class Printer : IPrinter
{
public string Name;
2025-05-03 21:43:02 +03:00
public async Task SomeoneIsApproaching(string humanName)
{
Console.WriteLine(humanName + " is approaching");
}
2025-05-14 12:58:14 +03:00
public Task SetFingerPrint(int[] fingerPrint)
{
Console.WriteLine(fingerPrint.Length);
return Task.CompletedTask;
2025-06-03 12:09:32 +03:00
}
public Task IntTest(MyData data)
{
Console.WriteLine(data);
return Task.CompletedTask;
2025-05-14 12:58:14 +03:00
}
public void OnPrintExternal(IPage p0, RequestContext ro)
{
OnPrint?.Invoke(p0, ro);
}
public double Resource { get; set; } = 100d;
public string GetName()
{
return Name;
}
public async Task<IPage> Print(string text, bool some, RequestContext context,
CancellationToken cancellationToken = default)
{
// throw new Exception("The method or operation is not implemented.");
var page = new Page { Text = text };
Console.WriteLine($"Request id : :{context.RequestId}");
OnPrint?.Invoke(page, context);
Resource /= 1.5;
return page;
}
2025-02-23 10:18:38 +03:00
public event Action<IPage, RequestContext>? OnPrint;
2025-02-23 10:18:38 +03:00
public void Dispose()
{
Console.WriteLine(
"Dispose printer with name {0}, Dispose works, Dispose works, Dispose works, Dispose works,", Name);
2025-02-23 10:18:38 +03:00
}
}
}