Esempio n. 1
0
        public ISecondaryView Create(ICompoundElement element)
        {
            ISecondaryView view = null;

            if (element is NetworkPropertiesElement)
                view = Create((NetworkPropertiesElement)element);
            else if (element is DataPropertiesElement)
                view = Create(element as DataPropertiesElement);
            //else if (element is BasicGridViewElement)
            //    view = Create(element as BasicGridViewElement);
            else
                throw new NotImplementedException();

            if (view!=null)
            {
                IElementTemplate template = null;
                using (var prov = new Standard.TemplateProvider())
                {
                    template = prov.GetTemplate(element.TypeId);
                }
                view.SetTemplate(template);
            }

            return view;
        }
Esempio n. 2
0
 public ICompoundElementPresenter Create(ICompoundElement element, ICompoundElementView view)
 {
     CompoundElementPresenter pres = null;
     if (element != null && view != null)
     {
         pres = new CompoundElementPresenter(element, view);
         view.CompoundPresenter = pres;
     }
     return pres;
 }
Esempio n. 3
0
 public ElementSummary GetSummary(ICompoundElement element)
 {
     var summary = new ElementSummary();
     summary.ElementTypeId = element.TypeId;
     summary.Scope = element.Scope;
     summary.InstanceId = element.Id;
     summary.ElementTypeName = element.TypeName;
     summary.Inputs = FormatInputs(element.InPortMgr);
     summary.Outputs = FormatOutputs(element.OutPortMgr);
     summary.ParamNames = FormatParamNames(element.ParamMgr.Values);
     summary.ParamValues = FormatParamValues(element.ParamMgr.Values);
     return summary;
 }
Esempio n. 4
0
        public ISecondaryViewJoiner Create(ICompoundElement element)
        {
            ISecondaryViewJoiner joiner = null;

            if (element is NetworkPropertiesElement)
                joiner = Create((NetworkPropertiesElement)element);
            else if (element is DataPropertiesElement)
                joiner = Create(element as DataPropertiesElement);
            //else if (element is BasicGridViewElement)
            //    joiner = Create(element as BasicGridViewElement);
            else
                throw new NotImplementedException();
            return joiner;
        }
Esempio n. 5
0
        public virtual string FormatCompoundElement(ICompoundElement element)
        {
            TextBuilder builder = new TextBuilder(Template);

            if (Template.Contains(Constants.TemplateField_ElTypeName))
                builder.Replace(Constants.TemplateField_ElTypeName, element.TypeName);
            if (Template.Contains(Constants.TemplateField_ElId))
                builder.Replace(Constants.TemplateField_ElId, element.Id);
            if (Template.Contains(Constants.TemplateField_ParentId))
                builder.Replace(Constants.TemplateField_ParentId, element.ParentId);
            if (Template.Contains(Constants.TemplateField_ElStatus))
                builder.Replace(Constants.TemplateField_ElStatus, element.Status);
            if (Template.Contains(Constants.TemplateField_Params))
            {
                IParamMgrTextFormatter formatter = TextFormatterFactory.CreateParamMgrFormatter();
                builder.Replace(Constants.TemplateField_Params, formatter.Format(element.ParamMgr));
            }
            if (Template.Contains(Constants.TemplateField_Inputs))
            {
                IInputPortMgrTextFormatter formatter = TextFormatterFactory.CreateInputPortMgrFormatter();
                builder.Replace(Constants.TemplateField_Inputs, formatter.Format(element.InPortMgr));
            }
            if (Template.Contains(Constants.TemplateField_Outputs))
            {
                IOutputPortMgrTextFormatter formatter = TextFormatterFactory.CreateOutputPortMgrFormatter();
                builder.Replace(Constants.TemplateField_Outputs, formatter.Format(element.OutPortMgr));
            }
            if (Template.Contains(Constants.TemplateField_Settings))
            {
                ISettingsMgrTextFormatter formatter = TextFormatterFactory.CreateSettingsMgrFormatter();
                builder.Replace(Constants.TemplateField_Settings, formatter.Format(element.SettingsMgr));
            }
            if (Template.Contains(Constants.TemplateField_Options))
            {
                IOptionsMgrTextFormatter formatter = TextFormatterFactory.CreateOptionsMgrFormatter();
                builder.Replace(Constants.TemplateField_Options, formatter.Format(element.OptionsMgr));
            }
            return builder.ToString();
        }
Esempio n. 6
0
 internal void PersistCompoundElement(ICompoundElement element, System.Xml.XmlWriter writer)
 {
     CompoundElPersister.PersistCompoundElement(element, writer);
     CompoundElPersister.Reset();
 }
Esempio n. 7
0
        internal IParamsView CreateParamMgrView(ICompoundElement element)
        {
            throw new NotImplementedException();
            IParamMgr paramMgr = element.ParamMgr;
            string packageName = element.PackageName;
            IParamsView view = null;
            //using (IParamsViewFactory fac = Base.ContainerProvider.PackageContainer.Resolve<IParamsViewFactory>(packageName))
            //{
            //    view = fac.Create(paramMgr);

            //    // set the id of the ParamsMgrView to that of the ParamMgr
            //    view.Id = paramMgr.Id;
            //}

            return view;
        }
Esempio n. 8
0
        internal void PersistParamMgr(ICompoundElement element, System.Xml.XmlWriter writer)
        {
            using (IPersisterFactoryProvider facProvider = _provider.GetFactory<IPersisterFactoryProvider>(element))
            {
                IPersisterFactory fac = facProvider.Create(element);
                if (fac != null)
                {
                    using (IParamMgrPersister persister = fac.CreateParamMgrPersister())
                    {
                        IParamMgr mgr = element.ParamMgr;
                        persister.PersistMgr(mgr, writer);
                    }
                }

            }
        }
