Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="ChartPanel" />
 /// class.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="title">The title.</param>
 public ChartPanel(ISourceModel model, ITitleInfo title)
     : this()
 {
     SourceModel   = model;
     Configuration = SourceModel.GetSeriesConfiguration();
     TitleInfo     = title;
     DataMetric    = SourceModel.GetMetric();
     ChartData     = new SeriesModel(SourceModel.GetSourceBinding());
     DataSeries    = new DataSeries(ChartData);
     Series.Add(DataSeries);
     Titles.Add(TitleInfo.GetChartMainTitle());
 }
Esempio n. 2
0
        private string GetInformation(ISourceModel obj)
        {
            if (obj == null || obj.Source == null)
            {
                return("Информация недоступна");
            }

            var sb = new StringBuilder(obj.Source.ToString());

            sb.AppendLine();
            var properties = TypeDescriptor.GetProperties(obj.Source);

            foreach (PropertyDescriptor property in properties)
            {
                var nonNullableType = property.PropertyType.GetNonNullableType();
                if (nonNullableType.IsValueType || nonNullableType == typeof(string))
                {
                    sb.AppendFormat("{0}: {1}", property.DisplayName, property.GetValue(obj.Source));
                    sb.AppendLine();
                }
            }
            return(sb.ToString());
        }