public RandomNetworkGenElement Create(Guid id, IElementDefinition defType) { RandomNetworkGenElement el = new RandomNetworkGenElement(id, defType); IInputPortMgr inPortMgr = CreateInputPortMgr(el); IOutputPortMgr outPortMgr = CreateOutputPortMgr(el); el.InPortMgr = inPortMgr; el.OutPortMgr = outPortMgr; IRandomNetGenParamMgr paramMgr = CreateParamMgr(); el.ParamMgr = paramMgr; Guid fxId = Guid.NewGuid(); IRandomNetworkGenFx fx = CreateMyFx(fxId, id); el.Fx = fx; using (SettingsMgrFactory fac = new SettingsMgrFactory()) { ISimpleSettingsMgr settingsMgr = fac.CreateSettingsMgr(el); el.SettingsMgr = settingsMgr; } using (OptionsMgrFactory fac = new OptionsMgrFactory()) { ISimpleOptionsMgr optsMgr = fac.CreateOptionsMgr(el); el.OptionsMgr = optsMgr; } return el; }
public ICompoundElementView CreateCompoundView(IElementDefinition definition) { throw new NotImplementedException("The method or operation is not implemented.");//TODO //try //{ // // just create the view, // if (definition != null) // { // IElementTemplateDictionary dic = Base.ProviderContainer.CoreContainer.Resolve<IElementTemplateDictionary>(); // IElementTemplate template = dic[definition.ElementTypeId]; // CompoundGoElement el = new CompoundGoElement(); // el.Caption = definition.Caption; // el.ToolTipTitle = definition.Caption; // el.ToolTipText = definition.ElementDescription; // SetImages(el, template); // el.InitializeDisplay(); // CreatePorts(el, definition.InputPortTypes, definition.OutputPortTypes); // return el; // } //} //catch (Exception ex) //{ // string x = ex.Message; //} //finally //{ //} //return null; }
public ElementTemplate(IElementDefinition definition, Image largeImage, Image mediumImage, Image smallImage) { Definition = definition; LargeImage = largeImage; MediumImage = mediumImage; SmallImage = smallImage; }
public ExtractKthCoreElement Create(IElementTicket ticket, IElementDefinition defType) { if (ticket.TypeId != defType.ElementTypeId) { throw new InvalidOperationException(Properties.Resources.MssgTicketTypeIdDoesNotMatchDefTypeIdFormat(ticket.TypeId, defType.ElementTypeId)); } ExtractKthCoreElement el = new ExtractKthCoreElement(ticket.ElementId, defType); IInputPortMgr inPortMgr = CreateInputPortMgr(el, ticket.InputPortMgrId, ticket.InputPortIds[0]); IOutputPortMgr outPortMgr = CreateOutputPortMgr(el, ticket.OutputPortMgrId, ticket.OutputPortIds[0]); el.InPortMgr = inPortMgr; el.OutPortMgr = outPortMgr; IExtractKthCoreParamMgr paramMgr = CreateParamMgr(ticket.ParamMgrId); el.ParamMgr = paramMgr; IExtractKthCoreFx fx = CreateMyFx(ticket.FxId, ticket.ElementId); el.Fx = fx; using (SettingsMgrFactory fac = new SettingsMgrFactory()) { ISimpleSettingsMgr settingsMgr = fac.CreateSettingsMgr(el); el.SettingsMgr = settingsMgr; } using (OptionsMgrFactory fac = new OptionsMgrFactory()) { ISimpleOptionsMgr optsMgr = fac.CreateOptionsMgr(el); el.OptionsMgr = optsMgr; } return el; }
public ExtractKthCoreElement Create(Guid elementId, IElementDefinition defType) { ExtractKthCoreElement el = new ExtractKthCoreElement(elementId, defType); IInputPortMgr inPortMgr = CreateInputPortMgr(el); IOutputPortMgr outPortMgr = CreateOutputPortMgr(el); el.InPortMgr = inPortMgr; el.OutPortMgr = outPortMgr; IExtractKthCoreParamMgr paramMgr = CreateParamMgr(); el.ParamMgr = paramMgr; Guid fxId = Guid.NewGuid(); IExtractKthCoreFx fx = CreateMyFx(fxId, elementId); el.Fx = fx; using (SettingsMgrFactory fac = new SettingsMgrFactory()) { ISimpleSettingsMgr settingsMgr = fac.CreateSettingsMgr(el); el.SettingsMgr = settingsMgr; } using (OptionsMgrFactory fac = new OptionsMgrFactory()) { ISimpleOptionsMgr optsMgr = fac.CreateOptionsMgr(el); el.OptionsMgr = optsMgr; } return el; }
public static string GetDeclaredModifiers(this IElementDefinition definition) { definition = definition ?? throw new ArgumentNullException(nameof(definition)); var modifiers = new List <string>(2); var parts = definition.DeclaredModifiers.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); foreach (var part in parts) { switch (part) { case "private": case "internal": case "protected": case "public": break; default: modifiers.Add(part); break; } } return(string.Join(" ", modifiers)); }
public DataPropertiesElement Create(Guid id, IElementDefinition defType) { DataPropertiesElement el = new DataPropertiesElement(id, defType); IInputPortMgr inPortMgr = CreateInputPortMgr(el); IOutputPortMgr outPortMgr = CreateOutputPortMgr(el); el.InPortMgr = inPortMgr; el.OutPortMgr = outPortMgr; IDataPropertiesElementParamMgr paramMgr = CreateParamMgr(); el.ParamMgr = paramMgr; Guid fxId = Guid.NewGuid(); IDataPropertiesElementFx fx = CreateMyFx(fxId, id); el.Fx = fx; using (SettingsMgrFactory fac = new SettingsMgrFactory()) { ICompoundSettingsMgr settingsMgr = fac.CreateSettingsMgr(el); el.SettingsMgr = settingsMgr; } using (OptionsMgrFactory fac = new OptionsMgrFactory()) { ICompoundOptionsMgr optsMgr = fac.CreateOptionsMgr(el); el.OptionsMgr = optsMgr; } return el; }
public static IReadOnlyCollection <IAttributeDefinition> DetermineAttributes(AccessorDeclarationSyntax node, IElementDefinition declaringItem) { node = node ?? throw new ArgumentNullException(nameof(node)); declaringItem = declaringItem ?? throw new ArgumentNullException(nameof(declaringItem)); var attributeList = node.AttributeLists; return(DetermineAttributes(declaringItem, attributeList)); }
/// <summary> /// This method returns the appropriate <see cref="IElementDefinition"/> which will in turn /// create the instance of the ElementCtrlUI (ie the view) for the type of element defined /// in the <see cref="IElementViewFactory"/> parameter. /// </summary> public IElementViewFactory Create(IElementDefinition definition) { if (_uiConfiguration == "Windows.Forms") { // all there is right now return new ElementViewFactory(); } return null; }
public ElementTemplate(IElementDefinition definition, Image largeImage, Image mediumImage, Image mediumImageComplete, Image mediumImageError, Image smallImage, Icon mediumIcon, Icon smallIcon) { Definition = definition; LargeImage = largeImage; MediumImage = mediumImage; MediumImageComplete = mediumImageComplete; MediumImageError = mediumImageError; SmallImage = smallImage; MediumIcon = mediumIcon; SmallIcon = smallIcon; }
public SimpleElementFactoryBase(IElementDefinition definition, Guid elementId, Guid fxId, Guid[] inputPortIds, Guid[] outputPortIds) { Definition = definition; ElementId = elementId; InputPortIds = inputPortIds; OutputPortIds = outputPortIds; FxId = fxId; InputPortMgrId = Guid.NewGuid(); OutputPortMgrId = Guid.NewGuid(); SettingsMgrId = Guid.NewGuid(); OptionsMgrId = Guid.NewGuid(); ParamMgrId = Guid.NewGuid(); }
public IElementFactory Create(IElementDefinition definition) { // TODO sucks, hack, dont like IElementFactory elFac = null; if (definition != null) { string fullName = string.Format("{0}.{1}", definition.NameSpace, definition.FactoryName); Type facType = this.GetType().Assembly.GetType(fullName); ConstructorInfo csi = facType.GetConstructor(new Type[] { }); elFac = csi.Invoke(null) as IElementFactory; } return elFac; }
public ElementWindow(IElementConfiguration appenderConfiguration, IElementDefinition propertyDefinition, IWindowSizeLocation windowSizeLocation, ISaveStrategy saveStrategy) : base(windowSizeLocation.RetentionKey) { InitializeComponent(); DataContext = this; mMessageBoxService = new MessageBoxService(this); mConfiguration = appenderConfiguration; mSaveStrategy = saveStrategy; SetWindowSizeLocation(windowSizeLocation); PropertyDefinition = propertyDefinition; PropertyDefinition.MessageBoxService = mMessageBoxService; Loaded += WindowOnLoaded; Icon = new BitmapImage(new Uri(PropertyDefinition.Icon)); }
public IElementView CreateView(IElementDefinition definition) { if (definition != null) { if (definition.Scope == ElementScope.Simple) { return CreateSimpleView(definition); } else if (definition.Scope == ElementScope.Compound) { return CreateCompoundView(definition); } else { return CreateProcedureView(definition); } } return null; }
public ElementWindow(IElementConfiguration appenderConfiguration, IElementDefinition propertyDefinition, IWindowSizeLocation windowSizeLocation, ISaveStrategy saveStrategy) : base(windowSizeLocation.RetentionKey) { InitializeComponent(); DataContext = this; mMessageBoxService = new MessageBoxService(this); mConfiguration = appenderConfiguration; WindowSizeLocation = windowSizeLocation; mSaveStrategy = saveStrategy; SetWindowSizeLocation(windowSizeLocation); PropertyDefinition = propertyDefinition; PropertyDefinition.MessageBoxService = mMessageBoxService; Properties = new ObservableCollection <IProperty>(); Loaded += WindowOnLoaded; ((INotifyCollectionChanged)PropertyDefinition.Properties).CollectionChanged += PropertiesOnCollectionChanged; Icon = new BitmapImage(new Uri(PropertyDefinition.Icon)); }
public SimpleElementFactoryBase(IElementDefinition definition) { Definition = definition; ElementId = Guid.NewGuid(); InputPortMgrId = Guid.NewGuid(); OutputPortMgrId = Guid.NewGuid(); SettingsMgrId = Guid.NewGuid(); OptionsMgrId = Guid.NewGuid(); ParamMgrId = Guid.NewGuid(); FxId = Guid.NewGuid(); InputPortIds = new Guid[Definition.InputPortTypes.Length]; for (int i = 0; i < InputPortIds.Length; i++) { InputPortIds[i] = Guid.NewGuid(); } OutputPortIds = new Guid[Definition.OutputPortTypes.Length]; for (int i = 0; i < OutputPortIds.Length; i++) { OutputPortIds[i] = Guid.NewGuid(); } }
public static bool TryGetResource(this IElementDefinition element, string key, out object value) { while (element != null) { if (element is IResourcesProvider ve && ve.IsResourcesCreated && ve.Resources.TryGetValue(key, out value)) { return(true); } if (element is Application app && app.SystemResources != null && app.SystemResources.TryGetValue(key, out value)) { return(true); } element = element.Parent; } //Fallback for the XF previewer if (Application.Current != null && ((IResourcesProvider)Application.Current).IsResourcesCreated && Application.Current.Resources.TryGetValue(key, out value)) { return(true); } value = null; return(false); }
/// <summary> /// Creates a full MVP instance of an element with <paramref name="element"/> as the model and /// adds the element view to the <see cref="IWorkSpacePresenter"/>.<see cref="View"/> and adds the /// element presenter to the <see cref="IWorkSpacePresenter"/>.<see cref="ElementPresenters"/> collection. /// </summary> /// <param name="element">The <see cref="IElement"/> instance for which an element view and presenter are created.</param> /// <remarks>The <paramref name="element"/> already exists in <see cref="WorkSpace"/>.<see cref="ElementsMgr"/>.</remarks> internal void LoadElementIntoView(IElement element, IElementDefinition def, PointF location) { // create the instance of the element view IElementView view = CreateElementView(def); view.Id = element.Id; ISetElementOwnerId setterOwnerId = (view as ISetElementOwnerId); setterOwnerId.SetElementOwnerId(element.Id); // create the instance of the element presenter with the element and the view IElementPresenter presenter = CreateElementPresenter(element, view); // add the element to the view. if (presenter != null) { View.Add(view, location); ElementPresenters.Add(element.Id, presenter); } }
internal IElementView CreateElementView(IElementDefinition defType) { IElementView view = null; throw new NotImplementedException(); //IElementViewFactory viewFac = Base.ContainerProvider.CoreContainer.Resolve<IElementViewFactory>(); //if (viewFac != null) // view = viewFac.CreateView(defType); return view; }
internal IElement CreateElementModel(IElementDefinition defType) { IElement el = null; throw new NotImplementedException(); //using (IElementFactoryProvider provider = Base.ContainerProvider.PackageContainer.Resolve<IElementFactoryProvider>(defType.PackageName)) //{ // Guid id = GetNewId(); // IElementFactory fac = provider.Create(defType); // if (fac != null) // el = fac.CreateElement(id, defType); //} return el; }
public Element(IElementDefinition definition, IAttributeBag attributes) { Attributes = attributes; Definition = definition; }
public ExtractKthCoreElement(Guid id, IElementDefinition defType) : base(id, defType) { }
public abstract IElement CreateElement(IElementTicket ticket, IElementDefinition defType);
public NetworkPropertiesElement(Guid id, IElementDefinition defType) : base(id, defType) { }
public AddElementInstanceEventArgs(IElementDefinition instanceDefType, PointF location) { Definition = instanceDefType; Location = location; }
protected override string GetDeclaredModifiers(IElementDefinition element) { return(element.GetDeclaredAccessModifiers()); }
public RandomNetworkGenElement(Guid id, IElementDefinition defType) : base(id, defType) { }
/// <summary> /// Initializes a new instance of the MyRoot class. /// </summary> /// <param name="id">The unique id of this element instance.</param> /// <param name="defType">The IElementDefinition of this elements type.</param> public CompoundElementBase(Guid id, IElementDefinition defType) : this(id) { TypeId = defType.ElementTypeId; TypeName = defType.ElementName; }
public ElementTemplate(IElementDefinition definition) { Definition = definition; }
public abstract ISimpleElement CreateSimpleElement(Guid id, IElementDefinition defType);
public IElement CreateElement(IElementTicket ticket, IElementDefinition defType) { return Create(ticket, defType); }
private static IReadOnlyCollection <IAttributeDefinition> DetermineAttributes(IElementDefinition declaringItem, SyntaxList <AttributeListSyntax> attributeList) { var definitions = new List <IAttributeDefinition>(); foreach (var list in attributeList) { foreach (var attribute in list.Attributes) { var definition = new AttributeDefinition(attribute); definitions.Add(definition); } } return(definitions.AsReadOnly()); }
public IElementFactory Create(IElementDefinition definition) { throw new NotImplementedException(); }
public ImportNetworkElement(Guid id, IElementDefinition defType) : base(id, defType) { }
public static IEnumerable <KeyValuePair <string, object> > GetMergedResources(this IElementDefinition element) { Dictionary <string, object> resources = null; while (element != null) { var ve = element as IResourcesProvider; if (ve != null && ve.IsResourcesCreated) { resources = resources ?? new Dictionary <string, object>(); foreach (KeyValuePair <string, object> res in ve.Resources.MergedResources) { // If a MergedDictionary value is overridden for a DynamicResource, // it comes out later in the enumeration of MergedResources // TryGetValue ensures we pull the up-to-date value for the key if (!resources.ContainsKey(res.Key) && ve.Resources.TryGetValue(res.Key, out object value)) { resources.Add(res.Key, value); } else if (res.Key.StartsWith(Style.StyleClassPrefix, StringComparison.Ordinal)) { var mergedClassStyles = new List <Style>(resources[res.Key] as List <Style>); mergedClassStyles.AddRange(res.Value as List <Style>); resources[res.Key] = mergedClassStyles; } } } var app = element as Application; if (app != null && app.SystemResources != null) { resources = resources ?? new Dictionary <string, object>(8); foreach (KeyValuePair <string, object> res in app.SystemResources) { if (!resources.ContainsKey(res.Key)) { resources.Add(res.Key, res.Value); } else if (res.Key.StartsWith(Style.StyleClassPrefix, StringComparison.Ordinal)) { var mergedClassStyles = new List <Style>(resources[res.Key] as List <Style>); mergedClassStyles.AddRange(res.Value as List <Style>); resources[res.Key] = mergedClassStyles; } } } element = element.Parent; } return(resources); }
protected abstract string GetDeclaredModifiers(IElementDefinition element);
/// <summary> /// Creates a full MVP instance of an element as defined by the <paramref name="definition"/> and adds it to /// the workspace view and model. /// </summary> /// <param name="definition">The instance type to add to the workspace.</param> public void AddElementInstance(IElementDefinition definition, PointF location) { // create the instance of the element IElement el = CreateElementModel(definition); // create the instance of the element view IElementView view = CreateElementView(definition); view.Id = el.Id; ISetElementOwnerId setterOwnerId = (view as ISetElementOwnerId); setterOwnerId.SetElementOwnerId(el.Id); // create the instance of the element presenter with the element and the view IElementPresenter presenter = CreateElementPresenter(el, view); // add the element to the workspace.ElementMgr and the view to the workspace view if (presenter != null) { View.Add(view, location); WorkSpace.ElementsMgr.Add(el); ElementPresenters.Add(el.Id, presenter); UpdateElementLocation(el, location); } }
public IElement CreateElement(Guid id, IElementDefinition defType) { return Create(id, defType); }
public IElementPresenter AddElementInstance(IElementDefinition definition, IElementView view) { // create the instance of the element IElement el = CreateElementModel(definition); // create the instance of the element presenter with the element and the view IElementPresenter presenter = CreateElementPresenter(el, view); // add the element to the workspace.ElementMgr and the view to the workspace view if (presenter != null) { ElementPresenters.Add(el.Id, presenter); WorkSpace.ElementsMgr.Add(el); UpdateElementLocation(el, view.Location); } return presenter; }
public IProcedureView CreateProcedureView(IElementDefinition definition) { throw new NotImplementedException("The method or operation is not implemented."); }
public Element(IElementDefinition definition) : this() { Definition = definition; }