Beispiel #1
0
        private void CreatePopup()
        {
            if (_popup == null)
            {
                _popup = new ContextActionsBulbPopup(_editor.TextArea)
                {
                    CommandProvider = GetActionCommand,
                    Icon            = IconImage,
                };

                // TODO: workaround to refresh menu with latest document
                _popup.MenuOpened += async(sender, args) =>
                {
                    if (await LoadActionsWithCancellationAsync().ConfigureAwait(true))
                    {
                        _popup.ItemsSource = _actions;
                    }
                };

                _popup.MenuClosed += (sender, args) =>
                {
                    _editor.GetDispatcher().InvokeAsync(() => _editor.Focus(), DispatcherPriority.Background);
                };

#if AVALONIA
                ((ISetLogicalParent)_popup).SetParent(_editor.GetWindow());
#endif
            }
        }
Beispiel #2
0
 private void CreatePopup()
 {
     if (_popup == null)
     {
         _popup = new ContextActionsBulbPopup(_editor.TextArea)
         {
             CommandProvider = GetActionCommand
         };
     }
 }
Beispiel #3
0
 private void CreatePopup()
 {
     if (_popup == null)
     {
         _popup = new ContextActionsBulbPopup(_editor.TextArea)
         {
             CommandProvider = GetActionCommand
         };
         // TODO: workaround to refresh menu with latest document
         _popup.MenuOpened += async(sender, args) =>
         {
             if (await LoadActionsWithCancellationAsync().ConfigureAwait(true))
             {
                 _popup.ItemsSource = _actions;
             }
         };
         _popup.MenuClosed += (sender, args) => _editor.Dispatcher.InvokeAsync(() => _editor.Focus(), DispatcherPriority.ApplicationIdle);
     }
 }
 public ActionCommandConverter(ContextActionsBulbPopup owner)
 {
     _owner = owner;
 }
Beispiel #5
0
 public ActionCommandConverter(ContextActionsBulbPopup owner)
 {
     _owner = owner;
 }
 private void CreatePopup()
 {
     if (_popup == null)
     {
         _popup = new ContextActionsBulbPopup(_editor.TextArea) { CommandProvider = GetActionCommand };
         // TODO: workaround to refresh menu with latest document
         _popup.MenuOpened += async (sender, args) =>
         {
             if (await LoadActionsWithCancellationAsync().ConfigureAwait(true))
             {
                 _popup.ItemsSource = _actions;
             }
         };
         _popup.MenuClosed += (sender, args) => _editor.Dispatcher.InvokeAsync(() => _editor.Focus(), DispatcherPriority.ApplicationIdle);
     }
 }