Skip to content

Commit a3d82c7

Browse files
committed
Prioritize Excel run over autoupdater.
1 parent 84d741d commit a3d82c7

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

AnalyzeInExcel/App.xaml.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
using CommandLine;
22
using System;
3-
using System.Collections.Generic;
4-
using System.Configuration;
53
using System.Data;
64
using System.Linq;
75
using System.Windows;
86
using System.Diagnostics;
97
using AutoUpdaterDotNET;
10-
using System.Linq.Expressions;
118

129
namespace AnalyzeInExcel
1310
{
@@ -17,15 +14,20 @@ namespace AnalyzeInExcel
1714
public partial class App : Application
1815
{
1916
public Options AppOptions;
20-
protected override void OnStartup(StartupEventArgs e)
17+
18+
public void CheckUpdates(bool synchronous = true)
2119
{
2220
AutoUpdater.HttpUserAgent = "AutoUpdater";
2321
AutoUpdater.ShowSkipButton = true;
2422
AutoUpdater.ShowRemindLaterButton = true;
2523
AutoUpdater.LetUserSelectRemindLater = true;
26-
AutoUpdater.Synchronous = true;
27-
AutoUpdater.Start("https://cdn.sqlbi.com/updates/AnalyzeInExcelAutoUpdater.xml");
24+
AutoUpdater.Synchronous = synchronous;
25+
// The random number guarantees that the web client cache is not used (it is applied often even though internally the policy is disabled)
26+
AutoUpdater.Start($@"https://cdn.sqlbi.com/updates/AnalyzeInExcelAutoUpdater.xml?random={new Random().Next()}");
27+
}
2828

29+
protected override void OnStartup(StartupEventArgs e)
30+
{
2931
// Read configuration
3032
var result = Parser.Default.ParseArguments<Options>(e.Args)
3133
.WithNotParsed(errors => MessageBox.Show("Invalid configuration, check the pbitool.json file\n" + String.Join(";", from err in errors select err.ToString())))
@@ -56,6 +58,8 @@ protected override void OnStartup(StartupEventArgs e)
5658
tc.TrackEvent("Run Excel");
5759
p.Start();
5860
tc.Flush();
61+
// Check updates synchronously when Excel starts, no wait for Excel
62+
CheckUpdates(true);
5963
this.Shutdown(0);
6064
}
6165
catch (Exception ex)
@@ -71,6 +75,9 @@ protected override void OnStartup(StartupEventArgs e)
7175
tc.Flush();
7276
}
7377

78+
// Check updates asynchronously when there is an error, while displaying the diagnostic message
79+
CheckUpdates(false);
80+
7481
//// start application window
7582
MainWindow mw = new MainWindow();
7683
mw.diagnosticInfo.Content = $@"Current configuration

AnalyzeInExcel/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.0.0.0")]
55-
[assembly: AssemblyFileVersion("1.0.0.0")]
54+
[assembly: AssemblyVersion("0.9.9.0")]
55+
[assembly: AssemblyFileVersion("0.9.9.0")]

0 commit comments

Comments
 (0)