protected virtual bool OnPendingChange(string propertyName, object currentval, object newval) { TinyRails.AcceptPendingChangeHandler handler = PendingChange; if (handler != null) { if (System.Windows.Forms.Application.OpenForms.Count > 0) { System.Windows.Forms.Form mainForm = System.Windows.Forms.Application.OpenForms[0]; if (mainForm != null) { if (mainForm.InvokeRequired) { // We are not in UI Thread now mainForm.Invoke(handler, new object[] { this, new System.ComponentModel.PropertyChangedEventArgs(propertyName) }); } else { TinyRails.AcceptPendingChangeEventArgs ea = new TinyRails.AcceptPendingChangeEventArgs(propertyName, currentval, newval); handler(this, ea); return(!ea.CancelPendingChange); } } } } return(true); }
private static void Ud_PendingChange(object sender, TinyRails.AcceptPendingChangeEventArgs e) { foreach (var item in Configuration.NotCollectedList) { if (item.Resource == e.PropertyName) { if (((e.NewValue).GetType() == typeof(int)) && (((e.CurrentValue).GetType() == typeof(int)))) { item.Amount -= ((int)e.NewValue - (int)e.CurrentValue); } break; } } }