Skip to content

Commit

Permalink
Fix bug where StartLoop could run multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
Deadpikle committed Jun 4, 2020
1 parent 1b9a435 commit a0df0c7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ _sparkle = new SparkleUpdater(
) {
UIFactory = new NetSparkleUpdater.UI.WPF.UIFactory(icon) // or null or choose some other UI factory or build your own!
};
_sparkle.StartLoop(true); // `true` to run an initial check online
_sparkle.StartLoop(true); // `true` to run an initial check online -- only call StartLoop once for a given SparkleUpdater instance!
```

On the first Application.Idle event, your App Cast XML file will be downloaded, read, and compared to the currently running version. If it has a software update inside, the user will be notified with a little toast notification (if supported by the UI and enabled) or with an update dialog containing your release notes. The user can then ignore the update, ask to be reminded later, or download/install it now.
Expand Down
2 changes: 1 addition & 1 deletion nuget/tools/NetSparkleUpdater.Tools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>NetSparkleUpdater.Tools</id>
<title>NetSparkleUpdater Tools</title>
<version>2.0.0-preview20200514006</version>
<version>2.0.0-preview20200604001</version>
<authors>Deadpikle, Dirk Eisenberg</authors>
<owners>Deadpikle</owners>
<license type="file">LICENSE.md</license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>NetSparkleUpdater.UI.WinForms.NetFramework</id>
<title>NetSparkleUpdater WinForms .NET Framework UI</title>
<version>2.0.0-preview20200514006</version>
<version>2.0.0-preview20200604001</version>
<authors>Deadpikle, Dirk Eisenberg</authors>
<owners>Deadpikle</owners>
<license type="file">LICENSE.md</license>
Expand All @@ -19,7 +19,7 @@
<releaseNotes>2.0 Beta: See https://github.com/NetSparkleUpdater/NetSparkle for all beta information and to file issues/pull requests for and ask questions about this project.</releaseNotes>
<dependencies>
<group targetFramework=".NETFramework4.5.1">
<dependency id="NetSparkle.New" version="2.0.0-preview20200514006" exclude="Build,Analyzers" />
<dependency id="NetSparkle.New" version="2.0.0-preview20200604001" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion src/NetSparkle.UI.Avalonia/NetSparkle.UI.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>NetSparkleUpdater.UI.Avalonia</PackageId>
<Version>2.0.0-preview20200514006</Version>
<Version>2.0.0-preview20200604001</Version>
<Authors>Deadpikle</Authors>
<Company>Deadpikle</Company>
<Product>NetSparkleUpdater.UI.Avalonia</Product>
Expand Down
2 changes: 1 addition & 1 deletion src/NetSparkle.UI.WPF/NetSparkle.UI.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RepositoryUrl>https://github.com/NetSparkleUpdater/NetSparkle.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<Version>2.0.0-preview20200514006</Version>
<Version>2.0.0-preview20200604001</Version>
<PackageIcon>software-update-available.png</PackageIcon>
<PackageIconUrl />
<Description>NetSparkleUpdater/NetSparkle app updater framework with built-in WPF .NET Core UI. NetSparkleUpdater/NetSparkle is a C# .NET software update framework that allows you to easily download installer files and update your C# .NET Framework or .NET Core software. Built-in UIs are available for WinForms, WPF, and Avalonia. You provide, somewhere on the internet, an XML appcast with software version information along with release notes in Markdown or HTML format. The NetSparkle framework then checks for an update in the background, displays the release notes to the user, and lets users download or skip the software update. The framework can also perform silent downloads so that you can present all of the UI yourself or set up your own silent software update system, as allowed by your software architecture. It was inspired by the Sparkle (https://sparkle-project.org/) project for Cocoa developers and the WinSparkle (https://winsparkle.org/) project (a Win32 port).</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Copyright>Copyright © 2020</Copyright>
<OutputPath>..\bin\$(Configuration)\NetSparkle.UI.WinForms\</OutputPath>
<PackageId>NetSparkleUpdater.UI.WinForms.NetCore</PackageId>
<Version>2.0.0-preview20200514006</Version>
<Version>2.0.0-preview20200604001</Version>
<Authors>Deadpikle</Authors>
<Company>Deadpikle</Company>
<Description>NetSparkleUpdater/NetSparkle app updater framework with built-in WinForms .NET Core UI. NetSparkleUpdater/NetSparkle is a C# .NET software update framework that allows you to easily download installer files and update your C# .NET Framework or .NET Core software. Built-in UIs are available for WinForms, WPF, and Avalonia. You provide, somewhere on the internet, an XML appcast with software version information along with release notes in Markdown or HTML format. The NetSparkle framework then checks for an update in the background, displays the release notes to the user, and lets users download or skip the software update. The framework can also perform silent downloads so that you can present all of the UI yourself or set up your own silent software update system, as allowed by your software architecture. It was inspired by the Sparkle (https://sparkle-project.org/) project for Cocoa developers and the WinSparkle (https://winsparkle.org/) project (a Win32 port).</Description>
Expand Down
7 changes: 6 additions & 1 deletion src/NetSparkle/NetSparkle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,12 @@ public async void StartLoop(bool doInitialCheck, bool forceInitialCheck, TimeSpa
// start the work
//var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
//_taskWorker.Start(scheduler);
_taskWorker.Start();
// don't allow starting the task 2x
if (_taskWorker.IsCompleted == false && _taskWorker.Status != TaskStatus.Running &&
_taskWorker.Status != TaskStatus.WaitingToRun && _taskWorker.Status != TaskStatus.WaitingForActivation)
{
_taskWorker.Start();
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/NetSparkle/NetSparkle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>NetSparkle.New</PackageId>
<Version>2.0.0-preview20200514006</Version>
<Version>2.0.0-preview20200604001</Version>
<Authors>Deadpikle, Dirk Eisenberg</Authors>
<Description>NetSparkleUpdater/NetSparkle is a C# .NET software update framework that allows you to easily download installer files and update your C# .NET Framework or .NET Core software. Built-in UIs are available for WinForms, WPF, and Avalonia. You provide, somewhere on the internet, an XML appcast with software version information along with release notes in Markdown or HTML format. The NetSparkle framework then checks for an update in the background, displays the release notes to the user, and lets users download or skip the software update. The framework can also perform silent downloads so that you can present all of the UI yourself or set up your own silent software update system, as allowed by your software architecture. It was inspired by the Sparkle (https://sparkle-project.org/) project for Cocoa developers and the WinSparkle (https://winsparkle.org/) project (a Win32 port).</Description>
<Copyright>Copyright 2010 - 2020</Copyright>
Expand Down

0 comments on commit a0df0c7

Please sign in to comment.