protected void LoadImage() { if (!ImageSource.Loading) { try { ImageSource.LoadImage(); if (ImageSource.Stream != null) { using (DAE.Runtime.Data.Scalar newValue = new DAE.Runtime.Data.Scalar(ImageControl.Source.DataSet.Process.ValueManager, ImageControl.Source.DataSet.Process.DataTypes.SystemGraphic)) { using (Stream stream = newValue.OpenStream()) { using (ImageSource.Stream) { ImageSource.Stream.Position = 0; StreamUtility.CopyStream(ImageSource.Stream, stream); ImageControl.DataField.Value = newValue; ImageControl.LoadImage(); } } } } } finally { if (ImageSource.GetType() == typeof(ImageCaptureForm)) { ImageSource = null; } } } }
/// <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); }