コード例 #1
0
        static void Main(string[] args)
        {
            IHelloWorldFactory factory = HelloWorldFactoryFactory.Instance.CreateFactory(HelloWorldFactoryType.Simple);
            var message = factory.CreateHelloWorldMessage();

            IPrintStrategy strategy = PrintStrategyFactory.Instance.GetDefaultStrategy();

            strategy.EnablePrinting(true);
            strategy.Print(message);
        }
 public IStatusCode Print(IPrintStrategy strategy, HelloWorldModel toPrint) => strategy.Print(toPrint);
コード例 #3
0
 public virtual void RealizarOperacao(string operacao)
 {
     Ligar();
     _printStrategy.Print($"Realizando operação: {operacao}");
     Desligar();
 }