本文整理匯總了C#中System.ComponentModel.PropertyChangingEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# PropertyChangingEventArgs類的具體用法?C# PropertyChangingEventArgs怎麽用?C# PropertyChangingEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PropertyChangingEventArgs類屬於System.ComponentModel命名空間,在下文中一共展示了PropertyChangingEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: _location_PropertyChanging
public void _location_PropertyChanging(object sender, PropertyChangingEventArgs e)
{
//if (e.PropertyName == "StadiumName")
//{
// if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
// }
// else
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
// throw new Exception("StadiumName should not have numbers");
// }
//}
if (e.PropertyName == "LocationName")
{
if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
}
else
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
throw new Exception("LocationName should not have numbers");
}
}
}
示例2: RaisePropertyChanging
protected virtual void RaisePropertyChanging(PropertyChangingEventArgs property)
{
if (this.PropertyChanging != null)
{
this.PropertyChanging(this, property);
}
}
示例3: CPropertyChanging
static void CPropertyChanging(Object sender, PropertyChangingEventArgs e)
{
if ("Nome|Sobrenome".Contains(e.PropertyName))
Console.WriteLine("o valor original da propriedade {0} é {1}",
e.PropertyName,
sender.GetType().GetProperty(e.PropertyName).GetValue(sender, null));
}
示例4: OnPropertyChanging
/// <summary>
/// Raises the PropertyChanging event.
/// </summary>
/// <param name="propertyName">The name of the property.</param>
protected virtual void OnPropertyChanging([CallerMemberName] string propertyName = "")
{
if (PropertyChanging != null && SuppressEvents == false)
{
PropertyChangingEventArgs args = new PropertyChangingEventArgs(propertyName);
PropertyChanging(this, args);
}
}
示例5: NotifyPropertyChanging
protected virtual void NotifyPropertyChanging(string propertyName)
{
if (this.PropertyChanging != null)
{
var e = new PropertyChangingEventArgs(propertyName);
this.PropertyChanging(this, e);
}
}
示例6: Preset
public void Preset(object sender, PropertyChangingEventArgs args)
{
if (!_resetOnce)
return;
var stones = ((CupVM)DataContext).Stones;
tbStones.ClearValue(TextBlock.TextProperty);
tbStones.Text = stones.ToString();
_resetOnce = false;
}
示例7: RememberOldValue
public void RememberOldValue(object sender, PropertyChangingEventArgs e)
{
if(instance != null)
{
throw new InvalidOperationException("Old value is already initialized");
}
instance = sender;
propertyName = e.PropertyName;
oldValue = TypeUtils.GetPropertyValue(sender, e.PropertyName);
}
示例8: RaisePropertyChangingEvent
/// <summary>
/// elevar el evento de PropertyChanging. La propiedad especificada va a ser cambiada.
/// </summary>
/// <param name="propertyName">El nombre de la propiedad que ha cambiado.</param>
public virtual void RaisePropertyChangingEvent(string propertyName)
{
// Salir si los cambios son ignorados.
if (IgnorePropertyChangeEvents) return;
// Salir si no se suscriben
if (PropertyChanging == null) return;
// Elevar el evento
var e = new PropertyChangingEventArgs(propertyName);
PropertyChanging(this, e);
}
示例9: MyPropertyChanging
private void MyPropertyChanging(object sender, PropertyChangingEventArgs e)
{
lock (this.oldPropertyValueDic)
{
// ViewModelの狀態を元すため、プロパティの元の値を保存します。
if (!this.oldPropertyValueDic.ContainsKey(e.PropertyName))
{
this.oldPropertyValueDic[e.PropertyName] =
MethodUtil.GetPropertyValue(sender, e.PropertyName);
}
}
base.OnPropertyChanging(e);
}
示例10: OnLocationPropertyChanging
protected void OnLocationPropertyChanging(object sender, PropertyChangingEventArgs e)
{
LocationObj loc = sender as LocationObj;
if (loc == null)
return;
// Trace.WriteLine("Location property changing: " + loc.ToString() + " property: " + e.PropertyName);
//Update if a position or everything has changed
if (e.PropertyName.Contains("Position") || e.PropertyName.Contains("WorldPosition") || string.IsNullOrEmpty(e.PropertyName))
{
// Location locView = new Location(loc);
RemoveStructureLinks(new LocationObj[]{loc});
RemoveLocations(new LocationObj[] { loc }, false);
}
}
示例11: _team_PropertyChanging
public void _team_PropertyChanging(object sender, PropertyChangingEventArgs e)
{
if (e.PropertyName == "ShortName")
{
if(((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
}
else
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
throw new Exception("Short Name should not have numbers");
}
}
}
示例12: _player_PropertyChanging
public void _player_PropertyChanging(object sender, PropertyChangingEventArgs e)
{
//if (e.PropertyName == "FirstName")
//{
// if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
// }
// else
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
// throw new Exception("First Name should contain only Characters");
// }
//}
//else if (e.PropertyName == "LastName")
//{
// if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
// }
// else
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
// throw new Exception("Last Name should contain only Characters");
// }
//}
if (e.PropertyName == "MobileNo")
{
if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsDigit))
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
}
else
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
throw new Exception("Mobile No should contain only Numbers");
}
}
}
示例13: OnPropertyChanging
private void OnPropertyChanging(object subject, PropertyChangingEventArgs args)
{
if (args.PropertyName == PropertyName)
{
log.Trace("OnPropertyChanging " + args.PropertyName);
// Unsubscribe from children
UnsubscribeFromChildren(subject);
}
}
示例14: OnPropertyChanging
private void OnPropertyChanging(object sender, PropertyChangingEventArgs e)
{
switch (e.PropertyName)
{
case "SelectedView":
CheckSettingsWorkspace(SelectedView);
break;
}
}
示例15: InstancePropertyChanging
private static void InstancePropertyChanging(object sender, PropertyChangingEventArgs e)
{
}