Ejemplo n.º 1
0
        public List <Product> Calulate(string c)
        {
            var tmp = new List <Product>();

            tmp = ProductSingleton.Instance.GetProduct();

            ContextStrategy context = null;

            switch (c)
            {
            case "Zloty":
                context = new ContextStrategy(new Zloty());
                break;

            case "Dolar":
                context = new ContextStrategy(new Dolar());
                break;

            case "Euro":
                context = new ContextStrategy(new Euro());
                break;

            case "Funt":
                context = new ContextStrategy(new Funt());
                break;

            default:
                break;
            }
            return(context.Calculate(tmp));
        }
Ejemplo n.º 2
0
        public List <Car> Calulate(string c)
        {
            var tmp = new List <Car>();

            tmp = CarSingleton.Instance.GetCar();

            ContextStrategy context = null;

            switch (c)
            {
            case "Kmh":
                context = new ContextStrategy(new Kmh());
                break;

            case "Mph":
                context = new ContextStrategy(new Mph());
                break;

            default:
                break;
            }
            return(context.Calculate(tmp));
        }