示例#1
0
        //constructor
        public ValueConverterViewModel()
        {
            _numberConverterFactory = new NumberConverterFactory();
            var temp = _numberConverterFactory.ConverterNames.ToList();

            ConverterNames = new ObservableCollection <string>(temp);

            FromText          = "0";
            ToText            = "0";
            FromConverterName = ConverterNames.First();
            ToConverterName   = ConverterNames.First();

            ConvertCommand = new RelayCommand(ConvertNumbers);
        }
        public ValueConverterViewModel()
        {
            _numberConverterFactory = new NumberConverterFactory();

            ConverterNames = new ObservableCollection <string>(_numberConverterFactory.ConverterNames);

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

            FromConverterName = _numberConverterFactory.GetConverterName(_fromConverter);
            ToConverterName   = _numberConverterFactory.GetConverterName(_toConverter);

            ConvertCommand = new RelayCommand(ConvertNumbers);
        }
        public ValueConverterViewModel()
        {
            _converterFactory = new NumberConverterFactory();

            ConverterNames = new ObservableCollection <string>(_converterFactory.ConverterNames);

            _toConverter   = _converterFactory.GetNumberConverter("Numerical");
            _fromConverter = _converterFactory.GetNumberConverter("Numerical");

            FromText          = "0";
            ToText            = "0";
            FromConverterName = "Numerical";
            ToConverterName   = "Numerical";

            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);
        }
示例#5
0
        public ValueConverterViewModel()
        {
            Factory        = new NumberConverterFactory();
            ConverterNames = new ObservableCollection <string>();
            foreach (string name in Factory.ConverterNames)
            {
                ConverterNames.Add(name);
            }

            FromConverterName = Factory.ConverterNames.First();
            ToConverterName   = Factory.ConverterNames.First();

            FromConverter = Factory.getConverter(FromConverterName);
            ToConverter   = Factory.getConverter(ToConverterName);

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

            ConvertCommand = new RelayCommand(ConvertNumbers);
        }