Esempio n. 1
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 void OnRotate(RotationDirection direction, DialEventArgs e)
        {
            if (_view == null || _span == null || _span.IsEmpty)
            {
                return;
            }

            var    bufferSpan = new SnapshotSpan(_view.TextBuffer.CurrentSnapshot, _span);
            string text       = bufferSpan.GetText();

            float  delta  = GetDelta(text);
            string format = text.Contains(".") ? "#.#0" : string.Empty;

            if (NumberDecimalPlaces(text) == 1)
            {
                format = "F1";
            }

            if (direction == RotationDirection.Left)
            {
                e.Action = "Decrease value";
                UpdateSpan(bufferSpan, (_number - delta).ToString(format, CultureInfo.InvariantCulture));
            }
            else
            {
                e.Action = "Increase value";
                UpdateSpan(bufferSpan, (_number + delta).ToString(format, CultureInfo.InvariantCulture));
            }

            e.Handled = true;
        }
Esempio n. 3
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. 4
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. 5
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 OnRotate(RotationDirection direction, DialEventArgs e)
        {
            if (direction == RotationDirection.Right)
            {
                VsHelpers.DTE.Application.Debugger.StepOver();
                e.Action = "Step over";
            }
            else
            {
                VsHelpers.DTE.Application.Debugger.StepOut();
                e.Action = "Step out";
            }

            e.Handled = true;
        }
Esempio n. 7
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;
            }
        }
        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;
        }
        public void OnClick(DialEventArgs e)
        {
            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}");
            }

            e.Handled = true;
        }
Esempio n. 10
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. 11
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;
        }
        public void OnRotate(RotationDirection direction, DialEventArgs e)
        {
            if (_view == null || _span == null || _span.IsEmpty)
            {
                return;
            }

            var    bufferSpan = new SnapshotSpan(_view.TextBuffer.CurrentSnapshot, _span);
            string text       = bufferSpan.GetText();

            int argb  = int.Parse(text.Substring(1), NumberStyles.HexNumber);
            var color = Color.FromArgb(argb);

            double factor = direction == RotationDirection.Left ? -3 : 3;

            Color newColor = AdjustBrightness(color, factor);

            UpdateSpan(bufferSpan, ConvertToHex(newColor).ToLowerInvariant());

            e.Handled = true;
            e.Action  = direction == RotationDirection.Left ? "Darkened color value" : "Lightened color value";
        }
 public void OnClick(DialEventArgs e)
 {
 }
Esempio n. 14
0
 public void OnClick(DialEventArgs e)
 {
     VsHelpers.DTE.ToolWindows.ErrorList.Parent?.Activate();
 }
 public void OnRotate(RotationDirection direction, DialEventArgs e)
 {
 }