question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

manager.PackagesDownloadStarted not fired

See original GitHub issue

Hey guys,

Maybe i’m just not good enough with C#, but for me it seems that the event manager.PackagesDownloadStarded is not fired.

My Code:

using nUpdate.Updating;
using System;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
using System.Windows;

namespace KLauncher____Installer {
 /// <summary>
 /// Interaktionslogik für MainWindow.xaml
 /// </summary>
 public partial class MainWindow: Window {
  public MainWindow() {
   InitializeComponent();
  }

  private void button_Click(object sender, RoutedEventArgs e) {
   UpdateManager manager = new UpdateManager(new Uri("ServerURL"), "Key provide by nUpdate Administration", new CultureInfo("de-DE"));
   manager.PackagesDownloadStarted += Manager_PackagesDownloadStarted;
   var updaterUI = new UpdaterUI(manager, SynchronizationContext.Current);
   updaterUI.ShowUserInterface();
   manager.RestartHostApplication = false;

  }
  public void Manager_PackagesDownloadStarted(object sender, EventArgs e) {
   MessageBox.Show("Event fired!");
  }
 }
}

Please tell what i’m doing wrong:)

Have nice easter days.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dbforgecommented, Apr 16, 2017

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.

0reactions
dbforgecommented, Jun 1, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are bad managers often not fired when good ...
Only bullies and bad managers actually enjoy firing people. A good manager never enjoys firing someone. Even when they are completely incompetent at...
Read more >
Why do Bad Managers not get fired?
Poor manager often stunt their employees growth, thus preventing them from becoming real competition for the management job.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found