所以我有这段代码可以运行一个工作线程等等。我缩短了它以仅显示必要的部分。在 UploaderDoWork 我有一个我想要 toolStripStatusLabel1 的文本。如何从那里将值分配给 toolStripStatusLabel1?
using Google.GData.Client;
using Google.GData.Extensions.MediaRss;
using Google.GData.Extensions;
using Google.GData.YouTube;
using Google.YouTube;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Windows;
using System;
using System.Globalization;
using System.Resources;
using System.Reflection;
using System.ComponentModel;
namespace Something
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private static BackgroundWorker uploader;
static void UploaderDoWork(object sender, DoWorkEventArgs e)
{
//How do I assign a value to toolStripStatusLabel1, that is in Form1 from here?
}
private void w()
{
uploader = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true };
uploader.DoWork += UploaderDoWork;
uploader.RunWorkerCompleted += delegate { System.Windows.Forms.MessageBox.Show(ursache + " beendet!"); };
uploader.RunWorkerAsync();
}
private void button1_Click(object sender, EventArgs e)
{
w();
}
}
}