Esempio n. 1
0
 protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.Property == TargetProperty && e.NewValue != null)
     {
         SetAttachedHelper(Target, this);
         SetBinding(Attached.Slider.ValueStringFormatProperty, new Binding {
             Source = e.NewValue, Path = new PropertyPath(Attached.Slider.ValueStringFormatProperty), Mode = BindingMode.OneWay
         });
         SetBinding(TargetValueProperty, new Binding {
             Source = e.NewValue, Path = new PropertyPath(Slider.ValueProperty), Mode = BindingMode.OneWay
         });
     }
     if (e.Property == Attached.Slider.ValueStringFormatProperty || e.Property == TargetValueProperty)
     {
         if (!String.IsNullOrEmpty(targetValueFormatString))
         {
             FormattedValue = String.Format(targetValueFormatString, TargetValue);
         }
         else
         {
             FormattedValue = TargetValue.ToString();
         }
     }
 }
        /// <inheritdoc/>
        public override string ModelSummary()
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                htmlWriter.Write("\r\n<div class=\"activityentry\">");
                htmlWriter.Write(CLEMModel.DisplaySummaryValueSnippet(Metric, "Metric not set"));
                if (TargetValue > 0)
                {
                    htmlWriter.Write("<span class=\"setvalue\">");
                    htmlWriter.Write(TargetValue.ToString("#,##0.##"));
                }
                else
                {
                    htmlWriter.Write("<span class=\"errorlink\">VALUE NOT SET");
                }

                htmlWriter.Write("</span> units per AE per day</div>");

                if (OtherSourcesValue > 0)
                {
                    htmlWriter.Write("\r\n<div class=\"activityentry\">");
                    htmlWriter.Write("<span class=\"setvalue\">" + OtherSourcesValue.ToString("#,##0.##") + "</span> is provided from sources outside the human food store</div>");
                }
                return(htmlWriter.ToString());
            }
        }
Esempio n. 3
0
            public void AddValidation(ClientModelValidationContext context)
            {
                if (context == null)
                {
                    throw new ArgumentNullException(nameof(context));
                }

                CheckForLocalizer(context);
                var errorMessage = GetErrorMessage(context.ModelMetadata.GetDisplayName());

                MergeAttribute(context.Attributes, "data-val", "true");
                MergeAttribute(context.Attributes, "data-val-requiredwhen", errorMessage);
                MergeAttribute(context.Attributes, "data-val-other", "#" + DependentProperty);
                MergeAttribute(context.Attributes, "data-val-otherval", TargetValue.ToString());
            }
        public override string GetCommandLineArguments()
        {
            ArgumentFormatter argFormatter = new ArgumentFormatter();
            StringBuilder     arguments    = new StringBuilder();

            arguments.Append(" " + argFormatter.GetFormattedArgument(Responses));
            arguments.Append(" " + argFormatter.GetFormattedArgument(ResponseTransformation, false));

            arguments.Append(" " + argFormatter.GetFormattedArgument(TargetValue.ToString(), false));

            arguments.Append(" " + argFormatter.GetFormattedArgument(ConfidenceInterval));
            arguments.Append(" " + argFormatter.GetFormattedArgument(NormalPlot));

            arguments.Append(" " + argFormatter.GetFormattedArgument(Significance, false));

            return(arguments.ToString().Trim());
        }