void OnCurrentKeyboardChanging( object sender, CurrentKeyboardChangingEventArgs e ) { if( e.Current != null ) ChangeActiveCurrentKeyboardStatus( false ); }
void OnCurrentKeyboardChanging( object sender, CurrentKeyboardChangingEventArgs e ) { if( Highlighter.Status == InternalRunningStatus.Started ) { Highlighter.Service.UnregisterTree( _ctxVm.KeyboardVM ); } UnInitializeHighlighter(); //Saving the state of the window before doing anything (if the current keyboard is not null) if( e.Current != null && _skinWindow != null ) { WINDOWPLACEMENT placement = new WINDOWPLACEMENT(); //Invoke instead of beginInvoke because we need to save this configuration BEFORE the keyboard is changed. _skinDispatcher.Invoke( (Action)( () => placement = CKWindowTools.GetPlacement( _skinWindow.Hwnd ) ), null ); Config.User.Set( PlacementString, placement ); } if( e.Next == null ) { _skinDispatcher.BeginInvoke( (Action)( () => { if( _miniView != null && _miniView.IsVisible ) { Debug.Assert( !_viewHidden, "The miniview is visible yet _viewHidden is false" ); _miniView.Hide(); } if( _skinWindow != null && _skinWindow.IsVisible ) { _skinWindow.Hide(); } } ), null ); } else { //if the previous keyboard was null if( e.Current == null ) { _skinDispatcher.BeginInvoke( (Action)( () => { //if the view was not hidden before setting the keyboard to null if( _skinWindow != null && !_viewHidden ) { Debug.Assert( !_skinWindow.IsVisible, "Changing the current keyboard from null to an existing keyboard, but the skin view was already visible" ); _skinWindow.Show(); } else if( _miniView != null ) { Debug.Assert( !_miniView.IsVisible, "Changing the current keyboard from null to an existing keyboard, but the miniview was already visible" ); _miniView.Show(); } } ), null ); } } }