public VMKeyModeEditable( VMContextEditable context, IKeyMode model )
            : base(context, model)
        {
            _model = model;
            _commands = new ObservableCollection<string>();

            _modeName = String.IsNullOrWhiteSpace( _model.Mode.ToString() ) ? R.DefaultMode : _model.Mode.ToString();
            _sectionName = R.ContentSection;

            foreach( var cmd in Model.OnKeyDownCommands.Commands )
            {
                _commands.Add( cmd );
            }

            foreach( var cmd in Model.OnKeyUpCommands.Commands )
            {
                _commands.Add( cmd );
            }

            foreach( var cmd in Model.OnKeyPressedCommands.Commands )
            {
                _commands.Add( cmd );
            }

            InitializeCurrentImage();

            RegisterEvents();
        }
Esempio n. 2
0
        public VMKeyModeEditable( VMContextEditable context, IKeyMode model )
            : base(context)
        {
            _model = model;
            _commands = new ObservableCollection<string>();

            foreach( var cmd in _model.OnKeyDownCommands.Commands )
            {
                _commands.Add( cmd );
            }

            foreach( var cmd in _model.OnKeyUpCommands.Commands )
            {
                _commands.Add( cmd );
            }

            foreach( var cmd in _model.OnKeyPressedCommands.Commands )
            {
                _commands.Add( cmd );
            }

            RegisterEvents();
        }
 public KeyModePropertyChangedEventArgs( IKeyMode k, string propertyName )
     : base(k, propertyName)
 {
 }
Esempio n. 4
0
 public KeyModeEventArgs( IKeyMode key )
     : base(key.Key)
 {
     KeyMode = key;
 }
 public KeyModeModeChangedEventArgs( IKeyMode key, IKeyboardMode previousMode )
     : base(key)
 {
     PreviousMode = previousMode;
 }
Esempio n. 6
0
 public VMKeyModeBase( VMContextEditable context, IKeyMode model )
     : base(context)
 {
     _model = model;
     _modelMode = model.Mode;
 }
 public KeyModeModeSwappedEventArgs( IKeyMode key, IKeyMode swappedKey )
     : base(key, swappedKey.Mode)
 {
     SwappedKey = swappedKey;
 }
Esempio n. 8
0
        private IKey InsertKeyMode( IKeyMode keyMode, IKey newKey )
        {
            //IKeyMode newKeyMode = newKey.KeyModes.Create( keyMode.Mode );
            //newKeyMode.UpLabel = keyMode.UpLabel;
            //newKeyMode.DownLabel = keyMode.DownLabel;
            //newKeyMode.Description = keyMode.Description;
            //newKeyMode.Enabled = keyMode.Enabled;

            //foreach( string keyProgram in keyMode.OnKeyDownCommands.Commands )
            //{
            //    newKeyMode.OnKeyDownCommands.Commands.Add( keyProgram );
            //}

            //foreach( string keyProgram in keyMode.OnKeyPressedCommands.Commands )
            //{
            //    newKeyMode.OnKeyPressedCommands.Commands.Add( keyProgram );
            //}

            //foreach( string keyProgram in keyMode.OnKeyUpCommands.Commands )
            //{
            //    newKeyMode.OnKeyUpCommands.Commands.Add( keyProgram );
            //}

            //TODOJL : copy all the plugindatas of the keymode onto the new keymode

            return newKey;
        }
 public void InitializeProtocolEditor( IKeyMode editedKeyMode )
 {
     EditedKeyMode = editedKeyMode;
     ProtocolEditor = new VMProtocolEditor();
 }
        public void CreateKeyCommand( string keyCommand, IKeyMode editedKeyMode )
        {
            EditedKeyMode = editedKeyMode;
            ProtocolEditor = new VMProtocolEditor();

            //not using the Split method in order to let a parameter use the ':' char
            int idx = keyCommand.IndexOf( ':' );
            string protocol = keyCommand.Substring( 0, idx );
            string parameter = keyCommand.Substring( idx + 1 );

            ProtocolEditor.Wrapper = GetProtocolEditorWrapper( protocol );
            SelectedProtocolEditorWrapper = ProtocolEditor.Wrapper;
            if( ProtocolEditor.Wrapper.IsValid )
            {
                ProtocolEditor.ParameterManager = SelectedProtocolEditorWrapper.CreateParameterManager();
                if( ProtocolEditor.ParameterManager == null ) throw new ArgumentNullException( String.Format( "Null value retrieved while trying to retrieve the IKeyCommandParameterManager for the KeyCommandTypeViewModel handling the protocol '{0}'", protocol ) );

                ProtocolEditor.ParameterManager.Root = this;
                ProtocolEditor.ParameterManager.FillFromString( parameter );
            }
            OnPropertyChanged( "ProtocolEditor" );
        }