示例#1
0
 public IOptionsMgrPresenter Create(IOptionsMgr mgr, IOptionsView view)
 {
     IOptionsMgrPresenter presenter = null;
     if (mgr != null && view != null)
     {
         presenter = new OptionsMgrPresenter(mgr, view);
     }
     return presenter;
 }
示例#2
0
 internal void WrapUp(bool isValidContinue, IOptionsMgr optionsMgr, Exception ex)
 {
     if (isValidContinue && !IsCancelled)
     {
         // --- set status's to completed when all is done
         WorkerStatus = WorkerStatus.Completed;
         UnpersistComplete(PercentProgress, false, ex, null);
     }
     else if (IsCancelled)
     {
         UnpersistComplete(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;
         UnpersistComplete(PercentProgress, IsCancelled, ex, null);
     }
 }
示例#3
0
        internal bool ValidateOptionsMgr(IOptionsMgr optionsMgr, out Exception ex)
        {
            bool isValid = true;
            ex = null;
            string mssg = null;

            if (optionsMgr == null)
            {
                mssg = "The options mgr is null and cannot be persisted.";
                isValid = false;
            }

            if (!isValid)
            {
                PersistException argEx = new PersistException(mssg);
                ex = argEx;
            }
            return isValid;
        }
示例#4
0
        internal void UnpersistWorker(IOptionsMgr optionsMgr, System.Xml.XmlReader reader)
        {
            Exception ex = null;
            bool isValidContinue = false;

            // ------------------------------------------------
            UpdateProgress(1, "Unpersisting ...");

            try
            {
                // ---
                isValidContinue = ValidateReader(reader, out ex);
                if (isValidContinue && !IsCancelled)
                {
                    UnpersistCore(optionsMgr, reader);
                }
                WrapUp(isValidContinue,optionsMgr, ex);
            }
            catch (Exception x)
            {
                // update the status if the ex is not recoverable
                UnpersistWorkerCleanUp(x);
            }
        }
示例#5
0
 internal void UnpersistCore(IOptionsMgr optionsMgr, System.Xml.XmlReader reader)
 {
     // do nothing
 }
示例#6
0
        public void UnpersistOptionsAsync(IOptionsMgr target, System.Xml.XmlReader reader)
        {
            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 UnpersistDelegate(UnpersistWorker).BeginInvoke(target, reader, null, null);
        }
示例#7
0
        public void UnpersistOptions(IOptionsMgr target, System.Xml.XmlReader reader)
        {
            IsAsynch = false;
            WorkerStatus = WorkerStatus.ExecutingSynch;
            CompletionCalled = false;
            PercentProgress = 0;

            UnpersistWorker(target, reader);
        }
示例#8
0
        internal IOptionsMgrPresenter CreateOptionsMgrPresenter(IOptionsMgr mgr, IOptionsView view)
        {
            IOptionsMgrPresenter presenter = null;
            using (OptionsMgrPresenterFactory fac = new OptionsMgrPresenterFactory())
            {
                presenter = fac.Create(mgr, view);
            }

            return presenter;
        }
示例#9
0
 internal void PersistCore(IOptionsMgr optionsMgr, System.Xml.XmlWriter writer)
 {
     writer.WriteStartElement("Options");
     writer.WriteEndElement();
 }
示例#10
0
        public void PersistOptions(IOptionsMgr optionsMgr, System.Xml.XmlWriter writer)
        {
            IsAsynch = false;
            WorkerStatus = WorkerStatus.ExecutingSynch;
            CompletionCalled = false;
            PercentProgress = 0;

            PersistWorker(optionsMgr, writer);
        }
示例#11
0
 public OptionsMgrPresenter(IOptionsMgr mgr, IOptionsView view)
 {
     View = view;
     Mgr = mgr;
 }