Wrapper on a IKeyboardMode that enables setting the IsChecked property, automatically triggering a command on the holder that activates or deactivates the current mode. Also has a command setting the holder's current mode to the one embedded in this class. (deactivates all mode that is not contained in the embedded one)
Inheritance: CK.WPF.ViewModel.VMBase
        internal void RefreshKeyboardModelViewModels()
        {
            _currentLayoutKeyModeModeVM = new VMKeyboardMode( _context, Model.CurrentLayout.Current.Mode );
            _currentKeyModeModeVM = new VMKeyboardMode( _context, Model.Current.Mode );

            OnPropertyChanged( "KeyModeVM" );
            OnPropertyChanged( "LayoutKeyModeVM" );

            foreach( var keyMode in KeyModes )
            {
                keyMode.TriggerPropertyChanged( "IsSelected" );
                keyMode.TriggerModeChanged();
            }

            foreach( var layoutKeyMode in LayoutKeyModes )
            {
                layoutKeyMode.TriggerPropertyChanged( "IsSelected" );
                layoutKeyMode.TriggerModeChanged();
            }

            OnPropertyChanged( "IsSelected" );
            OnPropertyChanged( "CurrentKeyModeModeVM" );
            OnPropertyChanged( "CurrentLayoutKeyModeModeVM" );
        }
Exemplo n.º 2
0
        public VMKeyEditable( VMContextEditable ctx, IKey k )
            : base(ctx)
        {
            //By default, we show the fallback.
            ShowFallback = FallbackVisibility.FallbackOnLayout | FallbackVisibility.FallbackOnKeyMode;

            _context = ctx;
            _key = k;

            _actionsOnPropertiesChanged = new Dictionary<string, ActionSequence>();

            _context = ctx;
            KeyDownCommand = new CK.Windows.App.VMCommand( () => _context.SelectedElement = this );
            _currentKeyModeModeVM = new VMKeyboardMode( _context, k.Current.Mode );
            _currentLayoutKeyModeModeVM = new VMKeyboardMode( _context, k.CurrentLayout.Current.Mode );

            _layoutKeyModes = new ObservableCollection<VMLayoutKeyModeEditable>();
            _keyModes = new ObservableCollection<VMKeyModeEditable>();

            RefreshKeyModeCollection();
            RefreshLayoutKeyModeCollection();

            GetImageSourceCache();

            RegisterEvents();
        }