public KeyBindingViewModel(KeyBinding keyBinding, IDialogService dialogService, KeyBindingsViewModel parent)
 {
     Model          = keyBinding;
     Parent         = parent;
     _dialogService = dialogService;
     EditCommand    = new AsyncCommand(Edit);
     DeleteCommand  = new AsyncCommand(Delete);
 }
        private KeyBindingsViewModel CreateViewModel(Command command, ICollection <KeyBinding> keyBindings)
        {
            var viewModel = new KeyBindingsViewModel(command, keyBindings, _dialogService);

            viewModel.Edited += OnEdited;

            return(viewModel);
        }
Beispiel #3
0
        private void Initialize(IDictionary <Command, ICollection <KeyBinding> > keyBindings)
        {
            _keyBindings = keyBindings;

            ClearKeyBindings();

            foreach (var value in Enum.GetValues(typeof(Command)))
            {
                var command   = (Command)value;
                var viewModel = new KeyBindingsViewModel(command, _keyBindings[command], _dialogService);
                viewModel.Edited += OnEdited;
                KeyBindings.Add(viewModel);
            }
        }
        private void Initialize(IDictionary <string, ICollection <KeyBinding> > keyBindings)
        {
            ClearKeyBindings();

            foreach (var value in Enum.GetValues(typeof(Command)))
            {
                var command   = (Command)value;
                var viewModel = new KeyBindingsViewModel(command.ToString(), _dialogService, I18N.Translate($"{nameof(Command)}.{command}"), true);
                foreach (var keyBinding in keyBindings[command.ToString()])
                {
                    viewModel.Add(keyBinding);
                }
                viewModel.Edited += OnEdited;
                KeyBindings.Add(viewModel);
            }
        }
Beispiel #5
0
        private void Initialize(IDictionary <string, ICollection <KeyBinding> > keyBindings)
        {
            _keyBindings = keyBindings;

            ClearKeyBindings();

            foreach (var value in Enum.GetValues(typeof(Command)))
            {
                var command   = (Command)value;
                var viewModel = new KeyBindingsViewModel(command.ToString(), _dialogService, EnumHelper.GetEnumDescription(command), true);
                foreach (var keyBinding in _keyBindings[command.ToString()])
                {
                    viewModel.Add(keyBinding);
                }
                viewModel.Edited += OnEdited;
                KeyBindings.Add(viewModel);
            }
        }