Пример #1
0
 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);
 }
Пример #2
0
 public WorkSpace()
 {
     _wsProperties = new WorkSpaceProperties(Id);
 }
Пример #3
0
        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;
        }
Пример #4
0
 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);
     }
 }
Пример #5
0
 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();
 }
Пример #6
0
        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);
            }
        }
Пример #7
0
        public void PersistProperties(IWorkSpaceProperties wsProperties, System.Xml.XmlWriter writer)
        {
            IsAsynch = false;
            WorkerStatus = WorkerStatus.ExecutingSynch;
            CompletionCalled = false;
            PercentProgress = 0;

            PersistWorker(wsProperties, writer);
        }
Пример #8
0
        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);
        }
Пример #9
0
 internal void PersistProperties(IWorkSpaceProperties props, System.Xml.XmlWriter writer)
 {
     // Nothing gets written out if it is null
     if (props!=null)
         PropertiesPersister.PersistProperties(props, writer);
 }
Пример #10
0
        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);
                    }
                }
            }
        }
Пример #11
0
        public void UnpersistProperties(IWorkSpaceProperties target, System.Xml.XmlReader reader)
        {
            IsAsynch = false;
            WorkerStatus = WorkerStatus.ExecutingSynch;
            CompletionCalled = false;
            PercentProgress = 0;

            UnpersistWorker(target, reader);
        }
Пример #12
0
 internal void UnpersistProperties(IWorkSpaceProperties properties, System.Xml.XmlReader reader)
 {
     PropertiesUnpersister.UnpersistProperties(properties, reader);
 }
Пример #13
0
 /// <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";
 }