i have a wpf application, i need to display a messagebox, the problem is that the message box is displayed for 0.5 second and doesn't even wait for user to click OK.
MainWindow.xaml.cs :
public partial class MainWindow : Window
{
public MainWindow()
{
//verifying application setting file to see if the connection is ok
string pathToApp = System.AppDomain.CurrentDomain.BaseDirectory + "settings.sts";
ApplicationSettings applicationSettings = new ApplicationSettings();
applicationSettings.ServerIp = "127.0.0.1";
applicationSettings.ServerDatabase = "test";
applicationSettings.ServerUserName = "root";
applicationSettings.MakeConnectionString();
foreach (char c in "")
{
applicationSettings.ServerPassword.AppendChar(c);
}
MySqlConnection connection = new MySqlConnection(applicationSettings.ConnectionString);
try
{
connection.Open();
}
catch (Exception e)
{
// here the message box shows for 0.5 second and closes immediately
MessageBox.Show(e.Message);
}
finally
{
connection.Close();
}
//display window
InitializeComponent();
}
i should also that am using a image as a splash screen, if this have a relation with the message box.
sorry this code is not yet completed. thanks in advance