Hello i have problem with wpf (c#) project. this is my source
namespace WpfApplication1
{
///
/// Interaction logic for MainWindow.xa
You should write your code in the Window_Load
event:
public MainWindow()
{
InitializeComponent();
Loaded += MainWindow_Loaded;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
MessageBox.Show("Test");
}
EDIT: To work with longer operations like (used a function with more than 10 function inside as you wanted) you could use ThreadPool like this:
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ThreadPool.QueueUserWorkItem(_ =>
{
//Longer Process (//set the operation in another thread so that the UI thread is kept responding)
Dispatcher.BeginInvoke(new Action(() =>
{
//use the Dispatcher to "return" to the UI thread
//To change the UI elements like label you should put them here like : label1.Text = "";
}));
});
}