Ejemplo n.º 1
0
        public CooldownButton()
        {
            _viewModel = new CooldownButtonViewModel();

            TextProperty = new DependencyProperty <string>(
                new BindingFactory(),
                string.Empty,
                (oldValue, newValue) => _viewModel.SetText(newValue),
                null);

            EnabledColorProperty = new DependencyProperty <Color>(
                new BindingFactory(),
                Color.white,
                (oldValue, newValue) => _viewModel.SetEnabledColor(newValue),
                null);

            DisabledColorProperty = new DependencyProperty <Color>(
                new BindingFactory(),
                Color.gray,
                (oldValue, newValue) => _viewModel.SetDisabledColor(newValue),
                null);

            EnabledTextColorProperty = new DependencyProperty <Color>(
                new BindingFactory(),
                Color.black,
                (oldValue, newValue) => _viewModel.SetEnabledTextColor(newValue),
                null);

            DisabledTextColorProperty = new DependencyProperty <Color>(
                new BindingFactory(),
                Color.gray + Color.black,
                (oldValue, newValue) => _viewModel.SetDisabledTextColor(newValue),
                null);

            EnabledProgressBarColorProperty = new DependencyProperty <Color>(
                new BindingFactory(),
                Color.red,
                (oldValue, newValue) => _viewModel.SetEnabledProgressBarColor(newValue),
                null);

            DisabledProgessBarColorProperty = new DependencyProperty <Color>(
                new BindingFactory(),
                Color.red,
                (oldValue, newValue) => _viewModel.SetDisabledProgessBarColor(newValue),
                null);

            ProgressProperty = new DependencyProperty <int>(
                new BindingFactory(),
                0,
                (oldValue, newValue) => _viewModel.SetProgress(newValue),
                value => Math.Max(ProgressMinValue, Math.Min(ProgressMaxValue, value)));

            CommandProperty = new DependencyProperty <ICommand>(
                new BindingFactory(),
                null,
                (oldvalue, newValue) => _viewModel.SetCommand(newValue),
                null);
        }
Ejemplo n.º 2
0
        public CooldownButton()
        {
            _viewModel = new CooldownButtonViewModel();

            TextProperty = new DependencyProperty<string>(
                new BindingFactory(),
                string.Empty,
                (oldValue, newValue) => _viewModel.SetText(newValue),
                null);

            EnabledColorProperty = new DependencyProperty<Color>(
                new BindingFactory(),
                Color.white,
                (oldValue, newValue) => _viewModel.SetEnabledColor(newValue),
                null);

            DisabledColorProperty = new DependencyProperty<Color>(
                new BindingFactory(),
                Color.gray,
                (oldValue, newValue) => _viewModel.SetDisabledColor(newValue),
                null);

            EnabledTextColorProperty = new DependencyProperty<Color>(
                new BindingFactory(),
                Color.black,
                (oldValue, newValue) => _viewModel.SetEnabledTextColor(newValue),
                null);

            DisabledTextColorProperty = new DependencyProperty<Color>(
                new BindingFactory(),
                Color.gray + Color.black,
                (oldValue, newValue) => _viewModel.SetDisabledTextColor(newValue),
                null);

            EnabledProgressBarColorProperty = new DependencyProperty<Color>(
                new BindingFactory(),
                Color.red,
                (oldValue, newValue) => _viewModel.SetEnabledProgressBarColor(newValue),
                null);

            DisabledProgessBarColorProperty = new DependencyProperty<Color>(
                new BindingFactory(),
                Color.red,
                (oldValue, newValue) => _viewModel.SetDisabledProgessBarColor(newValue),
                null);

            ProgressProperty = new DependencyProperty<int>(
                new BindingFactory(),
                0,
                (oldValue, newValue) => _viewModel.SetProgress(newValue),
                value => Math.Max(ProgressMinValue, Math.Min(ProgressMaxValue, value)));

            CommandProperty = new DependencyProperty<ICommand>(
                new BindingFactory(),
                null,
                (oldvalue, newValue) => _viewModel.SetCommand(newValue),
                null);
        }