aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs
blob: ca598881a2165a64b9ddd3e07b5bee506b32d052 (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
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.Core.Commands;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.PMR;
using Tango.Scripting;
using Tango.Settings;
using Tango.SharedUI;
using Tango.Stubs;
using Tango.Stubs.ViewModels;
using Tango.Transport;
using Tango.Transport.Adapters;

namespace Tango.MachineStudio.Stubs.ViewModels
{
    /// <summary>
    /// Represents the script execution module main view model.
    /// </summary>
    /// <seealso cref="Tango.SharedUI.ViewModel" />
    public class MainViewVM : StudioViewModel
    {
        private INotificationProvider _notification;

        #region Properties

        public IStudioApplicationManager ApplicationManager { get; set; }

        private StubsViewVM _stubsViewVM;
        /// <summary>
        /// Gets or sets the stubs view vm.
        /// </summary>
        public StubsViewVM StubsViewVM
        {
            get { return _stubsViewVM; }
            set { _stubsViewVM = value; RaisePropertyChangedAuto(); }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewVM"/> class.
        /// </summary>
        public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notification)
        {
            StubsViewVM = new StubsViewVM(ConnectionMode.External);

            ApplicationManager = applicationManager;
            _notification = notification;

            StubsViewVM.Bind(nameof(StubsViewVM.MachineOperator), ApplicationManager, nameof(ApplicationManager.ConnectedMachine));
        }

        #endregion

        #region Studio View Model

        /// <summary>
        /// Called when [shutdown request].
        /// </summary>
        /// <returns></returns>
        public override void OnShuttingDown()
        {
            StubsViewVM.SaveSettings();
        }

        public override void OnApplicationReady()
        {
            
        }

        #endregion
    }
}
w"> (currentNode == null) return -1; char result = currentNode.contents[indexInsideNode++]; if (indexInsideNode >= currentNode.length) GoToNextNode(); return result; } void GoToNextNode() { if (stack.Count == 0) { currentNode = null; } else { indexInsideNode = 0; currentNode = stack.Pop(); GoToLeftMostLeaf(); } } /// <inheritdoc/> public override int Read(char[] buffer, int index, int count) { if (currentNode == null) return 0; int amountInCurrentNode = currentNode.length - indexInsideNode; if (count < amountInCurrentNode) { Array.Copy(currentNode.contents, indexInsideNode, buffer, index, count); indexInsideNode += count; return count; } else { // read to end of current node Array.Copy(currentNode.contents, indexInsideNode, buffer, index, amountInCurrentNode); GoToNextNode(); return amountInCurrentNode; } } } }