aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/TestApp/MainWindow.xaml
blob: 56fe9da3cdcc48b1e357686855a996384f54925f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<Window x:Class="TestApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:editors="clr-namespace:Tango.Scripting.Editors;assembly=Tango.Scripting.Editors"
        xmlns:local="clr-namespace:TestApp"
        xmlns:ide="clr-namespace:Tango.Scripting.IDE;assembly=Tango.Scripting.IDE"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <ide:ScriptIDEView/>
    </Grid>
</Window>
olor: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
using Tango.MachineStudio.Common.Modules;

namespace Tango.MachineStudio.UI.Console
{
    public class ConsoleManager
    {
        public TangoIOC TangoIOC { get; set; }
        private Action<String> _writeLine;

        public ConsoleManager(Action<String> writeLine)
        {
            _writeLine = writeLine;
            TangoIOC = TangoIOC.Default;
        }

        public void WriteLine(String text)
        {
            _writeLine(text);
        }

        public void InvokeUI(Action action)
        {
            Core.Helpers.ThreadsHelper.InvokeUI(action);
        }

        public void StartModule(String name)
        {
            IStudioModuleLoader loader = TangoIOC.Default.GetInstance<IStudioModuleLoader>();
            var module = loader.AllModules.SingleOrDefault(x => x.Name == name);
            TangoIOC.Default.GetInstance<ViewModels.MainViewVM>().StartModule(module);
        }
    }
}