void ShowMiniView() { if( _miniView == null ) { _miniViewVm = new MiniViewVM( this ); _miniView = new MiniView( RestoreSkin ) { DataContext = _miniViewVm }; _miniView.Closing += new CancelEventHandler( OnWindowClosing ); _miniView.Show(); if( !ScreenHelper.IsInScreen( new System.Drawing.Point( (int)( _miniViewVm.X + (int)_miniView.ActualWidth / 2 ), _miniViewVm.Y + (int)_miniView.ActualHeight / 2 ) ) || !ScreenHelper.IsInScreen( new System.Drawing.Point( (int)( _miniViewVm.X + (int)_miniView.ActualWidth ), _miniViewVm.Y + (int)_miniView.ActualHeight ) ) ) { _miniView.Left = 0; _miniView.Top = 0; } } else { _miniView.Show(); } }
void ShowMiniView() { Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." ); if( _miniView == null ) { _miniViewVm = new MiniViewVM( this ); _miniView = new MiniView( RestoreSkin ) { DataContext = _miniViewVm }; _miniView.Show(); if( !ScreenHelper.IsInScreen( new System.Drawing.Point( _miniViewVm.X + (int)_miniView.ActualWidth / 2, _miniViewVm.Y + (int)_miniView.ActualHeight / 2 ) ) || !ScreenHelper.IsInScreen( new System.Drawing.Point( _miniViewVm.X + (int)_miniView.ActualWidth, _miniViewVm.Y + (int)_miniView.ActualHeight ) ) ) { _miniView.Left = 0; _miniView.Top = 0; } } else { _miniView.Show(); } }
public void Stop() { if( _isStarted ) { UnInitializeHighlighter(); Context.ServiceContainer.Remove( typeof( IPluginConfigAccessor ) ); UnregisterEvents(); _forceClose = true; //Setting the config is done after closing the window because modifying a value in the Config ///Triggers a Caliburn Micro OnNotifyPropertyChanged, which calls an Invoke on the main UI Thread. //generating random locks. //Once the LayoutManager is ready, we won't need this anymore. WINDOWPLACEMENT placement = new WINDOWPLACEMENT(); _skinDispatcher.Invoke( (Action)( () => { placement = CKWindowTools.GetPlacement( _skinWindow.Hwnd ); _skinWindow.Close(); } ) ); Config.User.Set( PlacementString, placement ); if( _miniView != null ) { _skinDispatcher.BeginInvoke( (Action)( () => { _miniView.Close(); _miniView = null; } ), null ); _viewHidden = false; } if( _miniViewVm != null ) _miniViewVm.Dispose(); _ctxVm.Dispose(); _ctxVm = null; _isStarted = false; } }