End Google Ads 201810 - BS.net 01 -->
Hi,
I am just wondering something related to safety:
Is it safe to create Windows forms from separated Threads (System.Threading) ?
The Thread is created from a UserControl (from a click button for example).
The point is that when the thread is started I need to show some "custom forms" (Windows.Forms) that are created inside the thread in order to promp to the user the -OK and -CANCEL options in order to take a desition from there.
The thread is a single thread apartment (STA)
Example:
namespace ThreadTestandForms
{
public partial class FormGUI : UserControl
{
private void button2_Click(object sender, EventArgs e)
{
Thread ThreadSendParts;
ThreadSendParts = new Thread(new ThreadStart(RunsOnThread));
ThreadSendParts.SetApartmentState(ApartmentState.STA);
//I want to use a good priority.
ThreadSendParts.Priority = ThreadPriority.Highest;
ThreadSendParts.Start();
FrmSentPrtPgres.ShowDialog(); //I need to show a modal dialog after running the thread.
}
private void RunsOnThread()
{
for (int i = 0; i
مواقع النشر (المفضلة)