Exemple #1
0
        public override int GetChange(PrintMachine machine)
        {
            var deposit = machine.Deposit;

            machine.State   = new InitState();
            machine.Deposit = 0;
            machine.Type    = DeviceTypes.None;
            return(deposit);
        }
Exemple #2
0
        public override void Print(PrintMachine machine)
        {
            if (machine.Deposit - machine.Cost < 0)
            {
                Console.WriteLine("Money not enough =(");
                machine.State = machine.Deposit > 0 ? (StateBase) new GetShortChangeState() : new InitState();
                return;
            }

            Console.WriteLine($"The document '{machine.Filename}' was printed");
            machine.Deposit -= machine.Cost;
            machine.State    = new ContinueOrChangeState();
        }
Exemple #3
0
 public override void SetDevice(DeviceTypes type, PrintMachine machine)
 {
     throw new Exception("The change must be taken");
 }
Exemple #4
0
 public override void SetDocument(string filename, PrintMachine machine)
 {
     throw new Exception("The document was setted");
 }
Exemple #5
0
        public override int GetChange(PrintMachine machine)
        {
            var getChangeState = new GetShortChangeState();

            return(getChangeState.GetChange(machine));
        }
 public override int GetChange(PrintMachine machine)
 {
     throw new Exception("PrintMachine wants document selection");
 }
 public override void SetDocument(string filename, PrintMachine machine)
 {
     machine.Filename = filename;
     machine.State    = new PrintState();
 }
 public override void SetDocument(string filename, PrintMachine machine)
 {
     throw new Exception("PrintMachine wants device selection");
 }
 public abstract void Print(PrintMachine machine);
 public override void SetMoney(int count, PrintMachine machine)
 {
     machine.Deposit = count;
     machine.State   = new DeviceSelectionState();
 }
 public override void SetDevice(DeviceTypes type, PrintMachine machine)
 {
     machine.Type  = type;
     machine.State = new DocumentSelectionState();
 }
 public override int GetChange(PrintMachine machine)
 {
     throw new Exception("PrintMachine wants money");
 }
 public override void Print(PrintMachine machine)
 {
     throw new Exception("PrintMachine wants money");
 }
 public override void SetDevice(DeviceTypes type, PrintMachine machine)
 {
     throw new Exception("PrintMachine wants money");
 }
Exemple #15
0
 public override void SetDocument(string filename, PrintMachine machine)
 {
     throw new Exception("The change must be taken");
 }
 public abstract int GetChange(PrintMachine machine);
Exemple #17
0
 public override void Print(PrintMachine machine)
 {
     throw new Exception("The change must be taken");
 }
 public abstract void SetMoney(int count, PrintMachine machine);
 public override void SetDevice(DeviceTypes type, PrintMachine machine)
 {
     throw new Exception("The device was setted");
 }
 public abstract void SetDevice(DeviceTypes type, PrintMachine machine);
 public override void Print(PrintMachine machine)
 {
     throw new Exception("PrintMachine wants document selection");
 }
 public abstract void SetDocument(string filename, PrintMachine machine);
 public override void SetMoney(int count, PrintMachine machine)
 {
 }
Exemple #24
0
        public override void SetDocument(string filename, PrintMachine machine)
        {
            var docSelectState = new DocumentSelectionState();

            docSelectState.SetDocument(filename, machine);
        }