Interaction logic for PredictionTextArea.xaml
Inheritance: System.Windows.Window
 public void Start()
 {
     _vm = new TextualContextPreviewViewModel( TextualContextService );
     _preview = new TextualContextPreviewWindow( _vm );
     _preview.Width = 600;
     _preview.Height = 300;
     _preview.Show();
 }
        public void Start()
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == Application.Current.Dispatcher, "This method should only be called by the Application Thread." );

            _vm = new TextualContextPreviewViewModel( TextualContextService );
            _window = new TextualContextPreviewWindow( _vm );
            _window.Width = 600;
            _window.Height = 300;
            _window.Show();

            _subscriber = new WindowManagerSubscriber( WindowManager, WindowBinder );
            _subscriber.OnBinderStarted = () =>
            {
                if( _textualContext != null & _me != null )
                    WindowBinder.Service.Bind( _textualContext, _me, BindingPosition.Top );
            };
            _subscriber.OnBinderStopped = () =>
            {
                if( _textualContext != null & _me != null )
                    WindowBinder.Service.Unbind( _textualContext, _me );
            };
            _subscriber.WindowRegistered = ( e ) =>
            {
                if( e.Window.Name == WindowName )
                {
                    _me = e.Window;
                    _textualContext = WindowManager.Service.GetByName( TextualContextArea.WindowName );
                }
                if( e.Window.Name == TextualContextArea.WindowName ) _textualContext = e.Window;

                _subscriber.OnBinderStarted();
            };
            _subscriber.WindowUnregistered = ( e ) =>
            {
                if( e.Window.Name == TextualContextArea.WindowName ) _subscriber.OnBinderStopped();
            };
            _subscriber.Subscribe( WindowName, _window );
        }