public void GetValueFromUser(CopyMachine copyMachine, string value) { Doc = value; PrintResult(copyMachine); // Изменяется текущая сумма copyMachine.State = new DocPrinterState(); copyMachine.State.GetValueFromUser(copyMachine, Doc); }
public void GetValueFromUser(CopyMachine copyMachine, string value) { var docForPrinting = value; PrintMessage(copyMachine); // Печатается содержимое документа PrintResult(copyMachine); copyMachine.State = new ExitState(); }
public void GetValueFromUser(CopyMachine copyMachine, string value) { if (value != "usb" && value != "wi-fi") { throw new ArgumentException("Неизвестное устройство"); } Device = value; PrintResult(copyMachine); copyMachine.State = new DocSelectionState(); }
public override void ChooseDocument(CopyMachine machine, IDocument document) { Console.WriteLine($"You want to print {document.GetType()} document"); var money = Prices[document.GetType()]; if (machine.FreeMoney >= money) { machine.FreeMoney -= money; machine.State = new PrintCopyMachineState(document.GetContent()); } else { machine.State = new ChooseDeviceCopyMachineState(); } }
public void GetValueFromUser(CopyMachine copyMachine, string value) { try { Sum = int.Parse(value); } catch (FormatException) { Console.WriteLine("Введите число!"); return; } PrintResult(copyMachine); copyMachine.CurrentSum = Sum; copyMachine.State = new DeviceSelectionState(); }
public void GetValueFromUser(CopyMachine copyMachine, string value) { if (value != "да" && value != "нет") { throw new ArgumentException("Некорректный ответ"); } if (value == "нет") { Delivery = copyMachine.CurrentSum; copyMachine.CurrentSum = 0; PrintResult(copyMachine); copyMachine.State = new PaymentState(); } if (value == "да") { copyMachine.State = new DocSelectionState(); } }
public void PrintResult(CopyMachine copyMachine) { Console.WriteLine($"Ваша сдача: {Delivery}"); }
public void PrintMessage(CopyMachine copyMachine) { Console.WriteLine("Вы хотите распечатать еще один документ? (да/нет)"); }
public void PrintMessage(CopyMachine copyMachine) { Console.WriteLine("Ожидайте завершения печати..."); }
public void PrintResult(CopyMachine copyMachine) { Console.WriteLine("Печать закончена"); }
public void PrintResult(CopyMachine copyMachine) { Console.WriteLine($"Текущая сумма: {Sum}"); }
public virtual void SetDevice(CopyMachine machine, IDevice device) { throw new System.NotImplementedException(); }
public void PrintMessage(CopyMachine copyMachine) { Console.WriteLine("Введите название документа"); }
public void PrintResult(CopyMachine copyMachine) { Console.WriteLine($"Выбран документ {Doc}"); }
public override void SetDevice(CopyMachine machine, IDevice device) { Console.WriteLine($"You set {device.GetDeviceName()} device"); machine.State = new ChooseDocumentCopyMachineState(); }
public override void PutMoney(CopyMachine machine, int value) { Console.WriteLine($"You put {value}"); machine.FreeMoney = value; machine.State = new ChooseDeviceCopyMachineState(); }
public virtual int GetBackChange(CopyMachine machine) { throw new System.NotImplementedException(); }
public virtual void PrintDocument(CopyMachine machine) { throw new System.NotImplementedException(); }
public virtual void ChooseDocument(CopyMachine machine, IDocument document) { throw new System.NotImplementedException(); }
public virtual void PutMoney(CopyMachine machine, int value) { throw new System.NotImplementedException(); }
public override int GetBackChange(CopyMachine machine) { return(machine.FreeMoney); }
public void PrintMessage(CopyMachine copyMachine) { Console.WriteLine("Выберите устройство (usb/wi-fi)"); }
public override void PrintDocument(CopyMachine machine) { Console.WriteLine($"Machine printed: {_documentContent}"); machine.State = new ChooseDocumentCopyMachineState(); }
public void PrintResult(CopyMachine copyMachine) { Console.WriteLine($"Выбрано {Device} устройство"); }
public void PrintMessage(CopyMachine copyMachine) { Console.WriteLine("Внесите деньги"); }