public WorkSpace(Guid id, IVarMgr varMgr, IElements elementsMgr, IPipes pipesMgr, IWorkSpaceOptionsMgr optionsMgr, IWorkSpaceSettingsMgr settingsMgr) { SettingsMgr = settingsMgr; OptionsMgr = optionsMgr; VarMgr = varMgr; ElementsMgr = elementsMgr; PipesMgr = pipesMgr; Id = id; _wsProperties = new WorkSpaceProperties(Id); }
public WorkSpace() { _wsProperties = new WorkSpaceProperties(Id); }
internal bool ValidateWorkSpaceProperties(IWorkSpaceProperties wsProperties, out Exception ex) { bool isValid = true; ex = null; string mssg = null; if (wsProperties == null) { mssg = "The settings mgr is null and cannot be persisted."; isValid = false; } if (!isValid) { PersistException argEx = new PersistException(mssg); ex = argEx; } return isValid; }
internal void WrapUp(bool isValidContinue, IWorkSpaceProperties wsProperties, Exception ex) { if (isValidContinue && !IsCancelled) { // --- set status's to completed when all is done WorkerStatus = WorkerStatus.Completed; PersistComplete(PercentProgress, false, ex, null); } else if (IsCancelled) { PersistComplete(PercentProgress, IsCancelled, ex, null); } else { // ex cannot be null if an error occured if (ex == null) ex = new FxExecutionErrorException("An persistance error occured."); WorkerStatus = WorkerStatus.Error; PersistComplete(PercentProgress, IsCancelled, ex, null); } }
internal void PersistCore(IWorkSpaceProperties wsProperties, System.Xml.XmlWriter writer) { writer.WriteStartElement("WorkSpaceProperties"); if (!string.IsNullOrEmpty(wsProperties.Name)) { writer.WriteStartElement("Name"); writer.WriteString(wsProperties.Name); writer.WriteEndElement(); } if (!string.IsNullOrEmpty(wsProperties.Description)) { writer.WriteStartElement("Description"); writer.WriteString(wsProperties.Description); writer.WriteEndElement(); } writer.WriteEndElement(); }
internal void PersistWorker(IWorkSpaceProperties wsProperties, System.Xml.XmlWriter writer) { Exception ex = null; bool isValidContinue = false; // ------------------------------------------------ UpdateProgress(1, "Persisting ..."); try { // --- isValidContinue = ValidateWorkSpaceProperties(wsProperties, out ex); if (isValidContinue && !IsCancelled) { PersistCore(wsProperties, writer); } WrapUp(isValidContinue, wsProperties, ex); } catch (Exception x) { // update the status if the ex is not recoverable PersistWorkerCleanUp(x); } }
public void PersistProperties(IWorkSpaceProperties wsProperties, System.Xml.XmlWriter writer) { IsAsynch = false; WorkerStatus = WorkerStatus.ExecutingSynch; CompletionCalled = false; PercentProgress = 0; PersistWorker(wsProperties, writer); }
public void PersistPropertiesAsync(IWorkSpaceProperties wsProperties, System.Xml.XmlWriter writer) { throw new Exception("The method or operation is not implemented."); if (IsBusy) { CancelAsync(); Reset(); } IsAsynch = true; WorkerStatus = WorkerStatus.ExecutingAsynch; PercentProgress = 0; CompletionCalled = false; AsynchOp = AsyncOperationManager.CreateOperation(null); new PersistDelegate(PersistWorker).BeginInvoke(wsProperties, writer, null, null); }
internal void PersistProperties(IWorkSpaceProperties props, System.Xml.XmlWriter writer) { // Nothing gets written out if it is null if (props!=null) PropertiesPersister.PersistProperties(props, writer); }
internal void UnpersistCore(IWorkSpaceProperties wsProperties, System.Xml.XmlReader reader) { // Assumes reader has started the read of element "WorkSpaceProperties" int startDepth = reader.Depth; string tmp = null; while (reader.Read() && reader.Depth>startDepth) { if (reader.IsStartElement() && reader.Name == "Name") { if (!reader.IsEmptyElement) { tmp = null; UnpersistName(reader, out tmp); wsProperties.Name = string.Copy(tmp); } } else if (reader.IsStartElement() && reader.Name == "Description") { if (!reader.IsEmptyElement) { tmp = null; UnpersistDescription(reader, out tmp); wsProperties.Description = string.Copy(tmp); } } } }
public void UnpersistProperties(IWorkSpaceProperties target, System.Xml.XmlReader reader) { IsAsynch = false; WorkerStatus = WorkerStatus.ExecutingSynch; CompletionCalled = false; PercentProgress = 0; UnpersistWorker(target, reader); }
internal void UnpersistProperties(IWorkSpaceProperties properties, System.Xml.XmlReader reader) { PropertiesUnpersister.UnpersistProperties(properties, reader); }
/// <summary> /// Sets the default values for <paramref name="wsProperties"/>. This method should be called and applied /// for newly created WorkSpaces. /// </summary> /// <param name="wsProperties">A newly created <see cref="IWorkSpaceProperties"/> object.</param> internal void SetDefaultProperties(IWorkSpaceProperties wsProperties) { wsProperties.Name = "WorkSpace"; }