port from perforce
This commit is contained in:
48
aiwaz/Backup/Aiwaz.Editor/App.xaml.cs
Normal file
48
aiwaz/Backup/Aiwaz.Editor/App.xaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Aiwaz.Core;
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.Scripting.Hosting;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace Aiwaz.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public ScriptEngine ScriptEngine;
|
||||
|
||||
private void Application_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
Engine.Uninitialize();
|
||||
}
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
Engine.Initialize(null);
|
||||
this.ScriptEngine = Python.CreateEngine();
|
||||
this.ScriptEngine.Runtime.LoadAssembly(Assembly.LoadFile(Path.Combine(Environment.CurrentDirectory, "Aiwaz.Contracts.dll")));
|
||||
this.ScriptEngine.Runtime.LoadAssembly(Assembly.LoadFile(Path.Combine(Environment.CurrentDirectory, "Aiwaz.Common.dll")));
|
||||
this.ScriptEngine.Runtime.LoadAssembly(Assembly.LoadFile(Path.Combine(Environment.CurrentDirectory, "Aiwaz.Core.dll")));
|
||||
this.ScriptEngine.Runtime.LoadAssembly(Assembly.LoadFile(Path.Combine(Environment.CurrentDirectory, "Aiwaz.Resources.dll")));
|
||||
|
||||
var globalScope = this.ScriptEngine.Runtime.CreateScope();
|
||||
globalScope.SetVariable("myVar", "hallo");
|
||||
|
||||
var script = this.ScriptEngine.CreateScriptSourceFromFile("Editor.py");
|
||||
var code = script.Compile();
|
||||
|
||||
script.Execute(globalScope); // see output window, fool!
|
||||
var myVarResult = globalScope.GetVariable("myVar");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user