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)); }
private void OperatorChosen(Type chosenOperator) { Model.ChosenOperator = chosenOperator; Model.ChosenTrackerName = ""; Model.ChosenSourceMetric = null; Model.ChosenOperatorIsBinary = !StatTypesHelper.IsUnaryOperator(chosenOperator); operatorChosen.OnNext(chosenOperator); }
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); } }