public void SetFormDesigner() { using (DAE.Runtime.Data.Scalar nodeTable = DataSession.Evaluate(FormDesignerNodeTypesExpression)) { NodeTypeTable.Clear(); NodeTypeTable.LoadFromString(nodeTable.AsString); } // Load the files required to register any nodes, if necessary if (DataSession.Server is DAE.Server.LocalServer) { IServerCursor cursor = DataSession.OpenCursor(GetFormDesignerLibraryFilesExpression); try { using (DAE.Runtime.Data.IRow row = cursor.Plan.RequestRow()) { bool shouldLoad; List <string> filesToLoad = new List <string>(); while (cursor.Next()) { cursor.Select(row); string fullFileName = ((DAE.Server.LocalServer)DataSession.Server).GetFile ( (DAE.Server.LocalProcess)cursor.Plan.Process, (string)row["Library_Name"], (string)row["Name"], (DateTime)row["TimeStamp"], (bool)row["IsDotNetAssembly"], out shouldLoad ); if (shouldLoad) { filesToLoad.Add(fullFileName); } } // Load each file to ensure they can be reached by the assembly resolver hack (see AssemblyUtility) foreach (string fullFileName in filesToLoad) { Assembly.LoadFrom(fullFileName); } } } finally { DataSession.CloseCursor(cursor); } } }
public void SetLibrary(string libraryName) { DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams(); paramsValue.Add(DAE.Runtime.DataParam.Create(Pipe.Process, "ALibraryName", libraryName)); using ( DAE.Runtime.Data.Scalar nodeTable = DataSession.Evaluate ( LibraryNodeTypesExpression, paramsValue ) ) { NodeTypeTable.Clear(); NodeTypeTable.LoadFromString(nodeTable.AsString); } ValidateNodeTypeTable(); }
/// <summary> Prepares for opening a document in the specified application. </summary> /// <returns> The starting document configured for the application. </returns> public virtual string SetApplication(string applicationID, string clientType) { DAE.Runtime.DataParams paramsValue = new DAE.Runtime.DataParams(); paramsValue.Add(DAE.Runtime.DataParam.Create(Pipe.Process, "AApplicationID", applicationID)); paramsValue.Add(DAE.Runtime.DataParam.Create(Pipe.Process, "AClientType", clientType)); // Get the node types table using (DAE.Runtime.Data.Scalar nodeTable = DataSession.Evaluate(ApplicationNodeTableExpression, paramsValue)) { NodeTypeTable.Clear(); NodeTypeTable.LoadFromString(nodeTable.AsString); } ValidateNodeTypeTable(); // Prepare the application and get name of the starting document string documentString = null; using (DAE.Runtime.Data.Scalar startingDocument = DataSession.Evaluate(PrepareApplicationExpression, paramsValue)) { documentString = startingDocument.AsString; } // Load the files required to register any nodes, if necessary if (DataSession.Server is DAE.Server.LocalServer) { IServerCursor cursor = DataSession.OpenCursor(GetLibraryFilesExpression, paramsValue); try { using (DAE.Runtime.Data.IRow row = cursor.Plan.RequestRow()) { #if !SILVERLIGHT bool shouldLoad; List <string> filesToLoad = new List <string>(); while (cursor.Next()) { cursor.Select(row); string fullFileName = ((DAE.Server.LocalServer)DataSession.Server).GetFile ( (DAE.Server.LocalProcess)cursor.Plan.Process, (string)row["Library_Name"], (string)row["Name"], (DateTime)row["TimeStamp"], (bool)row["IsDotNetAssembly"], out shouldLoad ); if (shouldLoad) { filesToLoad.Add(fullFileName); } } // Load each file to ensure they can be reached by the assembly resolver hack (see AssemblyUtility) foreach (string fullFileName in filesToLoad) { Assembly.LoadFrom(fullFileName); } #else while (cursor.Next()) { cursor.Select(row); ((DAE.Server.LocalServer)DataSession.Server).LoadAndRegister ( (DAE.Server.LocalProcess)cursor.Plan.Process, cursor.Plan.Catalog.ClassLoader, (string)row["Library_Name"], (string)row["Name"], (bool)row["ShouldRegister"] ); } #endif } } finally { DataSession.CloseCursor(cursor); } } return(documentString); }