示例#1
0
        private void OnWindowDelete(object o, EventArgs args)
        {
            if (engine.Running)
            {
                engine.Stop();
            }

            Application.Quit();
        }
示例#2
0
文件: Engine.cs 项目: zeta1999/eithne
        public EngineThread(Engine2 engine, Block b)
        {
            this.b      = b;
            this.engine = engine;

            b.Working = true;
            MainWindow.RedrawSchematic();

            try
            {
                if (b.Plugin.NumIn != 0)
                {
                    CommSocket cs = new CommSocket(b.Plugin.NumIn);

                    for (int i = 0; i < b.Plugin.NumIn; i++)
                    {
                        Socket other = b.SocketIn[i].Other;

                        if (other.Parent.Plugin.Out == null)
                        {
                            b.Working = false;
                            b         = other.Parent;
                            throw new PluginException(Catalog.GetString("Plugin has no data on output sockets."));
                        }

                        cs[i] = other.Parent.Plugin.Out[other.Num];
                    }

                    b.Plugin.In = cs;
                }

                Plugin = b.Plugin;
                t      = new Thread(ThreadedWork);
                t.Start();
            }
            catch (Exception e)
            {
                engine.Stop();

                b.ShowError = true;
                MainWindow.RedrawSchematic();
                new PluginError(e, b, false);
            }
        }