protected static void OnVectorChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { ChangeDependencyObject.OnItemChanged(sender, e); VectorObject me = sender as VectorObject; if (me != null) { me.OnVectorItemChanged(me, e); } }
static void OnTextDataChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { DescriptionObject me = sender as DescriptionObject; if (me != null && !me.Updating) { me.Updating = true; me.Text = me.TextData.Replace("\r\n", DataStrings.Caret); ChangeDependencyObject.OnItemChanged(me, e); me.Updating = false; } }
private void Target_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; if (btn != null) { DictionaryEntry entry = (DictionaryEntry)btn.CommandParameter; ChangeDependencyObject obj = entry.Key as ChangeDependencyObject; if (obj != null) { obj.Tag = btn.Tag; } } }
static void SetPropertyValue(object ObjectItem, PropertyInfo property, string value) { if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); } if (property.PropertyType == typeof(bool)) { bool b = false; if (bool.TryParse(value, out b)) { property.ThreadSetValue(ObjectItem, b); } } else if (property.PropertyType == typeof(byte)) { byte b = 0; if (byte.TryParse(value, out b)) { property.ThreadSetValue(ObjectItem, b); } } else if (property.PropertyType == typeof(short)) { short b = 0; if (value.Contains('.')) { value = value.Substring(0, value.IndexOf('.')); } if (short.TryParse(value, out b)) { property.ThreadSetValue(ObjectItem, b); } } else if (property.PropertyType == typeof(int)) { int b = 0; if (value.Contains('.')) { value = value.Substring(0, value.IndexOf('.')); } if (int.TryParse(value, out b)) { property.ThreadSetValue(ObjectItem, b); } } else if (property.PropertyType == typeof(long)) { long b = 0; if (value.Contains('.')) { value = value.Substring(0, value.IndexOf('.')); } if (long.TryParse(value, out b)) { property.ThreadSetValue(ObjectItem, b); } } else if (property.PropertyType == typeof(double)) { double b = 0; if (double.TryParse(value, out b)) { property.ThreadSetValue(ObjectItem, b); } } else if (property.PropertyType == typeof(decimal)) { decimal b = 0; if (decimal.TryParse(value, out b)) { property.ThreadSetValue(ObjectItem, b); } } else { if (property.ImplementsIList()) { IList l = property.ThreadGetValue(ObjectItem) as IList; if (l == null) { l = property.PropertyType.GetInstance() as IList; } if (l != null) { Type t = l.GetElementType(); if (t.InheritsOrIs(typeof(ChangeDependencyObject))) { ChangeDependencyObject newObj = t.GetInstance(value) as ChangeDependencyObject; l.Add(newObj); } else { l.Add(value); } } } else { property.ThreadSetValue(ObjectItem, value); } } if (_log.IsDebugEnabled) { _log.DebugFormat("Endng {0}", MethodBase.GetCurrentMethod().ToString()); } }