public System.Configuration.ConfigurationElement CreateFullClone() { PropertyElement target = new PropertyElement(); PropertyElement clonedProperty = (PropertyElement)ConfigurationSectionCloner.CloneElement(propertyToClone, target); clonedProperty.Value = propertyToClone.Value; return clonedProperty; }
internal static void SetCallbacks <TValue>( ref TValue value, PropertyPath path, PropertyElement root, Label label) { label.text = TypeConversion.TryConvert(value, out string strValue) ? strValue : value.ToString(); label.binding = new LabelBinding <TValue>(label, root, path); }
internal PropertyElement Restore() { var model = new PropertyElement(this.Name); model.Label = this.Label; model.PropertyType = this.PropertyType; return model; }
public void SetUp() { m_SearchElement = new SearchElement { SearchDelay = 0 }; m_PropertyElement = new PropertyElement(); m_Window.rootVisualElement.Add(m_SearchElement); m_Window.rootVisualElement.Add(m_PropertyElement); }
internal PropertyElement Restore() { var model = new PropertyElement(this.Name); model.Label = this.Label; model.PropertyType = this.PropertyType; return(model); }
public void NullElement_WithUnderlyingDataNotNullAnymore_UpdatesCorrectly() { var container = new Container(); var element = new PropertyElement(); element.SetTarget(container); var someTypes = new List <NullElement <SomeType> >(); element.Query <NullElement <SomeType> >().ToList(someTypes); Assert.That(someTypes.Count, Is.EqualTo(1)); var someOtherTypes = new List <NullElement <SomeOtherType> >(); element.Query <NullElement <SomeOtherType> >().ToList(someOtherTypes); Assert.That(someOtherTypes.Count, Is.EqualTo(1)); container.NonNullFieldWithNestedNullField.NestedField = new SomeOtherType(); foreach (IBinding binding in someTypes) { binding.Update(); } foreach (IBinding binding in someOtherTypes) { binding.Update(); } someTypes.Clear(); someOtherTypes.Clear(); element.Query <NullElement <SomeType> >().ToList(someTypes); Assert.That(someTypes.Count, Is.EqualTo(1)); element.Query <NullElement <SomeOtherType> >().ToList(someOtherTypes); Assert.That(someOtherTypes.Count, Is.EqualTo(0)); container.NullField = new SomeType { NestedField = new SomeOtherType() }; foreach (IBinding binding in someTypes) { binding.Update(); } foreach (IBinding binding in someOtherTypes) { binding.Update(); } someTypes.Clear(); someOtherTypes.Clear(); element.Query <NullElement <SomeType> >().ToList(someTypes); Assert.That(someTypes.Count, Is.EqualTo(0)); element.Query <NullElement <SomeOtherType> >().ToList(someOtherTypes); Assert.That(someOtherTypes.Count, Is.EqualTo(0)); }
public void ParseValidManyWordSingleLineProperty(string input) { PropertyElement p = DocumentParser.PropertySingleLine.Parse(input); Assert.NotEqual(PropertyAction.Invalid, p.Action); Assert.Equal("include files", p.FullName); Assert.Equal("**/*.txt", ((GlobValue)p.ValueElement).GlobStr); Assert.True(parser.InvokeExpression(p.ConditionalExpression)); }
public NullElement(PropertyElement root, IProperty property, PropertyPath path) { m_PotentialTypes = new List <Type> { typeof(Null) }; binding = this; m_Root = root; m_Path = path; name = m_Path.ToString(); TypeConstruction.GetAllConstructableTypes <T>(m_PotentialTypes); if (typeof(T).IsArray) { Resources.Templates.NullStringField.Clone(this); this.Q <Label>().text = GuiFactory.GetDisplayName(property); var button = this.Q <Button>(); button.text = $"Null ({GetTypeName(typeof(T))})"; button.clickable.clicked += ReloadWithArrayType; if (property.IsReadOnly) { button.SetEnabledSmart(false); } return; } if (m_PotentialTypes.Count == 2) { Resources.Templates.NullStringField.Clone(this); this.Q <Label>().text = GuiFactory.GetDisplayName(property); var button = this.Q <Button>(); button.text = $"Null ({GetTypeName(typeof(T))})"; button.clickable.clicked += ReloadWithFirstType; if (property.IsReadOnly) { button.SetEnabledSmart(false); } return; } var typeSelector = new PopupField <Type>( GuiFactory.GetDisplayName(property), m_PotentialTypes, typeof(Null), GetTypeName, GetTypeName); typeSelector.RegisterValueChangedCallback(OnCreateItem); if (property.IsReadOnly) { typeSelector.pickingMode = PickingMode.Ignore; typeSelector.Q(className: UssClasses.Unity.BasePopupFieldInput).SetEnabledSmart(false); } Add(typeSelector); }
public static PropertyElement createElement(PropertiesManager managerT) { manager = managerT; element = new PropertyElement(manager); setDialog("新建属性单元"); dialog.comboBox_Value.SelectedIndex = 0; dialog.setPropsList(); dialog.ShowDialog(); return(element); }
/// <summary> /// Creates a clone of this instance. /// </summary> /// <returns>Clone of the element with interface member state copied.</returns> protected override InterfaceMemberElement DoInterfaceMemberClone() { PropertyElement propertyElement = new PropertyElement(); propertyElement.IsExpressionBodyProperty = IsExpressionBodyProperty; propertyElement._indexParameter = _indexParameter; propertyElement._autoPropertyInitializer = _autoPropertyInitializer; propertyElement.ExpressionBodyText = ExpressionBodyText; return(propertyElement); }
/// <summary> /// Deserializes the specified node in a <see cref="IDbProvider"/>. /// </summary> /// <param name="config">The IConfiguration node.</param> /// <returns>The <see cref="IDbProvider"/></returns> public static Property Deserialize(PropertyElement config) { var p = new Property(); foreach (AddElement item in config.Settings) { p.Add(item.Key, item.Value); } return(p); }
public void EmptySingleLineArrayCanBeParsed() { const string input = "lib refs += [ ]"; PropertyElement propertyElement = DocumentParser.PropertyArray.Parse(input); var array = propertyElement.ValueElement as ArrayValue; Assert.NotNull(array); Assert.Empty(array.Values); }
public void PropertyElement_WithNullFields_CreatesNullElement() { var container = new Container(); var element = new PropertyElement(); element.SetTarget(container); Assert.That(element.Query <NullElement <SomeType> >().ToList().Count, Is.EqualTo(1)); Assert.That(element.Query <NullElement <SomeOtherType> >().ToList().Count, Is.EqualTo(1)); }
internal static PropertyElementXml ConvertToNode(PropertyElement model) { var xml = new PropertyElementXml(); xml.Name = model.Name; xml.PropertyType = model.PropertyType; xml.Label = model.Label; return(xml); }
internal static PropertyElementXml ConvertToNode(PropertyElement model) { var xml = new PropertyElementXml(); xml.Name = model.Name; xml.PropertyType = model.PropertyType; xml.Label = model.Label; return xml; }
private static void AddTypeElements(ODMLDocument doc, IList <EntityType> typeList) { int row = 0, column = 0; for (int i = 0, c = typeList.Count; i < c; i++) { var type = typeList[i]; var typeFullName = type.FullName; //如果这个实体还没有加进来,就创建一个元素并加入到列表中。 if (doc.EntityTypes.All(e => e.FullName != typeFullName)) { var entityTypeEl = new EntityTypeElement(typeFullName); entityTypeEl.FullName = typeFullName; entityTypeEl.Left = column * 300; entityTypeEl.Top = row * 200; entityTypeEl.IsAggtRoot = type.IsAggtRoot; entityTypeEl.HideProperties = true; entityTypeEl.Label = GetDomainName(type); foreach (var vp in type.ValueProperties) { var propertyEl = new PropertyElement(vp.Name); propertyEl.Label = GetDomainName(vp); if (vp.PropertyType == ValuePropertyType.Enum) { propertyEl.PropertyType = vp.EnumType.Name; } else { propertyEl.PropertyType = vp.PropertyType.ToString(); } //可空类型,显示在属性上时,需要添加"?" 号。 if (vp.Nullable) { propertyEl.PropertyType += "?"; } entityTypeEl.Properties.Add(propertyEl); } doc.EntityTypes.Add(entityTypeEl); column++; //一排四个。 if (column == 3) { row++; column = 0; } } } }
public void PropertyElement_FieldWithHideInInspector_AreNotShown() { var withHideInInspectorField = new PropertyElement(); withHideInInspectorField.SetTarget(new Types.FieldWithHideInInspector()); var customInspectorElements = withHideInInspectorField.Query <CustomInspectorElement>().ToList(); Assert.That(customInspectorElements.Count, Is.EqualTo(0)); Assert.That(withHideInInspectorField.childCount, Is.EqualTo(2)); Assert.That(withHideInInspectorField.Query <IntegerField>().First(), Is.Null); }
/// <summary> /// Returns the syntax to get the data type of a field from a DataReader object. /// Currently only used with Velocity generator. /// </summary> /// <param name="field">Field whose reader syntax is needed.</param> /// <returns>Reader syntax to use.</returns> public String GetReaderString(PropertyElement field) { String readerMethod = String.Format(field.Column.SqlType.ReaderMethodFormat, "dataReader", field.Column.Name); if (field.Type.ConvertFromSqlTypeFormat.Length > 0) { readerMethod = String.Format(field.Type.ConvertFromSqlTypeFormat, "data", field.GetMethodFormat(), readerMethod, "dataReader", field.Column.Name); } return(readerMethod); }
public static void UpdateColorElement(this ColorReference colorReference, PropertyElement colorElement, MediaCenterTheme theme) { if (colorReference == null) return; if (colorElement == null) throw new ThemeApplicationException("Color element not found."); Color? color = colorReference.GetColor(theme); if (!color.HasValue) return; colorElement.Value = color.ToString(); }
public void FindProperty_SearchExistingProperty_PositionMustNotBeNullAndSupplyCorrectLinenumber() { PropertyElement propertyElement = new PropertyElement("TestNamespace.AnalyzerTestClass", "get_AutoProperty"); var propertyPosition = SourceCodeAnalyzer.FindSourceElement(elementClassFile, propertyElement); Assert.IsNotNull(propertyPosition, "PropertyPosition must not be null."); Assert.AreEqual(46, propertyPosition.Start, "Start line number does not match."); Assert.AreEqual(46, propertyPosition.End, "End line number does not match."); }
/// <summary> /// 속성(Property) 요소에 대한 역직렬화를 수행합니다. /// </summary> /// <param name="element"> 컨테이너 요소입니다. </param> /// <returns>IoC 컨테이너가 제공하는 속성(Property)에 대한 객체 입니다.</returns> protected override object ResolveProperty(PropertyElement element) { var obj = this.ResolveParam(element.name, element.Item); if (obj is DynamicParametersDelegate) { return(obj); } return(Property.ForKey(element.name).Eq(obj)); }
/// <summary> /// Sauvegarde dans un fichier YAML /// </summary> /// <param name="filename">Nom du fichier à sauvegarder</param> /// <returns>True si réussi et false sinon</returns> public void Save(string filename) { using (System.IO.StreamWriter fd = new System.IO.StreamWriter(filename)) { fd.WriteLine("### YamlLoader C# Class ###"); fd.WriteLine(); Stack <string> elements = new Stack <string>(); List <string> swap = new List <string>(); foreach (PropertyElement element in _e) { swap.AddRange(element.GetElements()); } for (int i = swap.Count - 1; i >= 0; i--) { elements.Push(swap[i]); } while (elements.Count > 0) { string e = elements.Pop(); string tmp = e; string identifier = ""; if (e[e.Length - 1] == ']') { string num = ""; for (int i = e.Length - 2; i >= 0 && e[i] != '['; i--) { num = e[i] + num; } e = e.Remove(e.Length - num.Length - 3); identifier = "- "; } else { for (int i = e.Length - 1; i >= 0 && e[i] != '.' && e[i] != ']'; i--) { identifier = e[i] + identifier; } e = e.Remove(e.Length - identifier.Length); identifier += ": "; } string line = ""; foreach (char c in e) { if (c == '.' || c == '[') { line += " "; } } PropertyElement element = GetElement(tmp); fd.WriteLine(line + identifier + ((element.IsNumber || element.IsString) ? element.Value.ToString() : "")); } } }
/// <summary> /// Returns the syntax to get the data type of a field from a select Scope_Identity(). /// Note it assumes the id value has been put in an int variable named returnId. /// Currently only used with Velocity generator. /// </summary> /// <param name="field">Field whose reader syntax is needed.</param> /// <returns>Reader syntax to use.</returns> public String GetSelectIdentityString(PropertyElement field) { String readerMethod = "returnId"; if (field.Type.ConvertFromSqlTypeFormat.Length > 0) { readerMethod = String.Format(field.Type.ConvertFromSqlTypeFormat, "", "", readerMethod, "", ""); } return(readerMethod); }
/// <summary> /// Returns the syntax to get the data type of a field from a stored procedure /// return value. Note it assumes the command used to execute the stored /// procedure is named "cmd". Currently only used with Velocity generator. /// </summary> /// <param name="field">Field whose reader syntax is needed.</param> /// <returns>Reader syntax to use.</returns> public String GetProcedureReturnString(PropertyElement field) { String readerMethod = "(Int32)(cmd.Parameters[\"RETURN_VALUE\"].Value)"; if (field.Type.ConvertFromSqlTypeFormat.Length > 0) { readerMethod = String.Format(field.Type.ConvertFromSqlTypeFormat, "", "", readerMethod, "", ""); } return(readerMethod); }
protected virtual void DisableBackgroundAnimations(MediaCenterLibraryCache readCache, MediaCenterLibraryCache writeCache) { McmlDocument mcml = MediaCenterUtil.GetMcml(readCache["Microsoft.MediaCenter.Shell.dll"].GetResource("PAGEBACKGROUND.MCML", (object)10)); PropertiesElement themeUiProperties = McmlUtilities.GetThemeUIProperties(mcml, "PageBackground"); PropertyElement themeProperty1 = McmlUtilities.GetThemeProperty(themeUiProperties, "StaticSource"); McmlUtilities.GetThemeProperty(themeUiProperties, "AnimatedSource").Value = themeProperty1.Value; PropertyElement themeProperty2 = McmlUtilities.GetThemeProperty(themeUiProperties, "StaticImage"); McmlUtilities.GetThemeProperty(themeUiProperties, "AnimatedImage").Value = themeProperty2.Value; MediaCenterUtil.UpdateMcml(writeCache["Microsoft.MediaCenter.Shell.dll"].GetResource("PAGEBACKGROUND.MCML", (object)10), mcml); }
public void NullInspector_ForRootType_HasNoChildren() { var noOverrideInspector = new PropertyElement(); noOverrideInspector.SetTarget(new Types.NullInspectorType()); var customInspectorElements = noOverrideInspector.Query <CustomInspectorElement>().ToList(); Assert.That(customInspectorElements.Count, Is.EqualTo(1)); var customInspectorElement = customInspectorElements[0]; Assert.That(customInspectorElement.childCount, Is.EqualTo(0)); }
public void TrailingCommaAfterLastElementSingleLineCanBeParsed() { const string input = "lib refs += [Test/Path/A, Test/Path/B,]"; PropertyElement propertyElement = DocumentParser.PropertyArray.Parse(input); var array = propertyElement.ValueElement as ArrayValue; Assert.NotNull(array); Assert.Equal(2, array.Values.Count()); Assert.Equal("Test/Path/A", array.Values.First().Value); }
public override void OnActivate(string searchContext, VisualElement rootElement) { // TODO: Switch to use uxml/uss for this. var root = new VisualElement(); rootElement.Add(root); var title = new Label(Title); title.style.unityFontStyleAndWeight = FontStyle.Bold; title.style.marginTop = 1; title.style.fontSize = 19; title.style.unityTextAlign = TextAnchor.MiddleLeft; title.style.height = 26; root.Add(title); Resources.Templates.Settings.AddStyles(rootElement); foreach (var kvp in s_Settings) { if (kvp.Value.All(w => w.Internal) && !Unsupported.IsDeveloperMode()) { continue; } var label = new Label { text = kvp.Key }; label.style.unityFontStyleAndWeight = FontStyle.Bold; root.Add(label); foreach (var wrapper in kvp.Value) { if (wrapper.Internal && !Unsupported.IsDeveloperMode()) { continue; } var setting = wrapper.Setting; var element = new PropertyElement(); element.style.marginLeft = -3; element.SetAttributeFilter(AttributeFilter); element.SetTarget(setting); element.OnChanged += (propertyElement, path) => setting.OnSettingChanged(path); root.Add(element); element.RegisterCallback <GeometryChangedEvent>(evt => StylingUtility.AlignInspectorLabelWidth(element)); } } root.AddToClassList("unity-inspector-element"); root.style.paddingLeft = 10; base.OnActivate(searchContext, rootElement); }
public void TypeWithCustomInspector_WhenNoSpecializedInspectorExists_UsesDeclaredTypeInspector() { var element = new PropertyElement(); var instance = new ASD(); instance.Type = new NoInspectorDerivedType(); element.SetTarget(instance); Assert.That(element.Q <Label>(className: BaseType.Label).text, Is.EqualTo(nameof(BaseType))); element.ClearTarget(); instance.Type = new HasInspectorDerivedType(); element.SetTarget(instance); Assert.That(element.Q <Label>(className: BaseType.Label).text, Is.EqualTo(nameof(HasInspectorDerivedType))); }
public void SingleLineArrayCanBeParsed() { const string input = "lib refs += [Test/Path/A, Test/Path/B, Test/Path/C]"; PropertyElement propertyElement = DocumentParser.PropertyArray.Parse(input); var array = propertyElement.ValueElement as ArrayValue; Assert.NotNull(array); Assert.Equal(3, array.Values.Count()); Assert.Equal("Test/Path/A", array.Values.ElementAt(0).Value); Assert.Equal("Test/Path/C", array.Values.ElementAt(2).Value); }
public void TestStringSerializeProperties() { JsonPropertySerializer serializer = new JsonPropertySerializer(new PropertySchemaFactory()); StringSchema schema = new StringSchema { MaxLength = 100, MinLength = 1, DefaultValue = "hello" }; PropertyElement element = serializer.Serialize("hello", schema.Wrap()); Assert.IsNotNull(element); Assert.AreEqual(typeof(StringSchema).FullName, element.Schema.SchemaType); Assert.AreEqual(SerializationTypeHint.String, element.SerializationHint); Assert.AreEqual("hello", element.Value); }
protected override void OnComponentChanged(PropertyElement element, PropertyPath path) { var buffer = element.GetTarget <InspectedBuffer <TList, TElement> >(); var container = Container; if (container.IsReadOnly) { return; } PropertyContainer.SetValue(ref container, Path, buffer.Value); EditorUpdateUtility.EditModeQueuePlayerLoopUpdate(); }
public void Then_DeserializingWithParametersAndValueChildrenThrows() { var elementXml = @" <property name=""connectionString"" value=""northwind2""> <value value=""northwind"" /> </property>"; var reader = new XmlTextReader(new StringReader(elementXml)); var result = reader.MoveToContent(); var element = new PropertyElement(); element.Deserialize(reader); }
/// <summary> /// Gets a the Value of a PropertyElement by its Name /// </summary> /// <returns>a string containing the results of the execution</returns> public string getPropertyValueByName(string name) { PropertyElement property = this.getPropertyByName(name); if (property != null) { return(property.Value); } else { return(null); } }
public void Then_CanDeserializeSingleInjectionValueChild() { var elementXml = @" <property name=""connectionString""> <value value=""northwind"" /> </property>"; var reader = new XmlTextReader(new StringReader(elementXml)); var result = reader.MoveToContent(); var element = new PropertyElement(); element.Deserialize(reader); Assert.AreSame(typeof(ValueElement), element.Value.GetType()); Assert.AreEqual("northwind", ((ValueElement)element.Value).Value); }
public void Store(ISession session, string name,object value,IValueSchema<object> schema) { PropertyElement element=new PropertyElement(); Action<PropertyElement, object> action; if(_setMap.TryGetValue(schema.Type, out action)) { action.Invoke(element,value); } else { if(schema.Serializer!=null) { } else { } } }
/// /// This method is only used within toa client to create InventoryElement object /// internal InventoryElement GetInventoryElement() { var inventoryElement = new InventoryElement(); PropertyElement[] properties = null; int size = 1; if (null != _serial_number && _serial_number.Trim().Length > 0) { size = 2; } properties = new PropertyElement[size]; properties[0] = new PropertyElement(); properties[0].label = ActivityProperty.InvTypeLabel; properties[0].value = Type; if (size == 2) { properties[1] = new PropertyElement(); properties[1].label = ActivityProperty.Invsn; properties[1].value = SerialNumber; } inventoryElement.properties = properties; return inventoryElement; }
public void SetProperty(PropertyElement property) { //Properties[property.PropertyName] = property; Add(property); }
public string Filename(PropertyElement property) { return Filename(property.Member); }
/// <summary> /// Creates a clone of this instance. /// </summary> /// <returns>Clone of the element with interface member state copied.</returns> protected override InterfaceMemberElement DoInterfaceMemberClone() { PropertyElement propertyElement = new PropertyElement(); propertyElement.IsExpressionBodyProperty = IsExpressionBodyProperty; propertyElement._indexParameter = _indexParameter; propertyElement._autoPropertyInitializer = _autoPropertyInitializer; propertyElement.ExpressionBodyText = ExpressionBodyText; return propertyElement; }
/// <summary> /// Initializes a new instance of the <see cref="MongoPropertyElement"/> class. /// </summary> /// <param name="name">The name.</param> public MongoPropertyElement(string name) { _element = new PropertyElement{Name = name}; }
/// /// This method is only used within toa client to create AppointmentElement object /// internal AppointmentElement GetActivityElement() { var activity = new AppointmentElement(); //key fields activity.customer_number = _customerNumber; activity.appt_number = _apptNumber; //mandatory fields activity.worktype = _workType; //Other fields if (null != _name) activity.name = _name; activity.action_if_completed = ToaStringsUtil.GetString(_actionIfCompleted); if (null != _address) activity.address = _address; if (null != _cell) activity.cell = _cell; if (null != _city) activity.city = _city; if (null != _coordinateX) activity.coordx = _coordinateX; if (null != _coordinateY) activity.coordy = _coordinateY; if (null != _email) activity.email = _email; if (null != _duration) activity.duration = _duration; if (null != _language) activity.language = _language; if (null != _points) activity.points = _points.ToString(); if (null != _phone) activity.phone = _phone; if (null != _reminderTime) activity.reminder_time = _reminderTime.ToString(); if (null != _serviceWindowStart) activity.service_window_start = _serviceWindowStart; if (null != _serviceWindowEnd) activity.service_window_end = _serviceWindowEnd; //if(null != _slaWindowStart) // activity.sla_window_start = _slaWindowStart.ToString("yyyy'-'MM'-'dd HH':'mm"); if (null != _slaWindowEnd) { activity.sla_window_end = ((DateTime)_slaWindowEnd).ToString("yyyy'-'MM'-'dd HH':'mm"); //Below 2 null checks and fix is required as ETA is not behaving correctly. //If it has sla_window_end parameter then it should override the date and timeslot as mandatory fields in Inbound Request. //But it is not doing so, hence we are explictly required to send TimeSlot and Date. //If we do not provide them and if they are empty then activity creation fails in ETA. if (null == TimeSlot) { TimeSlot = ActivityProperty.ALL_DAY_TIME_SLOT_LABEL; } if (null == AssignedDate) { AssignedDate = ""; } } if (null != _state) activity.state = _state; if (null != _teamId) activity.team_id = _teamId; if (null != _timeSlot) activity.time_slot = _timeSlot; if (null != _timeZone) activity.time_zone = _timeZone; //activity.worktype = _workType; //Below code is for using worktype label. We plan to use only WorkType and not the label. //if (null != _workTypeLabel) // activity.worktype_label = _workTypeLabel; if (null != _zip) activity.zip = _zip; // Activity Properties if (null != Properties) { var noOfInventories = Properties.Count; var propertyElements = new PropertyElement[noOfInventories]; foreach (var property in Properties) { var propertyElement = new PropertyElement(); propertyElement.label = property.Key; propertyElement.value = property.Value; propertyElements[--noOfInventories] = propertyElement; } activity.properties = propertyElements; } // Activity Inventories if (null != _inventories) { var noOfInventories = _inventories.Count; var inventoryElements = new InventoryElement[noOfInventories]; foreach (var inventoryModel in _inventories) { var inventoryElement = inventoryModel.GetInventoryElement(); inventoryElements[--noOfInventories] = inventoryElement; } activity.inventories = inventoryElements; } // Preference Provideres if (null != _providerPreferences) { var noOfProviders = _providerPreferences.Count; var providers = new ProviderPreferenceElement[noOfProviders]; foreach (var providerModel in _providerPreferences) { var ProviderPreferenceElement = providerModel.GetProviderPreferenceElement(); providers[--noOfProviders] = ProviderPreferenceElement; } activity.provider_preferences = providers; } // Required Inventories if (null != _requiredInventories && _requiredInventories.Count > 0) { var noOfRequiedInventories = _requiredInventories.Count; var requiredInventoryElements = new RequiredInventoryElement[noOfRequiedInventories]; foreach (var requiredInventoryModel in _requiredInventories) { var requiredInventory = requiredInventoryModel.GetRequiredInventoryElement(); requiredInventoryElements[--noOfRequiedInventories] = requiredInventory; } activity.required_inventories = requiredInventoryElements; } if (null != UserData && UserData.Trim().Length > 0) { activity.userdata = UserData; } return activity; }
private void LoadPropList(object ctrl) { proplist = new SortedDictionary<string, List<PropertyElement>>(new CategoryComparer()); foreach (var prop in ctrl.GetType().GetProperties()) { foreach (var at in prop.GetCustomAttributes(typeof(ZomBDesignableAttribute), true)) { PropertyElement pe = new PropertyElement(ctrl, prop); if (!proplist.ContainsKey(pe.Category)) proplist.Add(pe.Category, new List<PropertyElement>()); proplist[pe.Category].Add(pe); } } foreach (var at in ctrl.GetType().GetCustomAttributes(typeof(ZomBDesignablePropertyAttribute), true)) { PropertyElement pe = new PropertyElement(ctrl, (at as ZomBDesignablePropertyAttribute).PropertyName); if (!proplist.ContainsKey(pe.Category)) proplist.Add(pe.Category, new List<PropertyElement>()); proplist[pe.Category].Add(pe); } }
public static PropertyElement Create(string name, string value) { var prop = new PropertyElement(); prop.PropertyName = name; prop.PropertyValue = value; return prop; }
/// <summary> /// Creates a clone of this instance. /// </summary> /// <returns>Clone of the element with interface member state copied.</returns> protected override InterfaceMemberElement DoInterfaceMemberClone() { PropertyElement propertyElement = new PropertyElement(); propertyElement._indexParameter = _indexParameter; return propertyElement; }
/// <summary> /// Serializes the property. /// </summary> /// <param name="name">The name.</param> /// <param name="value">The value.</param> /// <param name="schema">The schema.</param> /// <returns></returns> public PropertyElement Serialize(string name,object value,IValueSchema<object> schema) { PropertyElement element=new PropertyElement(); JsonSchemaSerializationVisitor visitor=new JsonSchemaSerializationVisitor(); schema.Accept(visitor); Action<PropertyElement, object> action; if(_setMap.TryGetValue(visitor.ValueType,out action)) { action.Invoke(element,value); } else { StringWriter writer=new StringWriter(); _serializer.Serialize(writer,value); element.ValString = writer.ToString(); } element.SchemaType = visitor.SchemaType.FullName; element.TypeOfValue = visitor.ValueType.FullName; element.SchemaBody = visitor.JsonValue; return element; }
public void Then_DeserializingMultipleInjectionValueChildrenThrows() { var elementXml = @" <property name=""connectionString""> <value value=""northwind"" /> <value value=""northwind"" /> </property>"; var reader = new XmlTextReader(new StringReader(elementXml)); var result = reader.MoveToContent(); var element = new PropertyElement(); AssertExtensions.AssertException<ConfigurationErrorsException>(() => { element.Deserialize(reader); }); }
/// <summary> /// Deserializes the specified element. /// </summary> /// <param name="element">The element.</param> /// <param name="schema">The schema.</param> /// <returns></returns> public object Deserialize(PropertyElement element,out IValueSchema<object> schema) { object value; Type schemaType = ResolveType(element.SchemaType); Type valueType = ResolveType(element.TypeOfValue); schema = !string.IsNullOrEmpty(element.SchemaBody) ? JsonSchemaDeserializer.Deserialize(schemaType, element.SchemaBody) : _schemaFactory.Create(valueType).Wrap(); Func<PropertyElement, object> func; if (_getMap.TryGetValue(element.SerializationValueType, out func)) { value = func.Invoke(element); } else { StringReader reader=new StringReader(element.ValString); value = _serializer.Deserialize(reader, valueType); } return value; }
private void ModifySelectedFormula(PropertyElement property) { //this.CurrentProperty = property; Messenger.Default.Send<ToModifyCellFormulaEvent>(new ToModifyCellFormulaEvent() { Element = property }); }
/// <summary> /// Initializes a new instance of the <see cref="MongoPropertyElement"/> class. /// </summary> /// <param name="element">The element.</param> public MongoPropertyElement(PropertyElement element) { _element = element; }
public PropertyElementCloneable(PropertyElement propertyToClone) { this.propertyToClone = propertyToClone; }