Hi ,
I am struggling With issue since three days.
I am using progress bar in Splash window. That Progress bar Run Correctly if i set await Task.Delay(1000) after one second my dll are going to load because Program wait for completing Delay time. After 1 sec my Progress bar stopped and my dll getting load.That make program lazy and its take much time to load application
i want both work simultaneously . My Progress bar Should run continuous and
My dll should run in back ground. After that it will open Login Window so please help me
Below is My Code
I created Progress bar in Xaml.
<ProgressBar Minimum="0" Maximum="100" Height="10" Background="Transparent" Width="100" Foreground="Black" Name="pbStatus" IsIndeterminate="True" Grid.Column="1" Margin="4,29,-4,20" />
My Splash Window Code In App.Xaml.cs
var splashScreen = new SplashWindow();
splashScreen.Show();
Task.Factory.StartNew(() =>
{
System.Threading.Thread.Sleep(5000);
this.Dispatcher.Invoke(() =>
{
var mainWindow = new Views.Common.LogIn();
this.MainWindow = mainWindow;
mainWindow.Show();
splashScreen.Close();
});
});
How can i over come with this issue
What I have tried:
this.Dispatcher.Invoke(() =>
{
var mainWindow = new Views.Common.LogIn();
this.MainWindow = mainWindow;
mainWindow.Show();
splashScreen.Close();
});
});
<pre>Task.Run(() =>
{
var mainWindow = new Views.Common.LogIn();
this.MainWindow = mainWindow;
mainWindow.Show();
splashScreen.Close();
}