Exemple #1
0
        private void InitControls()
        {
            var arrangeAmountSpin = GetAmountSpin();
            var actAmountSpin     = GetAmountSpin();
            var assertAmountSpin  = GetAmountSpin();

            var arrangeCommentBox = GetCommentTextBox();
            var actCommentBox     = GetCommentTextBox();
            var assertCommentBox  = GetCommentTextBox();

            var stack1 = new Controls.VertStackPanel(Environment)
            {
                Width = 200
            };
            var stack2 = new Controls.VertStackPanel(Environment)
            {
                Width = 200
            };

            var stack = new Controls.HorzStackPanel(Environment);


            stack1.Controls.Add(GetLabel("Arranged objects amount"));
            stack2.Controls.Add(arrangeAmountSpin);

            stack1.Controls.Add(GetLabel("Performed calls amount"));
            stack2.Controls.Add(actAmountSpin);

            stack1.Controls.Add(GetLabel("Asserted values amount"));
            stack2.Controls.Add(assertAmountSpin);

            stack1.Controls.Add(GetLabel("Arrange section comment"));
            stack2.Controls.Add(arrangeCommentBox);

            stack1.Controls.Add(GetLabel("Act section comment"));
            stack2.Controls.Add(actCommentBox);

            stack1.Controls.Add(GetLabel("Assert section comment"));
            stack2.Controls.Add(assertCommentBox);

            stack.Controls.Add(stack1);
            stack.Controls.Add(stack2);

            Controls.Add(GetLabel("MockMetrics options"));
            Controls.Add(JetBrains.UI.Options.Helpers.Controls.Separator.DefaultHeight);
            Controls.Add(stack);

            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ArrangeAmount, arrangeAmountSpin.IntegerValue);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ActAmount, actAmountSpin.IntegerValue);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.AssertAmount, assertAmountSpin.IntegerValue);

            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ArrangeComment, arrangeCommentBox.Text);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ActComment, actCommentBox.Text);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.AssertComment, assertCommentBox.Text);
        }
        private void InitControls()
        {
            var arrangeAmountSpin = GetAmountSpin();
            var actAmountSpin = GetAmountSpin();
            var assertAmountSpin = GetAmountSpin();

            var arrangeCommentBox = GetCommentTextBox();
            var actCommentBox = GetCommentTextBox();
            var assertCommentBox = GetCommentTextBox();

            var stack1 = new Controls.VertStackPanel(Environment) {Width = 200};
            var stack2 = new Controls.VertStackPanel(Environment) { Width = 200 };

            var stack = new Controls.HorzStackPanel(Environment);

            stack1.Controls.Add(GetLabel("Arranged objects amount"));
            stack2.Controls.Add(arrangeAmountSpin);

            stack1.Controls.Add(GetLabel("Performed calls amount"));
            stack2.Controls.Add(actAmountSpin);

            stack1.Controls.Add(GetLabel("Asserted values amount"));
            stack2.Controls.Add(assertAmountSpin);

            stack1.Controls.Add(GetLabel("Arrange section comment"));
            stack2.Controls.Add(arrangeCommentBox);

            stack1.Controls.Add(GetLabel("Act section comment"));
            stack2.Controls.Add(actCommentBox);

            stack1.Controls.Add(GetLabel("Assert section comment"));
            stack2.Controls.Add(assertCommentBox);

            stack.Controls.Add(stack1);
            stack.Controls.Add(stack2);

            Controls.Add(GetLabel("MockMetrics options"));
            Controls.Add(JetBrains.UI.Options.Helpers.Controls.Separator.DefaultHeight);
            Controls.Add(stack);

            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ArrangeAmount, arrangeAmountSpin.IntegerValue);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ActAmount, actAmountSpin.IntegerValue);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.AssertAmount, assertAmountSpin.IntegerValue);

            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ArrangeComment, arrangeCommentBox.Text);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.ActComment, actCommentBox.Text);
            mySettings.SetBinding(myLifetime, (MockMetricsSettings s) => s.AssertComment, assertCommentBox.Text);
        }
        private void InitControls()
        {
            Controls.Spin spin;
            Controls.HorzStackPanel stack;

            Controls.Add(new Controls.Label(StringTable.Options_Banner));

            Controls.Add(JetBrains.UI.Options.Helpers.Controls.Separator.DefaultHeight);

            Controls.Add(stack = new Controls.HorzStackPanel(Environment));
            stack.Controls.Add(new Controls.Label(StringTable.Options_MaxLevelLabel));
            stack.Controls.Add(spin = new Controls.Spin());

            spin.Maximum = new decimal(new[] {50, 0, 0, 0});
            spin.Minimum = new decimal(new[] {0, 0, 0, 0});
            spin.Value = new decimal(new[] {1, 0, 0, 0});

            _settings.SetBinding(_lifetime, (DisposePluginSettings s) => s.MaxLevel, spin.IntegerValue);
        }
        private void InitControls()
        {
            Controls.Spin           spin; // This variable may be reused if there's more than one spin on the page
            Controls.HorzStackPanel stack;

            // The upper cue banner, stacked in the first line of our page, docked to full width with word wrapping, as needed
            Controls.Add(new Controls.Label(Stringtable.Options_Banner));

            // Some spacing
            Controls.Add(UI.Options.Helpers.Controls.Separator.DefaultHeight);

            // A horizontal stack of a text label and a spin-edit
            Controls.Add(stack = new Controls.HorzStackPanel(Environment));
            stack.Controls.Add(new Controls.Label(Stringtable.Options_ThresholdLabel)); // The first column of the stack
            stack.Controls.Add(spin = new Controls.Spin());

            // Set up the spin we've just added
            spin.Maximum = new decimal(new[] { 500, 0, 0, 0 });
            spin.Minimum = new decimal(new[] { 1, 0, 0, 0 });
            spin.Value   = new decimal(new[] { 1, 0, 0, 0 });

            // This binding will take the initial value from ComplexityAnalysisElementProcessor, put it into the edit, and pass back from UI to the control if the OK button is hit
            mySettings.SetBinding(myLifetime, (ComplexityAnalysisSettings s) => s.Threshold, spin.IntegerValue);
        }
    private void InitControls()
    {
      Controls.Spin spin; // This variable may be reused if there's more than one spin on the page
      Controls.HorzStackPanel stack;

      // The upper cue banner, stacked in the first line of our page, docked to full width with word wrapping, as needed
      Controls.Add(new Controls.Label(Stringtable.Options_Banner));

      // Some spacing
      Controls.Add(UI.Options.Helpers.Controls.Separator.DefaultHeight);

      // A horizontal stack of a text label and a spin-edit
      Controls.Add(stack = new Controls.HorzStackPanel());
      stack.Controls.Add(new Controls.Label(Stringtable.Options_ThresholdLabel)); // The first column of the stack
      stack.Controls.Add(spin = new Controls.Spin());

      // Set up the spin we've just added
      spin.Maximum = new decimal(new[] {500, 0, 0, 0});
      spin.Minimum = new decimal(new[] {1, 0, 0, 0});
      spin.Value = new decimal(new[] {1, 0, 0, 0});

      // This binding will take the initial value from ComplexityAnalysisElementProcessor, put it into the edit, and pass back from UI to the control if the OK button is hit
      mySettings.SetBinding(myLifetime, (ComplexityAnalysisSettings s) => s.Threshold, spin.IntegerValue);
    }