public void OnDestroy() { if (OnFocus != null) { foreach (Delegate d in OnFocus.GetInvocationList()) { OnFocus -= (Action <IDialog>)d; } OnFocus = null; } if (OnBlur != null) { foreach (Delegate d in OnBlur.GetInvocationList()) { OnBlur -= (Action <IDialog>)d; } OnBlur = null; } if (OnShow != null) { foreach (Delegate d in OnShow.GetInvocationList()) { OnShow -= (Action <IDialog>)d; } OnShow = null; } if (OnHide != null) { foreach (Delegate d in OnHide.GetInvocationList()) { OnHide -= (Action <IDialog>)d; } OnHide = null; } if (OnClose != null) { foreach (Delegate d in OnClose.GetInvocationList()) { OnClose -= (Action <IDialog>)d; } OnClose = null; } if (OnCancel != null) { foreach (Delegate d in OnCancel.GetInvocationList()) { OnCancel -= (Action <IDialog>)d; } OnCancel = null; } }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (OnClose != null) { foreach (var d in OnClose.GetInvocationList()) { OnClose -= (Action <object, DialogResult>)d; } } }
//private void CheckBoxClick(object sender, RoutedEventArgs e) //{ // if (cbTwoSided.IsChecked != null) Program.GameSettings.UseTwoSidedTable = cbTwoSided.IsChecked.Value; //} #region Implementation of IDisposable /// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { Player.OnLocalPlayerWelcomed -= PlayerOnOnLocalPlayerWelcomed; if (OnClose != null) { foreach (var d in OnClose.GetInvocationList()) { OnClose -= (Action <object>)d; } } }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (OnClose != null) { foreach (var d in OnClose.GetInvocationList()) { OnClose -= (Action <object, DialogResult>)d; } } Program.LobbyClient.OnLoginComplete -= LobbyClientOnLoginComplete; Program.LobbyClient.OnDisconnect -= LobbyClientOnDisconnect; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (OnClose != null) { foreach (var d in OnClose.GetInvocationList()) { OnClose -= (Action <object, DialogResult>)d; } } Program.LobbyClient.Connected -= LobbyClient_Connected; Program.LobbyClient.Disconnected -= LobbyClient_Disconnected; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (OnClose != null) { foreach (var d in OnClose.GetInvocationList()) { OnClose -= (Action <object, DialogResult>)d; } } if (PropertyChanged != null) { foreach (var d in PropertyChanged.GetInvocationList()) { PropertyChanged -= (PropertyChangedEventHandler)d; } } }
private void invokeOnClose(WebSocketCloseStatus closeStatus, string statusDescription) { if (OnClose == null) { return; } try { var members = OnClose.GetInvocationList().Cast <Func <WebSocketCloseStatus, string, Task> >(); Task.WhenAll(members.Select(x => x(closeStatus, statusDescription))) .ContinueWith(t => InvokeOnError(t.Exception), TaskContinuationOptions.OnlyOnFaulted); //.Wait(0); } catch (Exception ex) when(ex.InnerException is TaskCanceledException) { } }