コード例 #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);
                }
            }
        }
コード例 #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);
                }
            }
        }
コード例 #3
0
        public IDialController TryCreateController(IDialControllerHost host)
        {
            string iconFilePath = VsHelpers.GetFileInVsix("Providers\\Editor\\icon.png");

            host.AddMenuItem(Moniker, iconFilePath);

            return(new EditorController(CompletionBroker));
        }
コード例 #4
0
 private void OnControlLost(RadialController sender, object args)
 {
     if (_status != null)
     {
         _status.Deactivate();
         VsHelpers.WriteStatus("Dial deactivated");
     }
 }
コード例 #5
0
 private void OnControlAcquired(RadialController sender, RadialControllerControlAcquiredEventArgs args)
 {
     if (_status != null)
     {
         _status.Activate();
         VsHelpers.WriteStatus("Dial activated");
     }
 }
コード例 #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");
     }
 }
コード例 #7
0
 public override bool OnRotate(RotationDirection direction)
 {
     if (direction == RotationDirection.Right)
     {
         return(VsHelpers.ExecuteCommand("View.ZoomIn"));
     }
     else
     {
         return(VsHelpers.ExecuteCommand("View.ZoomOut"));
     }
 }
コード例 #8
0
        public override bool OnRotate(RotationDirection direction)
        {
            if (direction == RotationDirection.Right)
            {
                VsHelpers.ExecuteCommand("Edit.NextBookmark");
            }
            else
            {
                VsHelpers.ExecuteCommand("Edit.PreviousBookmark");
            }

            return true;
        }
コード例 #9
0
        public bool OnRotate(RotationDirection direction)
        {
            if (direction == RotationDirection.Right)
            {
                VsHelpers.ExecuteCommand("View.NextError");
            }
            else
            {
                VsHelpers.ExecuteCommand("View.PreviousError");
            }

            return(true);
        }
コード例 #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);
        }
コード例 #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;
            }
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #14
0
        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;
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #20
0
 public override void OnActivate()
 {
     VsHelpers.ExecuteCommand("View.BookmarkWindow");
 }
コード例 #21
0
 public override bool OnClick()
 {
     VsHelpers.ExecuteCommand("Edit.ToggleBookmark");
     return true;
 }