コード例 #1
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);
        }
コード例 #2
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);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 void Self_SetDisplayNameReply(object sender, SetDisplayNameReplyEventArgs e)
 {
     UpdateStatus(e.Status == 200
         ? $"Name successfully changed to: {e.DisplayName.DisplayName}"
         : $"Update failed: {e.Reason}");
 }