/// <summary> /// Fires the event asynchronously. /// </summary> /// <param name="d">The delegate to fire.</param> /// <param name="e">The event args to fire with.</param> internal void FireEventAsync(Delegate d, LilaEvent e) { if (d != null && e != null) { Task t = Task.Run(() => d.DynamicInvoke(this, e)); t.ContinueWith(DisposeTask); } }
/// <summary> /// Fires the event synchronously. /// </summary> /// <param name="d">The delegate to fire.</param> /// <param name="e">The event args to fire with.</param> /// <returns>True if delegate is not null; otherwise False</returns> internal bool FireEvent(Delegate d, LilaEvent e) { if (d != null) { d.DynamicInvoke(this, e); return(true); } else { return(false); } }
/// <summary> /// Handles the authentication. /// </summary> /// <param name="callback">The callback.</param> private void HandleAuth(Task <LilaResponse> callback) { if (callback.IsFaulted || !callback.Result.CheckStatus(HttpStatusCode.OK | HttpStatusCode.SeeOther)) { LilaEvent authFail = new LilaEvent(this); Events.FireEventAsync(Events._onAuthenticationFail, authFail); log.Warn("Events.OnAuthentication is not added, login will not connect to the lobby."); } else { //Authenticated GotoLobby(callback); } }