public int Add(SpecialDay day) { int i; i = InnerList.Add(day); // Must be refres control //if (OnAddNewButton != null) { // OnAddNewButton(Button); //} return(i); }
public int IndexOf(int day) { for (int i = 0; i < this.InnerList.Count; ++i) { SpecialDay s = (SpecialDay)this[i]; if (s.Date.Day == day) { return(i); } } return(-1); }
protected override void OnInsert(int index, object value) { if (value is SpecialDay) { SpecialDay s = (SpecialDay)value; s.Owner = m_owner; //if (s.ImageIndexies == null) //s.ImageIndexies = new ImageIndexMappingCollection(s.Owner); //((SpecialDay)value).Owner = m_owner; // //m_owner.Invalidate(); } base.OnInsert(index, value); }
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { try { SpecialDay sDay = (SpecialDay)value; ConstructorInfo cInfo = typeof(SpecialDay).GetConstructor(new Type[] { typeof(Calendar), typeof(DateTime), typeof(int), typeof(SpecialDayOccorence), typeof(int[]) }); return(new InstanceDescriptor(cInfo, new object[] { sDay.Owner, sDay.Date, sDay.ImageIndex, sDay.Occorence, sDay.ImageIndexies.ToIntegerArray }, true)); //if (sDay.ImageIndexies != null) { // return new InstanceDescriptor(cInfo, new object[] { sDay.Owner, sDay.Date, sDay.Occorence, sDay.ImageIndexies.ToIntegerArray }, true); //} else { // return new InstanceDescriptor(cInfo, new object[] { sDay.Owner, sDay.Date, sDay.Occorence, null }, true); //} } catch (Exception) { string msg = string.Empty; Type t1 = value.GetType(); Type t2 = typeof(SpecialDay); msg += "Old Value = " + t1.Assembly.GetFiles()[0].Name + "\n"; msg += "New Value = " + t2.Assembly.GetFiles()[0].Name; MessageBox.Show(msg); //t.Assembly.GetFiles()[0].Name //MessageBox.Show("Assembly 1 " + t1.ToString()); //MessageBox.Show("Assembly 2 " + t2.ToString()); //MessageBox.Show("Assembly 1 and 2 is " + (t1 == t2).ToString()); //MessageBox.Show("Poo2 : " + ex.ToString()); return(base.ConvertTo(context, culture, value, destinationType)); } //return base.ConvertTo(context, culture, value, destinationType); //sDay = new SpecialDay(Calendar, DateTime, SpecialDayOccorence); //ConstructorInfo cInfo = typeof(SpecialDay).GetConstructor(new Type[] { typeof(DateTime) });//, typeof(DateTime), typeof(SpecialDayOccorence) }); //return base.ConvertTo(context, culture, value, destinationType); //return new InstanceDescriptor(cInfo, new object[] { sDay.Date }, true);//, sDay.Date, sDay.Occorence}, true); //ConstructorInfo cInfo = typeof(SpecialDay).GetConstructor(System.Type.EmptyTypes); //return new InstanceDescriptor(cInfo, null, false); } return(base.ConvertTo(context, culture, value, destinationType)); }
internal ImageIndexMappingCollection(SpecialDay owner) { m_owner = owner; }
public void Remove(SpecialDay day) { InnerList.Remove(day); }
public bool Contains(SpecialDay day) { return(InnerList.Contains(day)); }
public int IndexOf(int year, int month, int day) { SpecialDay sp = new SpecialDay(new DateTime(year, month, day)); return(this.IndexOf(sp)); }
public int IndexOf(SpecialDay day) { return(InnerList.IndexOf(day)); }
public ImageIndexMapping(SpecialDay owner, int index) { m_owner = owner; m_iImageIndex = index; }