aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs
blob: e2d525d95979fefa00cf5a240be834f1cdcb4b86 (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
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);
        }
    }
}
ge Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Include="App.xaml.cs"> <DependentUpon>App.xaml</DependentUpon> <SubType>Code</SubType> </Compile> <Compile Include="MainWindow.xaml.cs"> <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Resources.resx</DependentUpon> </Compile> <Compile Include="Properties\Settings.Designer.cs"> <AutoGen>True</AutoGen> <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> <None Include="packages.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> </None> </ItemGroup> <ItemGroup> <None Include="App.config" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Tango.Scripting.Editors\Tango.Scripting.Editors.csproj"> <Project>{6c55b776-26d4-4db3-a6ab-87e783b2f3d1}</Project> <Name>Tango.Scripting.Editors</Name> </ProjectReference> <ProjectReference Include="..\Tango.Scripting.IDE\Tango.Scripting.IDE.csproj"> <Project>{c9f60285-91fb-4293-bcf5-164d76755cdd}</Project> <Name>Tango.Scripting.IDE</Name> </ProjectReference> <ProjectReference Include="..\Tango.Scripting\Tango.Scripting.csproj"> <Project>{1e938fd2-c669-4738-98c9-77f96ce4d451}</Project> <Name>Tango.Scripting</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>