コード例 #1
0
        private void button_invite_Click(object sender, EventArgs e)
        {
            if (Bot.IsLoggedIn)
            {
                if (text_invite.Text != "" || text_invite.Text != "Group to invite members to")
                {
                    SteamGrouper.Properties.Settings.Default.group_invite_to = text_invite.Text;
                    SteamGrouper.Properties.Settings.Default.Save();
                    Thread thread1 = new Thread(() => Bot.invite(SelectInvite.selected, text_invite.Text, text_log, button_invite, label_invite));
                    if (!inviting)
                    {
                        SelectInvite selectInvite = new SelectInvite();
                        selectInvite.ShowDialog();
                        selectInvite.Focus();

                        while (Application.OpenForms.Count > 1)
                        {
                        }

                        if (SelectInvite.selectContinue)
                        {
                            string log = "\r\nInviting members of " + SelectInvite.selected + " to " + text_invite.Text + ", please wait...\n\n";
                            text_log.AppendText(log);
                            inviting             = true;
                            thread1.IsBackground = true;
                            thread1.Start();
                            text_invite.Enabled = false;
                            button_invite.Text  = "Cancel";
                        }
                    }
                    else
                    {
                        thread1.Interrupt();
                        thread1.Abort();
                        text_log.AppendText("\r\nProcess cancelled.\n");
                        text_invite.Enabled = true;
                        button_invite.Text  = "Invite";
                        inviting            = false;
                    }
                }
            }
            else
            {
                MessageBox.Show("Please login to your Steam account first!",
                                "Warning",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
            }
        }