aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs
blob: bc82d2215413ff70b2438bb01dafda17e4aa66ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using OxyPlot;
using Tango.Core;

namespace Tango.DispenserAnalyzer.UI.Analysis
{
    public class AnalyzerResultBase : ExtendedObject, IAnalyzerResult
    {
        public AnalyzerResultValue Result { get; set; }
       // public List<AnalysisPlotValue> PlotValues { get; set; }
        //public ObservableCollection<DataPoint> Points { get; set; }

        public List<AnalyzerResultProperty> Properties
        {
            get
            {
                List<AnalyzerResultProperty> props = new List<AnalyzerResultProperty>();
                if (this.GetType() == typeof(AnalyzerResultBase))
                    return props;

                foreach (var prop in this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).OrderByAlphaNumeric(x => x.Name))
                {
                    AnalyzerResultProperty aProp = new AnalyzerResultProperty();
                    if (aProp.GetType() == typeof(IEnumerable<>))
                    {
                        continue;
                    }
                    if (prop.GetCustomAttribute<DescriptionAttribute>() != null)
                    {
                        aProp.Name = prop.GetCustomAttribute<DescriptionAttribute>().Description;
                    //}
                    //else
                    //{
                    //    aProp.Name = prop.Name;
                    //}
                        object val = prop.GetValue(this);
                        aProp.Value = (val is double) ? ((double)val).ToString("F") : val.ToString();
                        props.Add(aProp);
                    }
                   
                }

                return props;
            }
        }

        public bool IsShowPlotResult { get; set; }
        public bool IsShowLineChartResult { get; set; }
        public AnalyzerResultChartData RangeToCountChart { get; set; }
        public AnalyzerResultChartData RangeToTimeChart { get; set; }
        public AnalyzerResultChartData LineChart { get; set; }
        public bool BackgroundMode { get; set; }
       

        public AnalyzerResultBase()
        {
            //PlotValues = new List<AnalysisPlotValue>();
            Result = AnalyzerResultValue.Undetermined;
            IsShowPlotResult = false;
            IsShowLineChartResult = false;
            RangeToCountChart = new AnalyzerResultChartData();
            RangeToTimeChart = new AnalyzerResultChartData();
            LineChart = new AnalyzerResultChartData();
            BackgroundMode = false;
        }
    }
}