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 );
        }
예제 #2
0
        void InitializeActiveWindow( IKeyboard keyboard )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            var vm = new VMContextActiveKeyboard( NoFocusManager, keyboard.Name, Context, KeyboardContext.Service.Keyboards.Context, Config );
            var subscriber = new WindowManagerSubscriber( WindowManager, WindowBinder );

            var skin = NoFocusManager.CreateNoFocusWindow<SkinWindow>( nfm => new SkinWindow( nfm )
            {
                DataContext = vm
            } );

            SkinInfo skinInfo = new SkinInfo( skin, vm, NoFocusManager.NoFocusDispatcher, subscriber );
            _skins.Add( keyboard.Name, skinInfo );

            InitializeWindowLayout( skinInfo );
            skinInfo.Dispatcher.Invoke( (Action)(() =>
            {
                skinInfo.Skin.Show();
                skinInfo.Skin.ShowInTaskbar = false;
            }) );
            SetWindowPlacement( skinInfo );

            Subscribe( skinInfo );
            RegisterHighlighter( skinInfo );
            RegisterTopMostService( skinInfo );

            RegisterSkinEvents( skinInfo );
        }
예제 #3
0
 public SkinInfo( SkinWindow window, VMContextActiveKeyboard vm, Dispatcher d, WindowManagerSubscriber sub )
 {
     Skin = window;
     ViewModel = vm;
     Dispatcher = d;
     Subscriber = sub;
     NameKeyboard = vm.KeyboardVM.Keyboard.Name;
 }
예제 #4
0
        public void Start()
        {
            _subscriber = new WindowManagerSubscriber( WindowManager, WindowBinder );

            Feature.PropertyChanged += OnFeaturePropertyChanged;
            PredictionTextAreaService.PredictionAreaTextSent += OnPredictionAreaContentSent;

            if( Feature.DisplayContextEditor ) EnableEditor();
        }