aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs
blob: c88976948afd8b7e37f8140d311bf3d303b09df4 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
using Tango.Core.Commands;
using Tango.MachineStudio.Common.Modules;
using Tango.SharedUI;

namespace Tango.MachineStudio.UI.Console
{
    public class ConsoleWindowVM : ViewModel
    {

        /// <summary>
        /// Gets or sets the additional highlight C# types.
        /// </summary>
        public ObservableCollection<KeyValuePair<String, Type>> HighlightTypes { get; set; }

        /// <summary>
        /// Gets or sets the intellisense types.
        /// </summary>
        public ObservableCollection<KeyValuePair<String, Type>> IntellisenseTypes { get; set; }

        /// <summary>
        /// Gets or sets the run command.
        /// </summary>
        public RelayCommand RunCommand { get; set; }

        /// <summary>
        /// Gets or sets the stop command.
        /// </summary>
        public RelayCommand StopCommand { get; set; }

        /// <summary>
        /// Gets or sets the clear command.
        /// </summary>
        public RelayCommand ClearCommand { get; set; }

        public ConsoleWindowVM(IStudioModuleLoader moduleLoader)
        {
            RunCommand = new RelayCommand(Run);
            StopCommand = new RelayCommand(Stop);

            HighlightTypes = new ObservableCollection<KeyValuePair<string, Type>>();
            IntellisenseTypes = new ObservableCollection<KeyValuePair<string, Type>>();

            IntellisenseTypes.Add(new KeyValuePair<string, Type>("consoleManager", typeof(ConsoleManager)));

            foreach (var moduleType in moduleLoader.UserModules.SelectMany(x => x.MainViewType.Assembly.GetTypes()))
            {
                if (!moduleType.FullName.Contains("<") && !moduleType.FullName.Contains(">"))
                {
                    HighlightTypes.Add(new KeyValuePair<string, Type>(moduleType.FullName, moduleType));
                }
            }

            HighlightTypes.Add(new KeyValuePair<string, Type>("Thread", typeof(Thread)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("DateTime", typeof(DateTime)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("TimeSpan", typeof(TimeSpan)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("Dispatcher", typeof(Dispatcher)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("Task", typeof(Task)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("List", typeof(IList<Object>)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("int", typeof(Int32)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("double", typeof(Double)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("String", typeof(String)));
            HighlightTypes.Add(new KeyValuePair<string, Type>("string", typeof(String)));

            foreach (var item in HighlightTypes)
            {
                IntellisenseTypes.Add(item);
            }
        }

        private void Stop()
        {

        }

        private void Run()
        {

        }
    }
}