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

            viewModel.Edited += OnEdited;

            return(viewModel);
        }
コード例 #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);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #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);
            }
        }