Exemplo n.º 1
0
        public ValueConverterViewModel()
        {
            _converterFactory = new NumberConverterFactory();
            ConverterNames    = new ObservableCollection <string>(_converterFactory.ConverterNames);

            FromText           = "0";
            ToText             = "0";
            _fromConverterName = "Numerical";
            _toConverterName   = "Numerical";
            FromConverter      = _converterFactory.GetConverter(_fromConverterName);
            ToConverter        = _converterFactory.GetConverter(_toConverterName);


            ConvertCommand = new RelayCommand(ConvertNumbers);
        }
        public ValueConverterViewModel()
        {
            NumberConverterFactory = new NumberConverterFactory();
            ConverterNames         = new ObservableCollection <string>();
            NumberConverterFactory.ConverterNames.ToList().ForEach(x => ConverterNames.Add(x));

            _fromConverter = NumberConverterFactory.GetConverter(ConverterNames[0]);
            _toConverter   = NumberConverterFactory.GetConverter(ConverterNames[0]);

            FromText = "0";
            ToText   = "0";

            FromConverterName = ConverterNames[0];
            ToConverterName   = ConverterNames[0];

            ConvertCommand = new RelayCommand(ConvertNumbers);
        }