aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Result.cs
blob: dc98957d4641b75a157e416d1169ed0db5829765 (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
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.ExtensionMethods;

namespace Tango.FSE.Procedures
{
    /// <summary>
    /// Represents a procedure result.
    /// </summary>
    public class Result
    {
        /// <summary>
        /// Gets or sets the type.
        /// </summary>
        public ResultType Type { get; set; }

        /// <summary>
        /// Gets or sets the result name.
        /// </summary>
        public String Name { get; set; }

        /// <summary>
        /// Gets or sets the result value.
        /// </summary>
        public Object Value { get; set; }

        [JsonIgnore]
        public bool IsGraph { get; set; }

        [JsonIgnore]
        public bool IsBitmap { get; set; }

        [JsonIgnore]
        public bool IsValueArray
        {
            get { return Value != null && typeof(IEnumerable).IsAssignableFrom(Value.GetType()) && Value.GetType() != typeof(String); }
        }

        public Result()
        {

        }

        public Result(ResultType type, String name, Object value) : this()
        {
            Type = type;
            Name = name;
            Value = value;
        }

        public override string ToString()
        {
            return this.ToJsonString();
        }
    }
}