aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs
blob: c0610dd5f989b0c52b7fddfe2eefd35a3acb8d45 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;

namespace Tango.MachineStudio.MachineDesigner.Models
{
    public class HardwareComponent : ExtendedObject, IHasDifference
    {
        public String ComponentName { get; set; }
        public String Description { get; set; }
        public SynchronizedObservableCollection<HardwareParameter> Properties { get; set; }
        public bool HasDifferences
        {
            get
            {
                return Properties.Any(item => item.HasDifferences);
            }
        }

        public HardwareComponent()
        {
            Properties = new SynchronizedObservableCollection<HardwareParameter>();
        }
        
    }
}
pan>var item in variables) { ScriptVariable v = new ScriptVariable(); v.Name = item.Identifier.ToString(); if (item.Initializer.Value.GetType() == typeof(ObjectCreationExpressionSyntax)) { v.Type = (item.Initializer.Value as ObjectCreationExpressionSyntax).Type.ToString(); } else if (item.Initializer.Value.GetType() == typeof(InvocationExpressionSyntax)) { v.Type = (((item.Initializer.Value as InvocationExpressionSyntax).Expression as MemberAccessExpressionSyntax).Name as GenericNameSyntax).TypeArgumentList.Arguments[0].ToString(); } vars.Add(v); } return vars; } private void FillVariables(List<VariableDeclaratorSyntax> variables, SyntaxNode node) { foreach (var item in node.DescendantNodes(x => true)) { if (item.GetType() == typeof(VariableDeclaratorSyntax)) { variables.Add(item as VariableDeclaratorSyntax); } else { FillVariables(variables, item); } } } } public class ScriptVariable { public String Name { get; set; } public String Type { get; set; } public override string ToString() { return String.Format("{0} : {1}", Type, Name); } } }