/// <summary> /// Gets the <see cref="VMProtocolEditorWrapper"/> for the specified protocol. /// If the protocol is not handled, returns an empty <see cref="VMProtocolEditorWrapper"/>, with a IsValid property returning false /// </summary> /// <param name="protocol">The protocol (ex : sendString, sendKey, keyboardswitch...)</param> /// <returns>The <see cref="VMProtocolEditorWrapper"/> corresponding to the protocol set as parameter. if the returned object's IsValid property returns false, the protocol is not handled</returns> public VMProtocolEditorWrapper GetProtocolEditorWrapper( string protocol ) { //If the protocol is not recognized, we'll add an Invalid KeyCommandType. VMProtocolEditorWrapper editorWrapper = new VMProtocolEditorWrapper( protocol, protocol ); if( _availableProtocolEditors.TryGetValue( protocol, out editorWrapper ) ) { return editorWrapper; } return new VMProtocolEditorWrapper( protocol, protocol ); }
public void Register( VMProtocolEditorWrapper vmProtocolEditorWrapper, Type handlingService ) { //TODO : The register should take a DataTemplate as parameter, to add it dynamically to the DataTemplateSelector used to create the keys. _vmProtocolEditorsProvider.AddEditor( vmProtocolEditorWrapper.Protocol, vmProtocolEditorWrapper, handlingService ); }
public void AddEditor( string protocol, VMProtocolEditorWrapper wrapper, Type handlingService ) { _availableProtocolEditors.Add( protocol, wrapper ); _availableProtocolHandlers.Add( protocol, handlingService ); OnPropertyChanged( "AvailableProtocolEditors" ); }