Giter Site home page Giter Site logo

Comments (5)

dbforge avatar dbforge commented on May 17, 2024 1

Ah, I see. You're using WPF, that's the problem. But, in any case, that wouldn't have been the necessary event. ;)
Version 3.x of nUpdate requires a small workaround for WPF as nUpdate, by default, calls Application.Exit which will not close the host application correctly. The library was originally invented to serve only for Windows Forms.
To fix that, create a new class and add this content:

using nUpdate.Updating;

public class WPFUpdateManager : UpdateManager
{
    public WPFUpdateManager(Uri updateConfigurationFileUri, string publicKey, CultureInfo languageCulture) : base(updateConfigurationFileUri, publicKey, languageCulture)
    { }
    public override void TerminateApplication()
    {
        Environment.Exit(0);
    }
}

Then use that class instead of UpdateManager. This should fix your problem.
This will be fixed in v4 as WPF will become fully supported then.

from nupdate.

dbforge avatar dbforge commented on May 17, 2024

Hi,

there are a bunch of misunderstandings here with regards to the UpdaterUI class.
First: You must set your properties before starting the update process.
The line manager.RestartHostApplication = false; should consequently be placed above the call of updaterUI.ShowUserInterface(). The reason is that the class UpdaterUI does everything automatically in this method (seaching, downloading and installing) and thus, your program will be terminated at the end of this method, not taking care of your property. In any case, the UpdateManager instance must already be fully initialized when you're handling it over as argument to the constructor of UpdaterUI as this one keeps its instance in a backing field not noticing any further changes.

The second problem, that is also responsable for the event not being fired, can be split into two parts:
The UpdaterUI class, as already mentioned, implements the whole update process over the UpdaterManager, so that the user does not have to do anything else than calling ShowUserInterface().
Now, there are two configurations of nUpdate. The one is ProvideTAP (offering the Taskbased asynchronous pattern) which you may be using, I think, and the other one is WithoutTAP (offering the Eventbased asynchronous pattern only). WithoutTAP will be removed in v4 btw.
Now, the UpdaterUI is determining the used configuration and either uses Tasks + async/await, or async methods with events then. But, in any case, even if you use EAP, the class is not designed to fire any events aiming that the user should handle them. The reason is, as already described, that everything is done automatically and there is no need for subscription of events. The events should only be used when you're implementing a custom UI or no UI at all. That would mean that you only use the UpdateManager itself and in this case you may implement the updating process using events.
tl;dr: UpdaterUI is a finished implementation of the UpdateManager for offering the user an integrated user interface and besides that, the user does not have to do anything else. You can also have a look at it on GitHub to see how this is working internally.

Happy Easter,
Dominic

from nupdate.

KillTrot avatar KillTrot commented on May 17, 2024

Much thanks for your answer!

My root problem is, that nUpdate does not close my application while installing, therefore the user have to do it manually. This is the reason why im trying to catch the event.
May you help me a little bit out.

from nupdate.

KillTrot avatar KillTrot commented on May 17, 2024

This works!

Thanks alot!

from nupdate.

dbforge avatar dbforge commented on May 17, 2024

See also: #31
This issue is now fixed and thus, a workaround is no longer necessary.

from nupdate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.