еще один шаг до последнего шага
This commit is contained in:
@@ -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)!);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user