Esempio n. 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
            }
        }
Esempio n. 2
0
 private void CreatePopup()
 {
     if (_popup == null)
     {
         _popup = new ContextActionsBulbPopup(_editor.TextArea)
         {
             CommandProvider = GetActionCommand
         };
     }
 }
Esempio n. 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;
 }
Esempio n. 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);
     }
 }