Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Current Version" doesn't update in WPF sample #49

Closed
CoderNate opened this issue Nov 10, 2014 · 3 comments
Closed

"Current Version" doesn't update in WPF sample #49

CoderNate opened this issue Nov 10, 2014 · 3 comments
Labels
Milestone

Comments

@CoderNate
Copy link

I think the first thing a lot of people would do to try out this project is run the WPF sample app. When doing so it's likely they'll notice that the Current Version displayed on the main window usually doesn't change from 1.0 to 1.1 as expected after doing an "Install Now". In the following code from UpdateWindow.xaml.cs you can see it's possible for updateManager.CleanUp to finish before the BeginInvoke that closes the update window finishes. If that happens, the CleanUp method sets the updatemanager's state back to unchecked before the closed event handler inside the main window does its check to see that the state is AppliedSuccessfully. The Closed handler in the MainWindow code only calls OnPropertyChanged("AppVersion") if the state is AppliedSuccessfully. Maybe the easiest thing is to make sure the Update window closes before CleanUp is called.

private void InstallNow_Click(object sender, RoutedEventArgs e)
{
...
    Dispatcher d = Application.Current.Dispatcher;
    d.BeginInvoke(new Action(Hide));
    try
    {
        _updateManager.ApplyUpdates(true);
        d.BeginInvoke(new Action(Close));
    }
    catch
    {
        d.BeginInvoke(new Action(this.Show));
            // this.WindowState = WindowState.Normal;
        MessageBox.Show(
            "An error occurred while trying to install software updates");
    }

    _updateManager.CleanUp();
    d.BeginInvoke(new Action(this.Close));

    Action close = Close;

    if (Dispatcher.CheckAccess())
        close();
    else
        Dispatcher.Invoke(close);
...
}
@synhershko
Copy link
Owner

Can you please send a Pull Request with a fix which works for you?

@CoderNate
Copy link
Author

I made a patch file. It only changes 5 lines in UpdateWindow.Xaml.cs. https://drive.google.com/file/d/0BzDPYJ5wsGqpQmtjUVpQT3dZWG8/view?usp=sharing
Hope that will work for you.

robinwassen added a commit that referenced this issue Nov 13, 2016
… the wpf sample made the version number not update
@robinwassen robinwassen added this to the 0.6.0.0 milestone Nov 13, 2016
@robinwassen
Copy link
Collaborator

This has been fixed in commit: 6fc8c6f

Thanks for reporting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants