heya guys
Im working on a C# Application and im having some issues with the ThreadSafe thingimabob.
When i try execute the a command i get the Thread not safe.
heres my Code!
Ok so i have j_XError above witch calls the SetLoginStatus But i get an error about not being Thread Safe.
Can someone explain to me whats going in
Im working on a C# Application and im having some issues with the ThreadSafe thingimabob.
When i try execute the a command i get the Thread not safe.
heres my Code!
PHP:
using System;
using System.Threading;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using ComponentFactory.Krypton.Toolkit;
using System.Windows.Forms;
namespace XXXXX
{
public partial class Login : KryptonForm
{
public Login()
{
InitializeComponent();
}
private void Login_Load(object sender, EventArgs e)
{
//Hide Elements
this.login_progress_bar.Visible = false;
}
private void ExitApp_Click(object sender, EventArgs e)
{
this.Close();
}
private void doLogin(object sender, EventArgs e)
{
string u = login_username.Text;
string p = login_password.Text;
//Check for default values
if (u.Length == 0 || p.Length == 0)
{
this.SetLoginStatus("Please fill out all login feilds");
return;
}
this.LoginEnabled(false);
/*
Removed all execution code here because its private application :)
*/
}
//Handlers
/*I Run the this.SetLoginStatus witch is located below, but it strikes an unsafe thread error*/
private void j_XError(object sender, Exception ex) { this.SetLoginStatus("Incorrect Username or Password");}
private void j_XAuth(object sender){/*ShowDialog("Authenticated: " + sender.ToString());*/}
private void j_XWrite(object sender, string txt){if (txt == " ") return;/*ShowDialog("SEND: " + txt);*/}
private void j_XRead(object sender, string txt){if (txt == " ") return;/*ShowDialog("RECV: " + txt);*/}
//Dialog Box
private void ShowDialog(string Message){MessageBox.Show(Message);}
private void SetLoginStatusTest(string message)
{
label1.Text = message;
}
private void SetLoginStatus(string message)
{
label1.Text = message;
}
private void LoginEnabled(bool status)
{
login_username.Enabled = login_password.Enabled = login_button.Enabled = status;
}
//Menu Actions
private void OptionsMenuOpen(object sender, EventArgs e)
{
Settings Settings = new Settings();
Settings.Show();
}
}
}
Ok so i have j_XError above witch calls the SetLoginStatus But i get an error about not being Thread Safe.
Can someone explain to me whats going in