Hey guys,
I have a splash screen I'm loading here:
private void main_Form_Load(object sender, EventArgs e)
{
//Load Splash Screen
this.Hide();
Form_Splash form_Splash = new Form_Splash();
form_Splash.Owner = this;
form_Splash.Show();
System.Threading.Thread.Sleep(3000);
form_Splash.progressBar_splash.Value = 10;
form_Splash.label_Process.Text = "Checking Authentication...";
System.Threading.Thread.Sleep(2000);
// Create the context for the principal object.
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "REG");
// Retrieve the group principal object for the group you need.
GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(ctx, "Domain Admins");
// Check to see if this user is a member of the "Administrators" group.
bool isMember = UserPrincipal.Current.IsMemberOf(groupPrincipal);
if (!isMember)
{
form_Splash.label_Process.Text = "Authentication Failed!";
MessageBox.Show("You do not have the appropriate permissions - Some controls may be disabled. If you feel you have received this notification in error, contact your system administrator.", "Authentication Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
else
{
try
{
form_Splash.progressBar_splash.Value = 30;
form_Splash.label_Process.Text = "Initializing SQL Connections...";
System.Threading.Thread.Sleep(2000);
//sql connection string
string cs = "Data Source=REG-PENTREE1\\SQLEXPRESS;Initial Catalog=reg_checkout;Integrated Security=SSPI";
conn = new SqlConnection(cs);
form_Splash.progressBar_splash.Value = 50;
System.Threading.Thread.Sleep(2000);
//open sql connection
form_Splash.label_Process.Text = "Openning SQL Connections...";
conn.Open();
form_Splash.label_Process.Text = "Starting...";
form_Splash.progressBar_splash.Value = 80;
System.Threading.Thread.Sleep(2000);
// cmd = new SqlCommand("UPDATE Laptops SET isCheckedOut=1 WHERE name='pen-laptop1'", conn);
// cmd.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException ex)
{
Console.WriteLine("Source: " + ex.Source);
Console.WriteLine("Exception Message: " + ex.Message);
}
catch (System.Exception ex)
{
Console.WriteLine("Source: " + ex.Source);
Console.WriteLine("Exception Message: " + ex.Message);
}
}
form_Splash.progressBar_splash.Value = 100;
System.Threading.Thread.Sleep(2000);
form_Splash.Close();
// TODO: This line of code loads data into the 'reg_checkoutDataSet1.Laptops' table. You can move, or remove it, as needed.
this.laptopsTableAdapter.FillByCheckedIn(this.reg_checkoutDataSet1.Laptops);
}
The screen loads, and the progress bar moves fine, but the label and image on the splash screen never update. Any ideas why this is happening?
I've attached a screenshot of the splash screen.