Esempio n. 1
0
        private void OnButtonClicked(RadialController sender, RadialControllerButtonClickedEventArgs args)
        {
            var evt = new DialEventArgs();
            IEnumerable <IDialController> controllers = GetApplicableControllers().Where(c => c.CanHandleClick);

            foreach (IDialController controller in controllers)
            {
                controller.OnClick(evt);

                try
                {
                    if (evt.Handled)
                    {
                        if (!string.IsNullOrEmpty(evt.Action))
                        {
                            VsHelpers.WriteStatus(evt.Action);
                        }

                        break;
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                }
            }
        }
Esempio n. 2
0
        private void OnRotationChanged(RadialController sender, RadialControllerRotationChangedEventArgs args)
        {
            var evt = new DialEventArgs();
            RotationDirection             direction   = args.RotationDeltaInDegrees > 0 ? RotationDirection.Right : RotationDirection.Left;
            IEnumerable <IDialController> controllers = GetApplicableControllers().Where(c => c.CanHandleRotate);

            foreach (IDialController controller in controllers)
            {
                try
                {
                    controller.OnRotate(direction, evt);

                    if (evt.Handled)
                    {
                        if (!string.IsNullOrEmpty(evt.Action))
                        {
                            VsHelpers.WriteStatus(evt.Action);
                        }

                        break;
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                }
            }
        }
        public IDialController TryCreateController(IDialControllerHost host)
        {
            string iconFilePath = VsHelpers.GetFileInVsix("Providers\\Editor\\icon.png");

            host.AddMenuItem(Moniker, iconFilePath);

            return(new EditorController(CompletionBroker));
        }
Esempio n. 4
0
 private void OnControlLost(RadialController sender, object args)
 {
     if (_status != null)
     {
         _status.Deactivate();
         VsHelpers.WriteStatus("Dial deactivated");
     }
 }
Esempio n. 5
0
 private void OnControlAcquired(RadialController sender, RadialControllerControlAcquiredEventArgs args)
 {
     if (_status != null)
     {
         _status.Activate();
         VsHelpers.WriteStatus("Dial activated");
     }
 }
Esempio n. 6
0
 public void OnRotate(RotationDirection direction, DialEventArgs e)
 {
     if (direction == RotationDirection.Right)
     {
         e.Handled = VsHelpers.ExecuteCommand("View.ZoomIn");
     }
     else
     {
         e.Handled = VsHelpers.ExecuteCommand("View.ZoomOut");
     }
 }
Esempio n. 7
0
 public override bool OnRotate(RotationDirection direction)
 {
     if (direction == RotationDirection.Right)
     {
         return(VsHelpers.ExecuteCommand("View.ZoomIn"));
     }
     else
     {
         return(VsHelpers.ExecuteCommand("View.ZoomOut"));
     }
 }
        public override bool OnRotate(RotationDirection direction)
        {
            if (direction == RotationDirection.Right)
            {
                VsHelpers.ExecuteCommand("Edit.NextBookmark");
            }
            else
            {
                VsHelpers.ExecuteCommand("Edit.PreviousBookmark");
            }

            return true;
        }
        public bool OnRotate(RotationDirection direction)
        {
            if (direction == RotationDirection.Right)
            {
                VsHelpers.ExecuteCommand("View.NextError");
            }
            else
            {
                VsHelpers.ExecuteCommand("View.PreviousError");
            }

            return(true);
        }
Esempio n. 10
0
        public override bool OnClick()
        {
            dbgDebugMode?debugMode = VsHelpers.DTE.Application?.Debugger.CurrentMode;

            if (debugMode == dbgDebugMode.dbgBreakMode)
            {
                VsHelpers.DTE.Application.Debugger.StepInto();
            }
            else if (debugMode == dbgDebugMode.dbgDesignMode)
            {
                VsHelpers.ExecuteCommand("Debug.ToggleBreakpoint");
            }

            return(true);
        }
Esempio n. 11
0
        public void OnClick(DialEventArgs e)
        {
            if (!VsHelpers.DTE.ActiveWindow.IsDocument())
            {
                return;
            }

            IWpfTextView view = VsHelpers.GetCurentTextView();

            if (view != null && view.HasAggregateFocus)
            {
                view.ZoomLevel = 100;
                e.Handled      = true;
            }
        }
Esempio n. 12
0
        public override bool OnClick()
        {
            IWpfTextView view = VsHelpers.GetCurentTextView();

            if (view == null || view.ZoomLevel == 100)
            {
                return(false);
            }

            view.ZoomLevel = 100;
            VsHelpers.ExecuteCommand("View.ZoomOut");
            VsHelpers.ExecuteCommand("View.ZoomIn");

            return(true);
        }
Esempio n. 13
0
        public void OnRotate(RotationDirection direction, DialEventArgs e)
        {
            if (direction == RotationDirection.Right)
            {
                VsHelpers.ExecuteCommand("View.NextError");
                e.Action = "Go to next error";
            }
            else
            {
                VsHelpers.ExecuteCommand("View.PreviousError");
                e.Action = "Go to previous error";
            }

            e.Handled = true;
        }
        public void OnClick(DialEventArgs e)
        {
            dbgDebugMode?debugMode = VsHelpers.DTE.Application?.Debugger.CurrentMode;

            if (debugMode == dbgDebugMode.dbgBreakMode)
            {
                VsHelpers.DTE.Application.Debugger.StepInto();
                e.Action = "Step into";
            }
            else if (debugMode == dbgDebugMode.dbgDesignMode)
            {
                VsHelpers.ExecuteCommand("Debug.ToggleBreakpoint");
                e.Action = "Toggle breakpoint";
            }

            e.Handled = true;
        }
Esempio n. 15
0
        public override bool OnClick()
        {
            _view = VsHelpers.GetCurentTextView();

            if (_view == null || !_view.HasAggregateFocus)
            {
                return(false);
            }

            if (_broker.IsCompletionActive(_view))
            {
                _broker.GetSessions(_view)[0].Commit();
            }
            else
            {
                VsHelpers.ExecuteCommand("Edit.ListMembers");
            }

            return(true);
        }
Esempio n. 16
0
        public void OnRotate(RotationDirection direction, DialEventArgs e)
        {
            if (VsHelpers.DTE.ActiveWindow.IsDocument())
            {
                IWpfTextView view = VsHelpers.GetCurentTextView();

                if (view != null && view.HasAggregateFocus)
                {
                    string cmd = direction == RotationDirection.Left ? "Edit.ScrollLineUp" : "Edit.ScrollLineDown";
                    e.Handled = VsHelpers.ExecuteCommand(cmd);
                }
            }

            if (!e.Handled)
            {
                string key = direction == RotationDirection.Left ? "{UP}" : "{DOWN}";
                SendKeys.Send(key);
            }

            e.Handled = true;
        }
Esempio n. 17
0
        public override bool OnClick()
        {
            if (VsHelpers.DTE.ActiveWindow.IsDocument())
            {
                IWpfTextView view = VsHelpers.GetCurentTextView();

                if (view != null && view.HasAggregateFocus && !_broker.IsCompletionActive(view))
                {
                    SendKeys.Send("+{F10}");
                }
                else
                {
                    SendKeys.Send("{ENTER}");
                }
            }
            else if (VsHelpers.DTE.ActiveWindow.IsSolutionExplorer())
            {
                var selectedItems = VsHelpers.DTE.ToolWindows.SolutionExplorer.SelectedItems as UIHierarchyItem[];

                if (selectedItems == null || selectedItems.Length != 1)
                {
                    return(false);
                }

                if (selectedItems[0].UIHierarchyItems.Expanded)
                {
                    SendKeys.Send("{LEFT}");
                }
                else
                {
                    SendKeys.Send("{RIGHT}");
                }
            }
            else
            {
                SendKeys.Send("{ENTER}");
            }

            return(true);
        }
Esempio n. 18
0
        public void OnClick(DialEventArgs e)
        {
            if (VsHelpers.DTE.ActiveWindow.IsDocument())
            {
                IWpfTextView view = VsHelpers.GetCurentTextView();

                if (view != null && view.HasAggregateFocus)
                {
                    SendKeys.Send("+{F10}");
                }
                else
                {
                    SendKeys.Send("{ENTER}");
                }
            }
            else if (VsHelpers.DTE.ActiveWindow.IsSolutionExplorer())
            {
                var selectedItems = VsHelpers.DTE.ToolWindows.SolutionExplorer.SelectedItems as UIHierarchyItem[];

                if (selectedItems == null || selectedItems.Length != 1)
                {
                    return;
                }

                if (selectedItems[0].UIHierarchyItems.Expanded)
                {
                    SendKeys.Send("{LEFT}");
                }
                else
                {
                    SendKeys.Send("{RIGHT}");
                }
            }
            else
            {
                SendKeys.Send("{ENTER}");
            }

            e.Handled = true;
        }
Esempio n. 19
0
        public override bool OnRotate(RotationDirection direction)
        {
            bool handled = false;

            if (VsHelpers.DTE.ActiveWindow.IsDocument())
            {
                IWpfTextView view = VsHelpers.GetCurentTextView();

                if (view != null && view.HasAggregateFocus)
                {
                    string cmd = direction == RotationDirection.Left ? "Edit.ScrollLineUp" : "Edit.ScrollLineDown";
                    handled = VsHelpers.ExecuteCommand(cmd);
                }
            }

            if (!handled)
            {
                string key = direction == RotationDirection.Left ? "{UP}" : "{DOWN}";
                SendKeys.Send(key);
            }

            return(true);
        }
 public override void OnActivate()
 {
     VsHelpers.ExecuteCommand("View.BookmarkWindow");
 }
 public override bool OnClick()
 {
     VsHelpers.ExecuteCommand("Edit.ToggleBookmark");
     return true;
 }