コード例 #1
0
        public override void DoWindowContents(Rect inRect)
        {
            base.DoWindowContents(inRect);

            new RectStacker(inRect)
            .Then(u => DrawTextEntry(u, "Name", form.Name, v => form.Name = v))
            .ThenGap(15f)
            .Then(u => DrawTextEntry(u, "Key", form.Key, v => form.Key = v))
            .ThenGap(15f)
            .Then(u => DrawTextEntry(u, "Unit", form.Unit, v => form.Unit = v))
            .ThenGap(15f)
            .Then(u =>
            {
                return(new RectStacker(u)
                       .Then(v => DrawRadioButton(v, "Poll", typeof(PollSourceMetric)))
                       .ThenGap(10f)
                       .Then(v => DrawRadioButton(v, "Digest", typeof(DigestSourceMetric)))
                       .ThenGap(10f)
                       .Then(v => DrawRadioButton(v, "Window", typeof(WindowSourceMetric))));
            })
            .ThenGap(15f)
            .Then(u => DrawTextButton(u, "Domain", domains, form.DomainType, v => form.DomainType = v))
            .Then(u => DrawTextButton(u, "Source", sources, form.SourceType, v => form.SourceType = v))
            .IfThen(
                () => StatTypesHelper.IsSetMetric(form.MetricType),
                u => DrawTextButton(u, "Aggregator", aggregators, form.AggregatorType, v => form.AggregatorType = v)
                )
            .Then(u => DrawSubmitButton(u, form, onSubmit));
        }
コード例 #2
0
 private void OperatorChosen(Type chosenOperator)
 {
     Model.ChosenOperator         = chosenOperator;
     Model.ChosenTrackerName      = "";
     Model.ChosenSourceMetric     = null;
     Model.ChosenOperatorIsBinary = !StatTypesHelper.IsUnaryOperator(chosenOperator);
     operatorChosen.OnNext(chosenOperator);
 }
コード例 #3
0
        public bool IsValid()
        {
            bool requiredFieldsValid = !string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Key) && MetricType != null && DomainType != null && SourceType != null;
            bool needsAggregatorType = StatTypesHelper.IsSetMetric(MetricType); // only children of SetSourceMetric need an aggregator
            bool hasAggregatorType   = AggregatorType != null;

            if (needsAggregatorType)
            {
                return(requiredFieldsValid && hasAggregatorType);
            }
            else
            {
                return(requiredFieldsValid);
            }
        }