Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ RemoveEventHandler()

override void System.ComponentModel.ReflectEventDescriptor.RemoveEventHandler ( object component,
Delegate value )
inline

Definition at line 277 of file ReflectEventDescriptor.cs.

278 {
279 FillMethods();
280 if (component == null)
281 {
282 return;
283 }
284 ISite site = MemberDescriptor.GetSite(component);
285 IComponentChangeService componentChangeService = null;
286 if (site != null)
287 {
288 componentChangeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
289 }
290 if (componentChangeService != null)
291 {
292 try
293 {
294 componentChangeService.OnComponentChanging(component, this);
295 }
296 catch (CheckoutException ex)
297 {
298 if (ex == CheckoutException.Canceled)
299 {
300 return;
301 }
302 throw;
303 }
304 componentChangeService.OnComponentChanging(component, this);
305 }
306 bool flag = false;
307 if (site != null && site.DesignMode)
308 {
309 IDictionaryService dictionaryService = (IDictionaryService)site.GetService(typeof(IDictionaryService));
310 if (dictionaryService != null)
311 {
312 Delegate source = (Delegate)dictionaryService.GetValue(this);
313 source = Delegate.Remove(source, value);
314 dictionaryService.SetValue(this, source);
315 flag = true;
316 }
317 }
318 if (!flag)
319 {
320 MethodInfo removeMethod = _removeMethod;
321 object[] parameters = new Delegate[1] { value };
322 removeMethod.Invoke(component, parameters);
323 }
324 componentChangeService?.OnComponentChanged(component, this, null, value);
325 }
static readonly CheckoutException Canceled
object? Invoke(object? obj, object?[]? parameters)
void OnComponentChanged(object component, MemberDescriptor? member, object? oldValue, object? newValue)
void OnComponentChanging(object component, MemberDescriptor? member)
void SetValue(object key, object? value)

References System.ComponentModel.ReflectEventDescriptor._removeMethod, System.ComponentModel.Design.CheckoutException.Canceled, System.Delegate, System.ComponentModel.ISite.DesignMode, System.ComponentModel.ReflectEventDescriptor.FillMethods(), System.IServiceProvider.GetService(), System.ComponentModel.MemberDescriptor.GetSite(), System.ComponentModel.Design.IDictionaryService.GetValue(), System.Reflection.MethodBase.Invoke(), System.ComponentModel.Design.IComponentChangeService.OnComponentChanged(), System.ComponentModel.Design.IComponentChangeService.OnComponentChanging(), System.Delegate.Remove(), System.ComponentModel.Design.IDictionaryService.SetValue(), System.source, and System.value.