Esempio n. 9
0
        public void PersistCompoundElementAsync(ICompoundElement element, 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(element, writer, null, null);
        }
Esempio n. 10
0
        internal ICompoundSettingsMgr _CreateSettingsMgr(ICompoundElement element)
        {
            ICompoundSettingsMgr mgr = null;
            if (element != null)
            {
                mgr = new CompoundSettingsMgr();
            }

            return mgr;
        }
Esempio n. 11
0
 internal void _Element_SecondaryViewExecute(ICompoundElement sender, SecondaryViewExecuteEventArgs ea)
 {
     if (sender != null)
     {
         ExecutionToggle();
     }
 }
Esempio n. 12
0
 internal void _Element_Cancelled(ICompoundElement sender, SecondaryViewCancelEventArgs ea)
 {
     CloseSecondaryView();
 }
Esempio n. 13
0
 /// <summary>
 /// Updates the <see cref=""/> with element status and messagees.
 /// </summary>
 /// <param name="view">The IElementCustomizationsView for the element</param>
 /// <param name="element">The element core</param>
 internal void UpdateElementStatusInCustomizationsView(IElementCustomizationsView view, ICompoundElement element)
 {
     view.SetElementStatus(element.Status);
     view.MessageView.MessageBody = element.Message;
 }
Esempio n. 14
0
 internal void UnsubscribeFromElement(ICompoundElement element)
 {
     if (element != null)
     {
         element.StatusChanged -= _Element_StatusChanged;
         element.RequestVariableValues -= _Element_RequestVariableValues;
         element.SelectionChanged -= _Element_SelectionChanged;
         element.ElementReset -= _Element_ElementReset;
         element.SecondaryViewCancel -= _Element_Cancelled;
         element.SecondaryViewExecute -= _Element_SecondaryViewExecute;
         element = null;
     }
 }
Esempio n. 15
0
 internal void SubscribeToElement(ICompoundElement element)
 {
     if (element != null)
     {
         element.StatusChanged += new StatusChangeEventHandler<IElement, ElementStatusChangeEventArgs>(_Element_StatusChanged);
         element.RequestVariableValues += new RequestVariableValuesEventHandler<IElement>(_Element_RequestVariableValues);
         element.SelectionChanged += new SelectionEventHandler<IElement, SelectionEventArgs>(_Element_SelectionChanged);
         element.ElementReset += new ElementResetEventHandler<IElement, ElementResetEventArgs>(_Element_ElementReset);
         element.SecondaryViewCancel += new SecondaryViewCancelEventHandler<ICompoundElement, SecondaryViewCancelEventArgs>(_Element_Cancelled);
         element.SecondaryViewExecute += new SecondaryViewExecuteEventHandler<ICompoundElement, SecondaryViewExecuteEventArgs>(_Element_SecondaryViewExecute);
     }
 }
Esempio n. 16
0
 internal void CreateSecondaryView(ICompoundElement element)
 {
     throw new NotImplementedException();
     //IElementTemplateDictionary dic = Base.ContainerProvider.CoreContainer.Resolve<IElementTemplateDictionary>();
     //IElementTemplate template = dic[element.TypeId];
     //CreateSecondaryViewOnUIThread(template, template.Definition);
 }
Esempio n. 17
0
        public void PersistCompoundElement(ICompoundElement element, System.Xml.XmlWriter writer)
        {
            IsAsynch = false;
            WorkerStatus = WorkerStatus.ExecutingSynch;
            CompletionCalled = false;
            PercentProgress = 0;

            PersistWorker(element, writer);
        }
Esempio n. 18
0
 public ICompoundSettingsMgr CreateSettingsMgr(ICompoundElement element)
 {
     return _CreateSettingsMgr(element);
 }
Esempio n. 19
0
        internal void PersistCore(ICompoundElement element, System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("Element");
            writer.WriteAttributeString("id", XmlConvert.ToString(element.Id));
            writer.WriteAttributeString("typeId", XmlConvert.ToString(element.TypeId));
            writer.WriteAttributeString("typeName", element.TypeName);

            // order matches with UnpersistCore() order of reading, dont change!!!
            PersistFx(element.Fx, writer);
            PersistInPortMgr(element.InPortMgr, writer);
            PersistOutPortMgr(element.OutPortMgr, writer);
            PersistSettingsMgr(element.SettingsMgr, writer);
            PersistOptionsMgr(element.OptionsMgr, writer);
            PersistParamMgr(element, writer);

            writer.WriteEndElement();
        }
Esempio n. 20
0
        internal ICompoundOptionsMgr _CreateOptionsMgr(ICompoundElement element)
        {
            ICompoundOptionsMgr mgr = null;
            if (element != null)
            {
                mgr = new CompoundOptionsMgr();
            }

            return mgr;
        }
Esempio n. 21
0
 internal void WrapUp(bool isValidContinue, ICompoundElement element, 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);
     }
 }
Esempio n. 22
0
 public ICompoundOptionsMgr CreateOptionsMgr(ICompoundElement element)
 {
     return _CreateOptionsMgr(element);
 }
Esempio n. 23
0
        public IPersisterFactory Create(ICompoundElement element)
        {
            IPersisterFactory persister = null;

            return persister;
        }
Esempio n. 24
0
 public CompoundElementPresenter(ICompoundElement element, ICompoundElementView view)
 {
     CompoundElement = element;
     CompoundView = view;
 }