public void OnComponentChanging(object component, System.ComponentModel.MemberDescriptor member) { if (ComponentChanging != null) { ComponentChanging(this, new ComponentChangingEventArgs(component, member)); } }
public ComponentChangedEventArgs(object component, MemberDescriptor member, object oldValue, object newValue) { this.component = component; this.member = member; this.oldValue = oldValue; this.newValue = newValue; }
public void OnComponentChanged(object component, System.ComponentModel.MemberDescriptor member, object oldValue, object newValue) { if (ComponentChanged != null) { ComponentChanged(this, new ComponentChangedEventArgs(component, member, oldValue, newValue)); } }
/// <summary> /// Gets the design item property for the specified member descriptor. /// </summary> public static DesignItemProperty GetProperty(this DesignItemPropertyCollection properties, MemberDescriptor md) { DesignItemProperty prop = null; var pd = md as PropertyDescriptor; if (pd != null) { var dpd = DependencyPropertyDescriptor.FromProperty(pd); if (dpd != null) { if (dpd.IsAttached) { prop = properties.GetAttachedProperty(dpd.DependencyProperty); } else { prop = properties.GetProperty(dpd.DependencyProperty); } } } if (prop == null) { prop = properties[md.Name]; } return prop; }
public override void Serialize (IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements) { if (statements == null) throw new ArgumentNullException ("statements"); if (manager == null) throw new ArgumentNullException ("manager"); if (value == null) throw new ArgumentNullException ("value"); if (descriptor == null) throw new ArgumentNullException ("descriptor"); IEventBindingService service = manager.GetService (typeof (IEventBindingService)) as IEventBindingService; if (service != null) { // In the propertygrid the events are represented by PropertyDescriptors and the value is a string // which contains the method name to bind to. The propertydescriptors are managed and created by the // IEventBindingService // EventDescriptor ev = (EventDescriptor) descriptor; string methodName = (string) service.GetEventProperty (ev).GetValue (value); CodeDelegateCreateExpression listener = new CodeDelegateCreateExpression (new CodeTypeReference (ev.EventType), _thisReference, methodName); CodeExpression targetObject = base.SerializeToExpression (manager, value); CodeEventReferenceExpression eventRef = new CodeEventReferenceExpression (targetObject, ev.Name); statements.Add (new CodeAttachEventStatement (eventRef, listener)); } }
/// <summary> /// <para>Initializes a new instance of the <see cref='System.ComponentModel.Design.ComponentChangedEventArgs'/> class.</para> /// </summary> public ComponentChangedEventArgs(object component, MemberDescriptor member, object oldValue, object newValue) { Component = component; Member = member; OldValue = oldValue; NewValue = newValue; }
public ActivityChangedEventArgs(System.Workflow.ComponentModel.Activity activity, MemberDescriptor member, object oldValue, object newValue) { this.activity = activity; this.member = member; this.oldValue = oldValue; this.newValue = newValue; }
protected MemberDescriptor(MemberDescriptor oldMemberDescriptor, Attribute[] newAttributes) { this.lockCookie = new object(); this.name = oldMemberDescriptor.Name; this.displayName = oldMemberDescriptor.DisplayName; this.nameHash = this.name.GetHashCode(); ArrayList list = new ArrayList(); if (oldMemberDescriptor.Attributes.Count != 0) { foreach (object obj2 in oldMemberDescriptor.Attributes) { list.Add(obj2); } } if (newAttributes != null) { Attribute[] attributeArray = newAttributes; for (int i = 0; i < attributeArray.Length; i++) { object obj3 = attributeArray[i]; list.Add(obj3); } } this.attributes = new Attribute[list.Count]; list.CopyTo(this.attributes, 0); this.attributesFiltered = false; this.originalAttributes = this.attributes; }
public override void Serialize (IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements) { if (statements == null) throw new ArgumentNullException ("statements"); if (manager == null) throw new ArgumentNullException ("manager"); if (value == null) throw new ArgumentNullException ("value"); if (descriptor == null) throw new ArgumentNullException ("descriptor"); IEventBindingService service = manager.GetService (typeof (IEventBindingService)) as IEventBindingService; if (service != null) { EventDescriptor eventDescriptor = (EventDescriptor) descriptor; string methodName = (string) service.GetEventProperty (eventDescriptor).GetValue (value); if (methodName != null) { CodeDelegateCreateExpression listener = new CodeDelegateCreateExpression (new CodeTypeReference (eventDescriptor.EventType), _thisReference, methodName); CodeExpression targetObject = base.SerializeToExpression (manager, value); CodeEventReferenceExpression eventRef = new CodeEventReferenceExpression (targetObject, eventDescriptor.Name); statements.Add (new CodeAttachEventStatement (eventRef, listener)); } } }
public override bool ShouldSerialize (IDesignerSerializationManager manager, object value, MemberDescriptor descriptor) { IEventBindingService service = manager.GetService (typeof (IEventBindingService)) as IEventBindingService; if (service != null) // serialize only if there is an event to serialize return service.GetEventProperty ((EventDescriptor)descriptor).GetValue (value) != null; return false; }
public MemberRelationship this[object sourceOwner, MemberDescriptor sourceMember] { get { if (sourceOwner == null) { throw new ArgumentNullException("sourceOwner"); } if (sourceMember == null) { throw new ArgumentNullException("sourceMember"); } return this.GetRelationship(new MemberRelationship(sourceOwner, sourceMember)); } set { if (sourceOwner == null) { throw new ArgumentNullException("sourceOwner"); } if (sourceMember == null) { throw new ArgumentNullException("sourceMember"); } this.SetRelationship(new MemberRelationship(sourceOwner, sourceMember), value); } }
public object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext, MemberDescriptor memberDescriptor) { var RoomReservationViewModel = (RoomReservationViewModel)bindingContext.Model; var form = controllerContext.HttpContext.Request.Form; var currencyid = form["RoomReservation_Payment.CurrencyId"]; if (currencyid != "0") RoomReservationViewModel.RoomReservation_Payment.CurrencyId = int.Parse(currencyid.Split('|')[0]); RoomReservationViewModel.RoomReservation_Payment.PaymentById = int.Parse(form["RoomReservation_Payment.PaymentById"]); RoomReservationViewModel.RoomReservation_Payment.PaymentModeId = int.Parse(form["RoomReservation_Payment.PaymentModeId"]); RoomReservationViewModel.RoomReservation_Payment.BillTimeId = int.Parse(form["RoomReservation_Payment.BillTimeId"]); if (form["RoomReservation_Payment.Currency_Exchange_Rate"]!="") RoomReservationViewModel.RoomReservation_Payment.Currency_Exchange_Rate = decimal.Parse(form["RoomReservation_Payment.Currency_Exchange_Rate"]); RoomReservationViewModel.RoomReservation_Payment.App_Code = form["RoomReservation_Payment.App_Code"] ; RoomReservationViewModel.RoomReservation_Payment.CC_ = form["RoomReservation_Payment.CC_"]; if (form["RoomReservation_Payment.ExpiryMonth"] != "") RoomReservationViewModel.RoomReservation_Payment.ExpiryMonth = int.Parse(form["RoomReservation_Payment.ExpiryMonth"]); if (form["RoomReservation_Payment.ExpiryYear"] != "") RoomReservationViewModel.RoomReservation_Payment.ExpiryYear = int.Parse (form["RoomReservation_Payment.ExpiryYear"]); RoomReservationViewModel.RoomReservation_Payment.Total = decimal.Parse(form["Reservation_Total"]); if (form["RoomReservation_Payment.GST_Charges"] != "") RoomReservationViewModel.RoomReservation_Payment.GST_Charges = decimal.Parse(form["RoomReservation_Payment.GST_Charges"]); if (form["RoomReservation_Payment.GST_Rate"] != "") RoomReservationViewModel.RoomReservation_Payment.GST_Rate = decimal.Parse(form["RoomReservation_Payment.GST_Rate"]); return RoomReservationViewModel.RoomReservation_Payment; }
public bool ShouldSerialize(MemberDescriptor member) { if (this._member != null) { return (this._member == member); } return true; }
protected MemberDescriptor (MemberDescriptor descr, Attribute[] newAttributes) { this.name = descr.Name; this.displayName = descr.DisplayName; this.attributes = MergeAttributes(descr.AttributeArray, newAttributes); }
public override void SerializeMember(SerializationStore store, object owningObject, MemberDescriptor member) { if (store == null) throw new ArgumentNullException("store"); if (owningObject == null) throw new ArgumentNullException("owningObject"); if (member == null) throw new ArgumentNullException("member"); WorkflowMarkupSerializationStore xomlStore = store as WorkflowMarkupSerializationStore; if (xomlStore == null) throw new InvalidOperationException(SR.GetString(SR.Error_UnknownSerializationStore)); xomlStore.AddMember(owningObject, member); }
protected MemberDescriptor(MemberDescriptor descr) { this.lockCookie = new object(); this.name = descr.Name; this.displayName = this.name; this.nameHash = this.name.GetHashCode(); this.attributes = new Attribute[descr.Attributes.Count]; descr.Attributes.CopyTo(this.attributes, 0); this.attributesFiltered = true; this.originalAttributes = this.attributes; }
// <summary> // Adds the contents of the provided attributes to this builder. // Conflicts are resolved with a last-in-wins strategy. // </summary> // <param name="descriptor">An event or property descriptor to add attributes to.</param> // <param name="attributes"> // The new attributes to add. // </param> // <exception cref="ArgumentNullException">if descriptor or attributes is null</exception> public void AddCustomAttributes(MemberDescriptor descriptor, params Attribute[] attributes) { if (descriptor == null) { throw FxTrace.Exception.ArgumentNull("descriptor"); } if (attributes == null) { throw FxTrace.Exception.ArgumentNull("attributes"); } _table.AddCustomAttributes(_callbackType, descriptor, attributes); }
public override void Serialize(IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements) { manager.Context.Push(this._model); try { this._serializer.Serialize(manager, value, descriptor, statements); } finally { manager.Context.Pop(); } }
public static void SetAttribute(object o, string property, System.Attribute newattrib, bool on) { System.ComponentModel.MemberDescriptor memb = null; if (o is System.Type) { memb = (System.ComponentModel.MemberDescriptor)System.ComponentModel.TypeDescriptor.GetProperties((Type)o)[property]; } else { memb = (System.ComponentModel.MemberDescriptor)System.ComponentModel.TypeDescriptor.GetProperties(o)[property]; } InternalSetAttribute(memb, property, newattrib, on); }
/// <summary> /// <para> /// Initializes a new instance of the <see cref='System.ComponentModel.MemberDescriptor'/> class with the specified <see cref='System.ComponentModel.MemberDescriptor'/>. /// </para> /// </summary> protected MemberDescriptor(MemberDescriptor descr) { _name = descr.Name; _displayName = _name; _nameHash = _name.GetHashCode(); _attributes = new Attribute[descr.Attributes.Count]; descr.Attributes.CopyTo(_attributes, 0); _attributesFiltered = true; _originalAttributes = _attributes; }
public MemberRelationship(object owner, MemberDescriptor member) { if (owner == null) { throw new ArgumentNullException("owner"); } if (member == null) { throw new ArgumentNullException("member"); } this._owner = owner; this._member = member; }
public override void Serialize(IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements) { EventDescriptor e = descriptor as EventDescriptor; if (manager == null) { throw new ArgumentNullException("manager"); } if (value == null) { throw new ArgumentNullException("value"); } if (e == null) { throw new ArgumentNullException("descriptor"); } if (statements == null) { throw new ArgumentNullException("statements"); } try { IEventBindingService service = (IEventBindingService) manager.GetService(typeof(IEventBindingService)); if (service != null) { string methodName = (string) service.GetEventProperty(e).GetValue(value); if (methodName != null) { CodeExpression targetObject = base.SerializeToExpression(manager, value); if (targetObject != null) { CodeTypeReference delegateType = new CodeTypeReference(e.EventType); CodeDelegateCreateExpression listener = new CodeDelegateCreateExpression(delegateType, _thisRef, methodName); CodeEventReferenceExpression eventRef = new CodeEventReferenceExpression(targetObject, e.Name); CodeAttachEventStatement statement = new CodeAttachEventStatement(eventRef, listener); statement.UserData[typeof(Delegate)] = e.EventType; statements.Add(statement); } } } } catch (Exception innerException) { if (innerException is TargetInvocationException) { innerException = innerException.InnerException; } manager.ReportError(System.Design.SR.GetString("SerializerPropertyGenFailed", new object[] { e.Name, innerException.Message })); } }
public object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext, MemberDescriptor memberDescriptor) { RoomReservation_SponsorViewModel res = new RoomReservation_SponsorViewModel (); var form = controllerContext.HttpContext.Request.Form; res.TypeId = int.Parse ( form["RoomReservation_SponsorViewModel.TypeId"] ); res.Name = form["RoomReservation_SponsorViewModel.Name"] ; res.CreditLimit = form["RoomReservation_SponsorViewModel.CreditLimit"]; res.Id = form["RoomReservation_SponsorViewModel.Id"]; return res; }
public object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext, MemberDescriptor memberDescriptor) { List<RoomReservation_StatusViewModel> res = new List<RoomReservation_StatusViewModel>(); var form = controllerContext.HttpContext.Request.Form; int i = 0; while (!string.IsNullOrEmpty(form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.ReservationStatusTypeId"])) { var model = new RoomReservation_StatusViewModel(); var ReservationStatusType = new ReservationStatusType(); var RoomReservation_Status = new RoomReservation_Status(); if (form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.Id"] != "") RoomReservation_Status.Id = int.Parse(form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.Id"]); if (form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.RoomReservation_Id"] !="") RoomReservation_Status.RoomReservation_Id = int.Parse(form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.RoomReservation_Id"]); if (form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.Reservation_StatusDate"] != "") RoomReservation_Status.Reservation_StatusDate = DateTime.Parse(form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.Reservation_StatusDate"]); RoomReservation_Status.ReservationStatusTypeId = int.Parse(form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.ReservationStatusTypeId"]); ReservationStatusType.Name = form["RoomReservation_StatusViewModel[" + i + "].ReservationStatusType.Name"]; if (!string.IsNullOrEmpty(form["RoomReservation_StatusViewModel[" + i + "].ReservationStatusType.RoomStatusTypeId"])) ReservationStatusType.RoomStatusTypeId =int.Parse ( form["RoomReservation_StatusViewModel[" + i + "].ReservationStatusType.RoomStatusTypeId"]); if (!string.IsNullOrEmpty(form["RoomReservation_StatusViewModel[" + i + "].Reason_TypeId"])) RoomReservation_Status.Reason_TypeId = int.Parse(form["RoomReservation_StatusViewModel[" + i + "].Reason_TypeId"]); RoomReservation_Status.Notes = form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.Notes"]; ReservationStatusType.Id = int.Parse(form["RoomReservation_StatusViewModel[" + i + "].RoomReservation_Status.ReservationStatusTypeId"]); model.ReservationStatusType = ReservationStatusType; model.RoomReservation_Status = RoomReservation_Status; res.Add(model); i++; } return res; }
public override bool ShouldSerialize(IDesignerSerializationManager manager, object value, MemberDescriptor descriptor) { PropertyDescriptor member = descriptor as PropertyDescriptor; if (manager == null) { throw new ArgumentNullException("manager"); } if (value == null) { throw new ArgumentNullException("value"); } if (member == null) { throw new ArgumentNullException("descriptor"); } bool flag = member.ShouldSerializeValue(value); if (!flag) { SerializeAbsoluteContext context = (SerializeAbsoluteContext) manager.Context[typeof(SerializeAbsoluteContext)]; if ((context != null) && context.ShouldSerialize(member)) { if (!member.Attributes.Contains(DesignerSerializationVisibilityAttribute.Content)) { flag = false; } else { flag = true; } } } if (flag && !member.Attributes.Contains(DesignOnlyAttribute.Yes)) { return true; } MemberRelationshipService service = manager.GetService(typeof(MemberRelationshipService)) as MemberRelationshipService; if (service != null) { MemberRelationship relationship = service[value, descriptor]; if (relationship != MemberRelationship.Empty) { return true; } } return false; }
public override void Serialize (IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements) { if (manager == null) throw new ArgumentNullException ("manager"); if (value == null) throw new ArgumentNullException ("value"); if (descriptor == null) throw new ArgumentNullException ("descriptor"); if (statements == null) throw new ArgumentNullException ("statements"); PropertyDescriptor property = (PropertyDescriptor) descriptor; if (property.Attributes.Contains (DesignerSerializationVisibilityAttribute.Visible)) SerializeNormalProperty (manager, value, property, statements); else if (property.Attributes.Contains (DesignerSerializationVisibilityAttribute.Content)) SerializeContentProperty (manager, value, property, statements); }
public override void Serialize(IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements) { PropertyDescriptor property = descriptor as PropertyDescriptor; if (manager == null) { throw new ArgumentNullException("manager"); } if (value == null) { throw new ArgumentNullException("value"); } if (property == null) { throw new ArgumentNullException("descriptor"); } if (statements == null) { throw new ArgumentNullException("statements"); } try { ExtenderProvidedPropertyAttribute attribute = (ExtenderProvidedPropertyAttribute) property.Attributes[typeof(ExtenderProvidedPropertyAttribute)]; bool isExtender = (attribute != null) && (attribute.Provider != null); if (property.Attributes.Contains(DesignerSerializationVisibilityAttribute.Content)) { this.SerializeContentProperty(manager, value, property, isExtender, statements); } else if (isExtender) { this.SerializeExtenderProperty(manager, value, property, statements); } else { this.SerializeNormalProperty(manager, value, property, statements); } } catch (Exception innerException) { if (innerException is TargetInvocationException) { innerException = innerException.InnerException; } manager.ReportError(System.Design.SR.GetString("SerializerPropertyGenFailed", new object[] { property.Name, innerException.Message })); } }
internal void AddMember(object value, MemberDescriptor member) { if (value == null) { throw new ArgumentNullException("value"); } if (member == null) { throw new ArgumentNullException("member"); } if (this.serializedXmlString != null) { throw new InvalidOperationException(DR.GetString("InvalidOperationStoreAlreadyClosed", new object[0])); } IReferenceService service = this.serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService; this.parentObjectNameList.Add(service.GetName(value)); this.memberList.Add(member); }
/// <summary> /// Gets a value indicating whether the specified member is excluded by the specified attribute filter. /// </summary> /// <param name="descriptor">The descriptor to evaluate.</param> /// <param name="attributes">The attribute filter.</param> /// <returns><see langword="true"/> if the member is excluded; otherwise, <see langword="false"/>.</returns> private static Boolean ExcludedByFilter(MemberDescriptor descriptor, Attribute[] attributes) { if (attributes == null) return false; for (int i = 0; i < attributes.Length; i++) { var attributeInFilter = attributes[i]; var attributeOnMember = descriptor.Attributes[attributeInFilter.GetType()]; if (attributeOnMember == null && !attributeInFilter.IsDefaultAttribute()) return true; if (!attributeInFilter.Match(attributeOnMember)) return true; } return false; }
protected override void ChildControlDataBinding(Control childControl, object dataItem, MemberDescriptor dataFieldPropertyDescriptor) { var placeHolder = (PlaceHolder) childControl; var propertyValue = GetPropertyValue(dataItem, dataFieldPropertyDescriptor.Name); if (!string.IsNullOrEmpty(propertyValue)) { var web = Web ?? SPContext.Current.Web; var split = propertyValue.Split(new[] {";#"}, StringSplitOptions.None); var link = new HyperLink { Text = split[1], NavigateUrl = string.Format("{0}/_layouts/userdisp.aspx?ID={1}&Source={2}", web.Url, split[0], ReturnUrl) }; link.Attributes.Add("onclick", string.Format("var options = SP.UI.$create_DialogOptions(); options.url = '{0}';SP.UI.ModalDialog.showModalDialog(options);return false;", link.NavigateUrl)); placeHolder.Controls.Add(link); } }
public object BindModel(object bindParam, ControllerContext controllerContext, ModelBindingContext bindingContext, MemberDescriptor memberDescriptor) { var timeString = controllerContext.HttpContext.Request.Params[memberDescriptor.Name]; var def = default(DateTime); if (timeString.IsNullOrWhiteSpace()) { return DateTime.MinValue; } var formats = bindParam as string[]; DateTime dateTimeParsed; if (formats != null) { foreach (var format in formats) { dateTimeParsed = StringParser.ToDateTime(timeString, def, format); if (dateTimeParsed != def) { return dateTimeParsed; } } } dateTimeParsed = StringParser.ToDateTime(timeString, def); return dateTimeParsed == def ? DateTime.MinValue : dateTimeParsed; }
public override bool ShouldSerialize(IDesignerSerializationManager manager, object value, MemberDescriptor descriptor) { bool flag = this._serializer.ShouldSerialize(manager, value, descriptor); if (!flag && !descriptor.Attributes.Contains(DesignOnlyAttribute.Yes)) { switch (this._model) { case CodeDomLocalizationModel.PropertyAssignment: { InheritanceAttribute notInherited = (InheritanceAttribute) manager.Context[typeof(InheritanceAttribute)]; if (notInherited == null) { notInherited = (InheritanceAttribute) TypeDescriptor.GetAttributes(value)[typeof(InheritanceAttribute)]; if (notInherited == null) { notInherited = InheritanceAttribute.NotInherited; } } if (notInherited.InheritanceLevel != InheritanceLevel.InheritedReadOnly) { flag = true; } return flag; } case CodeDomLocalizationModel.PropertyReflection: if (!flag) { if (this.localizationLanguage == null) { manager.SerializationComplete += new EventHandler(this.OnSerializationComplete); } if (this.GetLocalizationLanguage(manager) != CultureInfo.InvariantCulture) { flag = true; } } return flag; } } return flag; }
public object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext, MemberDescriptor memberDescriptor) { List<RoomReservation_FacilitiesViewModel> res = new List<RoomReservation_FacilitiesViewModel>(); var form = controllerContext.HttpContext.Request.Form; int i = 0; while (!string.IsNullOrEmpty(form["RoomReservation_FacilitiesViewModel[" + i + "].IsSelected"])) { var model = new RoomReservation_FacilitiesViewModel(); var facility = new Facility(); var RoomReservation_Facilities = new RoomReservation_Facilities(); RoomReservation_Facilities.RoomReservation_Id = int.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].RoomReservation_Facilities.RoomReservation_Id"]); RoomReservation_Facilities.FacilitiesId = int.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].RoomReservation_Facilities.FacilitiesId"]); facility.IsFree = bool.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].Facility.IsFree"]); facility.IsGST = bool.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].Facility.IsGST"]); facility.Name = form["RoomReservation_FacilitiesViewModel[" + i + "].Facility.Name"]; RoomReservation_Facilities.Rate = decimal.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].RoomReservation_Facilities.Rate"]); RoomReservation_Facilities.Total = decimal.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].RoomReservation_Facilities.Total"]); RoomReservation_Facilities.Notes = form["RoomReservation_FacilitiesViewModel[" + i + "].RoomReservation_Facilities.Notes"]; RoomReservation_Facilities.GST_Rate = decimal.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].RoomReservation_Facilities.GST_Rate"]); RoomReservation_Facilities.GST_Charges = decimal.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].RoomReservation_Facilities.GST_Charges"]); model.Facility = facility; model.RoomReservation_Facilities = RoomReservation_Facilities; model.IsSelected = bool.Parse(form["RoomReservation_FacilitiesViewModel[" + i + "].IsSelected"].Split(',')[0]) ; res.Add(model); i++; } return res; }
private static void InternalSetAttribute(System.ComponentModel.MemberDescriptor memb, string property, System.Attribute newattrib, bool on) { System.Attribute oldattrib = memb.Attributes[newattrib.GetType()]; System.Reflection.BindingFlags getflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; System.Reflection.BindingFlags setflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.SetField | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; System.Attribute[] oldattribs = (System.Attribute[]) typeof(System.ComponentModel.MemberDescriptor).InvokeMember("attributes", getflags, null, memb, null); if (oldattrib != null) { if (on) { for (int i = 0; i < oldattribs.Length; i++) { if (oldattribs[i].GetType().FullName == newattrib.GetType().FullName) { oldattribs[i] = newattrib; break; } } typeof(System.ComponentModel.MemberDescriptor).InvokeMember("attributeCollection", setflags, null, memb, new object[] { new System.ComponentModel.AttributeCollection(oldattribs) }); typeof(System.ComponentModel.MemberDescriptor).InvokeMember("originalAttributes", setflags, null, memb, new object[] { oldattribs }); if (newattrib is System.ComponentModel.EditorAttribute) { object[] editors = new object[1]; System.ComponentModel.EditorAttribute editor = (System.ComponentModel.EditorAttribute)newattrib; editors[0] = Type.GetType(editor.EditorTypeName).GetConstructors()[0].Invoke(new object[] { }); typeof(System.ComponentModel.PropertyDescriptor).InvokeMember("editors", setflags, null, memb, new object[] { editors }); typeof(System.ComponentModel.PropertyDescriptor).InvokeMember("editorCount", setflags, null, memb, new object[] { 1 }); Type[] editorTypes = new Type[1] { Type.GetType(editor.EditorBaseTypeName) }; typeof(System.ComponentModel.PropertyDescriptor).InvokeMember("editorTypes", setflags, null, memb, new object[] { editorTypes }); } } else { System.Attribute[] newattribs = new System.Attribute[oldattribs.Length - 1]; int i = 0; foreach (System.Attribute a in oldattribs) { if (a.GetType().FullName != newattrib.GetType().FullName) { newattribs[i++] = a; } } typeof(System.ComponentModel.MemberDescriptor).InvokeMember("attributes", setflags, null, memb, new object[] { newattribs }); typeof(System.ComponentModel.MemberDescriptor).InvokeMember("originalAttributes", setflags, null, memb, new object[] { newattribs }); typeof(System.ComponentModel.MemberDescriptor).InvokeMember("attributeCollection", setflags, null, memb, new object[] { new System.ComponentModel.AttributeCollection(newattribs) }); } } else if (on) { System.Attribute[] newattribs = new System.Attribute[oldattribs.Length + 1]; int i = 0; foreach (System.Attribute a in oldattribs) { newattribs[i++] = a; } newattribs[i++] = newattrib; typeof(System.ComponentModel.MemberDescriptor).InvokeMember("attributes", setflags, null, memb, new object[] { newattribs }); typeof(System.ComponentModel.MemberDescriptor).InvokeMember("originalAttributes", setflags, null, memb, new object[] { newattribs }); typeof(System.ComponentModel.MemberDescriptor).InvokeMember("attributeCollection", setflags, null, memb, new object[] { new System.ComponentModel.AttributeCollection(newattribs) }); } }
public override object GetValue(object component) { component = MemberDescriptor.GetInvokee(_componentType, component); InitAccessors(); return(getter.GetValue(component, null)); }
protected EventDescriptor(MemberDescriptor descr) { throw new NotImplementedException(); }
protected EventDescriptor(MemberDescriptor descr, Attribute[] attrs) { throw new NotImplementedException(); }
protected MemberDescriptor(MemberDescriptor reference, Attribute [] attrs) { name = reference.name; this.attrs = attrs; }
protected MemberDescriptor(MemberDescriptor reference) { name = reference.name; attrs = reference.AttributeArray; }
/// <summary> /// /// Initializes a new instance of the <see cref='System.ComponentModel.PropertyDescriptor'/> class with /// the name in the specified <see cref='System.ComponentModel.MemberDescriptor'/> and the /// attributes in both the <see cref='System.ComponentModel.MemberDescriptor'/> and the /// <see cref='System.Attribute'/> array. /// /// </summary> protected PropertyDescriptor(MemberDescriptor descr, Attribute[] attrs) : base(descr, attrs) { }
protected PropertyDescriptor(MemberDescriptor reference) : base(reference) { }
protected PropertyDescriptor(MemberDescriptor reference, Attribute [] attrs) : base(reference, attrs) { }
// Constructors. protected MemberDescriptor(MemberDescriptor descr) : this(descr, null) { }
/// <summary> /// Initializes a new instance of the <see cref='System.ComponentModel.PropertyDescriptor'/> class with /// the name and attributes in the specified <see cref='System.ComponentModel.MemberDescriptor'/>. /// </summary> protected PropertyDescriptor(MemberDescriptor descr) : base(descr) { }
protected EventDescriptor(MemberDescriptor descr) : base(descr) { }
/// <summary> /// Compares this instance to the specified <see cref='System.ComponentModel.MemberDescriptor'/> to see if they are equivalent. /// NOTE: If you make a change here, you likely need to change GetHashCode() as well. /// </summary> public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (obj.GetType() != GetType()) { return(false); } MemberDescriptor mdObj = (MemberDescriptor)obj; FilterAttributesIfNeeded(); mdObj.FilterAttributesIfNeeded(); if (mdObj._nameHash != _nameHash) { return(false); } if ((mdObj._category == null) != (_category == null) || (_category != null && !mdObj._category.Equals(_category))) { return(false); } if ((mdObj._description == null) != (_description == null) || (_description != null && !mdObj._description.Equals(_description))) { return(false); } if ((mdObj._attributes == null) != (_attributes == null)) { return(false); } bool sameAttrs = true; if (_attributes != null) { if (_attributes.Length != mdObj._attributes.Length) { return(false); } for (int i = 0; i < _attributes.Length; i++) { if (!_attributes[i].Equals(mdObj._attributes[i])) { sameAttrs = false; break; } } } return(sameAttrs); }
protected EventDescriptor(MemberDescriptor descr, Attribute[] attrs) : base(descr, attrs) { }