Beispiel #1
0
        public EngineStatus Free()
        {
            Engine.I = null;
            I        = null;

            return(EngineStatus.Free);
        }
Beispiel #2
0
        /// <summary>
        /// 驳回(指定下一活动)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnTrueReject_Click(object sender, EventArgs e)
        {
            try
            {
                string approveComment = this.txtApproveComment.Text.Trim();
                long   nextActivityId = (sender as LinkButton).CommandArgument.ToLong();

                using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())
                {
                    using (BizDataContext db = new BizDataContext())
                    {
                        //更新表单实例
                        this.formPreview.UpdateFormInstance(db);

                        //完成工作项
                        EngineProxy proxy = new EngineProxy(db);
                        proxy.RejectApproveWorkItem(this.WorkItemId, approveComment, nextActivityId);
                    }
                    ts.Complete();
                }

                Response.Redirect("FormInstanceQuery.aspx");
            }
            catch (Exception ex)
            {
                this.AjaxAlertAndEnableButton(ex);
            }
        }
Beispiel #3
0
 public void TearDownAttribute()
 {
     engine.Shutdown();
     engineProxy  = null;
     engineProxy2 = null;
     engine       = null;
 }
Beispiel #4
0
        /// <summary>
        /// 驳回
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnReject_Click(object sender, EventArgs e)
        {
            try
            {
                bool   isAddUser      = this.ccIsAddUser.Checked;
                int?   addUserId      = this.scAddUserId.GetValue().ToStringNullable().ToIntNullable();
                string approveComment = this.txtApproveComment.Text.Trim();

                using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())
                {
                    using (BizDataContext db = new BizDataContext())
                    {
                        //更新表单实例
                        this.formPreview.UpdateFormInstance(db);

                        //完成工作项
                        EngineProxy proxy = new EngineProxy(db);
                        proxy.CompleteApproveWorkItem(this.WorkItemId, ApproveResultEnum.Reject, approveComment, isAddUser, addUserId);
                    }
                    ts.Complete();
                }

                Response.Redirect("FormInstanceQuery.aspx");
            }
            catch (Exception ex)
            {
                this.AjaxAlertAndEnableButton(ex);
            }
        }
Beispiel #5
0
        public void SetUp()
        {
            // Whole bunch of setup code.
            XmlElement taskNode  = new XmlDocument().CreateElement("MockTask");
            LoadedType taskClass = new LoadedType(typeof(MockTask), new AssemblyLoadInfo(typeof(MockTask).Assembly.FullName, null));

            engine = new Engine(@"c:\");
            Project        project        = new Project(engine);
            EngineCallback engineCallback = new EngineCallback(engine);

            taskExecutionModule = new MockTaskExecutionModule(engineCallback);
            int        handleId   = engineCallback.CreateTaskContext(project, null, null, taskNode, EngineCallback.inProcNode, new BuildEventContext(BuildEventContext.InvalidNodeId, BuildEventContext.InvalidTargetId, BuildEventContext.InvalidProjectContextId, BuildEventContext.InvalidTaskId));
            TaskEngine taskEngine = new TaskEngine
                                    (
                taskNode,
                null,                     /* host object */
                "In Memory",
                project.FullFileName,
                engine.LoggingServices,
                handleId,
                taskExecutionModule,
                null
                                    );

            taskEngine.TaskClass = taskClass;

            engineProxy          = new EngineProxy(taskExecutionModule, handleId, project.FullFileName, project.FullFileName, engine.LoggingServices, null);
            taskExecutionModule2 = new MockTaskExecutionModule(engineCallback, TaskExecutionModule.TaskExecutionModuleMode.MultiProcFullNodeMode);
            engineProxy2         = new EngineProxy(taskExecutionModule2, handleId, project.FullFileName, project.FullFileName, engine.LoggingServices, null);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            IEngine engine = new EngineProxy(1300, false);

            engine.Diagnose(new EngineDiagnosticTool());
            Console.Read();
        }
Beispiel #7
0
 public EngineStatus Free()
 {
     Engine.I.DestroyWorld();
     I        = null;
     Engine.I = null;
     return(EngineStatus.Free);
 }
        public void StartServer(ushort port, int maxPlayers)
        {
            var server = AbstractFactory.Get <INetworkTypeFactory>().GetNew <ISocketServerFacade>();

            SocketFacade = server;
            server.StartServer(port, maxPlayers, this);
            _timeoutBridge.StartWatching(this);
            EngineProxy.NetworkingEstablished();
            MessageBus.SetMediator(this);
        }
Beispiel #9
0
        private ITaskItem ToolsVersionTestHelper(string parentProjectToolsVersionInProject,
                                                 string parentProjectToolsVersionOverride,
                                                 string toolsVersionPassedToEngineProxy)
        {
            Engine engine = new Engine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().EscapedCodeBase).LocalPath));

            engine.AddToolset(new Toolset("44.0", "someToolsPath"));
            engine.AddToolset(new Toolset("55.0", "anotherToolsPath"));
            engine.AddToolset(new Toolset("66.0", "yetanotherToolsPath"));

            // The child project declares its ToolsVersion
            string childProjectFullPath = ObjectModelHelpers.CreateFileInTempProjectDirectory("child.proj", @"
                      <Project ToolsVersion='44.0' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                          <ItemGroup>
                              <ToolsVersionItem Include='$(MSBuildToolsVersion)'>
                                  <ToolsPath>$(MSBuildToolsPath)</ToolsPath>
                                  <BinPath>$(MSBuildBinPath)</BinPath>
                              </ToolsVersionItem>
                          </ItemGroup>
                          <Target Name='Build' Outputs='@(ToolsVersionItem)' />
                      </Project>
                      ");

            // The parent project doesn't declare its ToolsVersion, and its ToolsVersion is not overridden
            string parentProjectContent = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'";

            if (parentProjectToolsVersionInProject != null)
            {
                parentProjectContent += String.Format(" ToolsVersion=\"{0}\"", parentProjectToolsVersionInProject);
            }
            parentProjectContent += "/>";

            Project parentProject =
                ObjectModelHelpers.CreateInMemoryProject(engine, parentProjectContent, null);

            if (parentProjectToolsVersionOverride != null)
            {
                parentProject.ToolsVersion = parentProjectToolsVersionOverride;
            }

            Dictionary <string, ITaskItem[]> targetOutputs =
                new Dictionary <string, ITaskItem[]>(StringComparer.OrdinalIgnoreCase);

            EngineProxy engineProxy = CreateEngineProxyWithDummyTaskEngine(engine, parentProject);
            bool        success     = engineProxy.BuildProjectFile
                                          (childProjectFullPath, null, null, targetOutputs, toolsVersionPassedToEngineProxy);

            ITaskItem toolsVersionItem = targetOutputs["Build"][0];

            Assertion.Assert("Expected a successful build!", success);

            return(toolsVersionItem);
        }
