///<summary>Raises the SetDisplayNameReply Event</summary>
 /// <param name="e">A SetDisplayNameReplyEventArgs object containing
 /// the data sent from the simulator</param>
 protected virtual void OnSetDisplayNameReply(SetDisplayNameReplyEventArgs e)
 {
     EventHandler<SetDisplayNameReplyEventArgs> handler = m_SetDisplayNameReply;
     if (handler != null)
         handler(this, e);
 }
 void Self_SetDisplayNameReply(object sender, SetDisplayNameReplyEventArgs e)
 {
     if (e.Status == 200)
     {
         UpdateStatus("Name successfully changed to: " + e.DisplayName.DisplayName);
     }
     else
     {
         UpdateStatus("Update failed: " + e.Reason);
     }
 }
Exemple #3
0
 void Self_SetDisplayNameReply(object sender, SetDisplayNameReplyEventArgs e)
 {
     if (e.Status == 200)
     {
         DisplayNotificationInChat("You are now knows as " + e.DisplayName.DisplayName);
     }
     else
     {
         DisplayNotificationInChat("Failed to set a new display name: " + e.Reason, ChatBufferTextStyle.Error);
     }
 }
Exemple #4
0
        private void Self_SetDisplayNameReply(object sender, SetDisplayNameReplyEventArgs e)
        {
            if (e.Status == 200)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    txtDisplayName.Text = e.DisplayName.DisplayName;
                    button9.Enabled = false;
                }));
            }
            else
            {
                string reason = e.Reason;

                if (reason.Trim().ToLower(CultureInfo.CurrentCulture) == "bad request")
                {
                    MessageBox.Show("Display name could not be set.\nYou can only change your display name once per week!", "METAbolt", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Display name could not be set.\nReason: " + reason, "METAbolt", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            this.BeginInvoke(new MethodInvoker(delegate()
            {
                pBar3.Visible = false;
            }));

            client.Self.SetDisplayNameReply -= new EventHandler<SetDisplayNameReplyEventArgs>(Self_SetDisplayNameReply);
        }