public IWorkSpaceUnpersister Create(IWorkSpace workSpace, WorkSpaceFormats format) { throw new NotImplementedException(); //IWorkSpaceUnpersister persister = null; //if (workSpace != null) //{ // return new WorkSpaceUnpersister(); //} //return persister; }
public void Unpersist(WorkSpaceFormats format, string fileName, IWorkSpace workSpace) { Format = format; FileName = fileName; WorkSpace = workSpace; Unpersist(); }
public UnpersistMgr(WorkSpaceFormats format, string fileName, IWorkSpace workSpace) { Format = format; FileName = fileName; WorkSpace = workSpace; }
/// <summary> /// Initializes a new instance of the SaveWorkSpaceEventArgs class. /// </summary> /// <param name="fileName">The workspace file name (with full path) </param> /// <param name="view">The <see cref="IWorkSpaceView"/> of the workspace to be saved. </param> /// <param name="format">The <see cref="WorkSpaceFormats"/> specifying the output format. </param> public OpenWorkSpaceEventArgs(string fileName, WorkSpaceFormats format) { FileName = fileName; Format = format; }
/// <summary> /// Initializes a new instance of the SaveWorkSpaceEventArgs class. /// </summary> /// <param name="fileName">The workspace file name (with full path) </param> /// <param name="view">The <see cref="IWorkSpaceView"/> of the workspace to be saved. </param> /// <param name="format">The <see cref="WorkSpaceFormats"/> specifying the output format. </param> public SaveWorkSpaceEventArgs(string fileName, Guid workSpaceId, WorkSpaceFormats format) { FileName = fileName; WorkSpaceId = workSpaceId; Format = format; }
internal void UnpersistWorkSpace(IWorkSpace workSpace, string fileName, WorkSpaceFormats format, out IPipeTicket[] pipeTickets) { pipeTickets = null; UnpersistMgr upMgr = new UnpersistMgr(null); try { upMgr.UnpersistProgressChanged += new UnpersistProgressChangedEventHandler<UnpersistMgr, UnpersistProgressChangedEventArgs>(upMgr_UnpersistProgressChanged); upMgr.UnpersistCompleted += new UnpersistCompletedEventHandler<UnpersistMgr, UnpersistCompletedEventArgs>(upMgr_UnpersistCompleted); upMgr.WorkSpace = workSpace; upMgr.FileName = fileName; upMgr.Format = format; upMgr.Unpersist(out pipeTickets); } catch (Exception ex) { _Logger.Fatal(ex.Message, ex); throw; } finally { if (upMgr != null) { upMgr.UnpersistProgressChanged -= upMgr_UnpersistProgressChanged; upMgr.UnpersistCompleted -= upMgr_UnpersistCompleted; ((IDisposable)upMgr).Dispose(); } } }
internal void SaveWorkSpace(IWorkSpace workSpace, string fileName, WorkSpaceFormats format) { PersistMgr pMgr = new PersistMgr(); try { pMgr.PersistProgressChanged += new PersistProgressChangedEventHandler<PersistMgr, PersistProgressChangedEventArgs>(pMgr_PersistProgressChanged); pMgr.PersistCompleted += new PersistCompletedEventHandler<PersistMgr, PersistCompletedEventArgs>(pMgr_PersistCompleted); pMgr.WorkSpace = workSpace; pMgr.Format = format; pMgr.FileName = fileName; pMgr.Persist(); } catch (Exception ex) { _Logger.Fatal(ex.Message, ex); throw; } finally { if (pMgr != null) { pMgr.PersistProgressChanged -= pMgr_PersistProgressChanged; pMgr.PersistCompleted -= pMgr_PersistCompleted; ((IDisposable)pMgr).Dispose(); } } }
/// <summary> /// Saves the workspace with the id <paramref name="ownerId"/> to the file specified in <paramref name="fileName"/>. /// </summary> /// <param name="ownerId">The id of the workspace to save.</param> /// <param name="fileName">The full path to the target file.</param> /// <param name="format">The format to save in.</param> public void Save(Guid ownerId, string fileName, WorkSpaceFormats format) { IWorkSpace ws = App.WorkSpace; SaveWorkSpace(ws, fileName, format); }
public void OpenWorkSpace(string fileName, WorkSpaceFormats format) { // start with empty id, opening the file will set the id to the persisted one. IWorkSpace ws = CreateWorkSpaceCore(Guid.Empty); IPipeTicket[] pipeTickets = null; UnpersistWorkSpace(ws, fileName, format, out pipeTickets); // update the ws properties with the file name ws.WSProperties.FileName = string.Copy(fileName); // using the unpersisted workspace, create a full MVP stack and add the workspace view to the App view. IWorkSpacePresenter wsPresenter = OpenWorkSpaceMVP(ws); // load all the element models which have been unpersisted into the new workspace view. wsPresenter.LoadElementsIntoView(); // load all the pipe models which have been unpersisted into the new workspace view. wsPresenter.LoadPipesIntoView(pipeTickets); }