Beispiel #10
0
 public ProxyCommandProcessor(EngineProxy proxy)
 {
     Proxy          = proxy;
     ActiveCommands = new Queue <IEngineCommand>();
     _handlers      = new List <IEngineCommandHandler>()
     {
         Proxy.Game.CommandHandler,                  // todo: whats about order ???
         Proxy.Physics.CommandHandler,
         Proxy.Script.CommandHandler,
         Proxy.Render.CommandHandler,
         Proxy.Core.CommandHandler,
     };
 }
Beispiel #11
0
        public EngineStatus Preinitialize(EngineProxy baseEngine)
        {
            I        = baseEngine;
            Engine.I = I.Script as Engine;
            if (Engine.I == null)
            {
                return(EngineStatus.CriticalFailed);
            }

            Engine.I.CommandHandler = new ScriptingCommandHandler();

            return(EngineStatus.ReadyToLoad);
        }
Beispiel #12
0
        public void ToolsVersionRespectedWhenBuildingASolution()
        {
            ObjectModelHelpers.DeleteTempProjectDirectory();

            Engine engine = new Engine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().EscapedCodeBase).LocalPath));

            // We've intentionally assigned the correct BinPath value to the tools version '3.5' since later
            // we will request the engine build the solution with that tools version, and the engine will
            // need to locate the default tasks. If the override we're going to specify isn't in fact applied,
            // the engine will try to load the tasks from the bogus toolpath, and that will fail the solution build,
            // so this test will fail.
            engine.AddToolset(new Toolset("3.5", engine.BinPath));
            engine.AddToolset(new Toolset("2.0", "anotherToolsPath"));

            string solutionFileContents =
                @"
                Microsoft Visual Studio Solution File, Format Version 9.00
                # Visual Studio 2005
                Global
                    GlobalSection(SolutionConfigurationPlatforms) = preSolution
                        Debug|AnyCPU = Debug|AnyCPU
                        Release|AnyCPU = Release|AnyCPU
                    EndGlobalSection
                    GlobalSection(SolutionProperties) = preSolution
                        HideSolutionNode = FALSE
                    EndGlobalSection
                EndGlobal
                ";

            string solutionFullPath = ObjectModelHelpers.CreateFileInTempProjectDirectory("ConsoleApplication1.sln", solutionFileContents);

            // The parent project doesn't declare its ToolsVersion, and its ToolsVersion is not overridden
            string  parentProjectContent = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' />";
            Project parentProject        =
                ObjectModelHelpers.CreateInMemoryProject(engine, parentProjectContent, null);

            EngineProxy engineProxy = CreateEngineProxyWithDummyTaskEngine(engine, parentProject);
            bool        success     = engineProxy.BuildProjectFile
                                          (solutionFullPath, null, null, null, "3.5");

            Assertion.Assert("Expected a successful build!", success);
        }
Beispiel #13
0
 public static void Main()
 {
     EngineProxy engine = new EngineProxy(1300, false);
     IDiagnosticTool tool = new EngineDiagnosticTool();        
     engine.Diagnose(tool);
 }