My application uses ClickOnce technology for deployment. However I have problem when user starts using the application. The scenario for reproducing the problem is as follows:
- User clicks on application's shortcut in order to run the application
- ClickOnce's "Launching application" dialog box appears in order to check for updates
- "Launching application" dialog box disappears
- Splashscreen appears
- Main window (login window) appears - however it's not active nor has a focus
Because main window is not active, user has to click on it before he/she can start typing username and password. How can I resolve this problem so the main window is active after it appears? I've tried the following code but it's not working:
protected override void OnInitialized(EventArgs e)
{
while (!this.IsFocused) { this.Focus(); WPFWaitForPriority.WaitForPriority(DispatcherPriority.Background); }
base.OnInitialized(e);
}