예제 #1
0
        public MainForm(DiscordClient client)
        {
            InitializeComponent();
            this.client = client;

            checkTimer.Interval = 1;
            checkTimer.Start();
            updateTimerLabel.Text = "Status update possible";
            updateTimerLabel.ForeColor = System.Drawing.Color.Green;
            SetHelpLabel();
            usernameLabel.Text = "Logged in as " + client.CurrentUser.Name;
            Console.WriteLine(usernameLabel.Text);

            statusUpdater = new StatusUpdater(updateTimer, client);
            statusUpdater.StatusSetAttempted += StatusSetAttempted;
        }
예제 #2
0
        private void StatusSetAttempted(object sender, StatusUpdater.StatusSetAttemptedEventArgs e)
        {
            if (e.CurrentStatus == string.Empty)
                statusTextBox.Text = string.Empty;
            else
                statusTextBox.Rtf = @"{\rtf1\ansi {\colortbl;\red0\green0\blue0;}\cf1  " + PLAYINGTEXT + @" \b\cf0 " + e.CurrentStatus + @"\b0 }";

            if (e.Timer.Enabled)
            {
                if (e.NewStatus == null)
                {
                    updateTimerLabel.ForeColor = System.Drawing.Color.FromArgb(0xFF, 0xCC, 0x84, 0x00);
                    updateTimerLabel.Text = "No status update possible yet";
                }
                else
                {
                    updateTimerLabel.ForeColor = System.Drawing.Color.Red;
                    if (e.NewStatus == string.Empty)
                        updateTimerLabel.Text = "Pending status removal";
                    else
                        updateTimerLabel.Text = "Pending status update: " + e.NewStatus;
                }
            }
            else
            {
                updateTimerLabel.ForeColor = System.Drawing.Color.Green;
                updateTimerLabel.Text = "Status update possible";
            }
        }