Example #1
0
 private void ViewClanRequests()
 {
     UserRequestEventHandler handler = null;
     UserRequestEventHandler handler2 = null;
     if ((this.ClanRequests != null) && (this.ClanRequests.Count > 0))
     {
         DlgClanRequests<ClanRequest> requests = new DlgClanRequests<ClanRequest>(this, this.ClanRequests);
         if (handler == null)
         {
             handler = delegate (object sender, UserRequestEventArgs e) {
                 if (this.InviteToClan(e.Request.RequestorName))
                 {
                     if (!DataAccess.ExecuteQuery("RemoveClanRequest", new object[] { e.Request.RequestorName }))
                     {
                         this.ErrorMessage("<LOC>Unable to remove request at this time.", new object[0]);
                         return false;
                     }
                     return true;
                 }
                 return false;
             };
         }
         requests.AcceptRequest += handler;
         if (handler2 == null)
         {
             handler2 = delegate (object sender, UserRequestEventArgs e) {
                 if (DataAccess.ExecuteQuery("RemoveClanRequest", new object[] { e.Request.RequestorName }))
                 {
                     Messaging.SendCustomCommand(e.Request.RequestorName, CustomCommands.SystemEvent, new object[] { "<LOC>{0} has turned down your request for a clan invitaion.", e.Request.RequestorName });
                     this.SystemMessage("<LOC>A rejection notification has been sent.", new object[0]);
                     return true;
                 }
                 this.ErrorMessage("<LOC>Unable to remove request at this time.", new object[0]);
                 return false;
             };
         }
         requests.RejectRequest += handler2;
         requests.Show();
     }
 }
Example #2
0
 private void ViewClanInvites()
 {
     UserRequestEventHandler handler = null;
     if (this.ClanInvites.Count > 0)
     {
         DlgClanRequests<ClanInvite> dlg = new DlgClanRequests<ClanInvite>(this, this.ClanInvites);
         dlg.AcceptRequest += delegate (object sender, UserRequestEventArgs e) {
             if (e.Request is ClanInvite)
             {
                 ClanInvite request = e.Request as ClanInvite;
                 this.JoinClan(request.ClanID, request.ClanName, request.ClanAbbreviation);
                 this.ClanInvites.Clear();
                 dlg.Close();
                 return true;
             }
             this.ErrorMessage("<LOC>Unable to accept invitation at this time.", new object[0]);
             return false;
         };
         if (handler == null)
         {
             handler = delegate (object sender, UserRequestEventArgs e) {
                 if (e.Request is ClanInvite)
                 {
                     ClanInvite request = e.Request as ClanInvite;
                     if (DataAccess.ExecuteQuery("RemoveClanInvite", new object[] { request.ClanName }))
                     {
                         Messaging.SendCustomCommand(e.Request.RequestorName, CustomCommands.SystemEvent, new object[] { "<LOC>{0} has turned down your clan invitaion.", User.Current.Name });
                         this.SystemMessage("<LOC>A rejection notification has been sent.", new object[0]);
                         return true;
                     }
                     this.ErrorMessage("<LOC>Unable to remove invitation at this time.", new object[0]);
                     return false;
                 }
                 this.ErrorMessage("<LOC>Unable to remove invitation at this time.", new object[0]);
                 return false;
             };
         }
         dlg.RejectRequest += handler;
         dlg.Show();
     }
 }