еще один шаг до последнего шага

This commit is contained in:
2025-02-13 19:38:54 +03:00
parent 59c77bc9df
commit e5253138db
17 changed files with 125 additions and 31 deletions
+13 -1
View File
@@ -8,8 +8,20 @@ namespace Example.Backend;
[SharedObjectSingleton]
public class PrinterFactory : IPrinterFactory
{
private List<IPrinter> _printers = new();
public SharedObject<IPrinter> Create(string printerName)
{
return new Printer {Name = printerName};
return new Printer { Name = printerName };
}
public void Register(SharedObject<IPrinter> printer)
{
_printers.Add(printer.Value);
}
public SharedObject<IPrinter> GetPrinterByName(string printerName)
{
return new SharedObject<IPrinter>(_printers.Find(i => i.GetName() == printerName)!);
}
}