Revision 049333d2
b/trunk/NetSparkle/NetSparkle.cs | ||
---|---|---|
5 | 5 |
using System.ComponentModel; |
6 | 6 |
using System.Threading; |
7 | 7 |
using System.Net; |
8 |
using System.Windows; |
|
8 | 9 |
using System.Windows.Forms; |
9 | 10 |
using System.Drawing; |
10 | 11 |
using System.Runtime.InteropServices; |
... | ... | |
12 | 13 |
using System.Diagnostics; |
13 | 14 |
using System.Security.Cryptography.X509Certificates; |
14 | 15 |
using System.Net.Security; |
16 |
using Point = System.Drawing.Point; |
|
15 | 17 |
|
16 | 18 |
namespace AppLimit.NetSparkle |
17 | 19 |
{ |
... | ... | |
437 | 439 |
/// <param name="currentItem"></param> |
438 | 440 |
public void ShowUpdateNeededUI(NetSparkleAppCastItem currentItem) |
439 | 441 |
{ |
442 |
|
|
440 | 443 |
// create the form |
441 | 444 |
NetSparkleForm frm = new NetSparkleForm(currentItem, ApplicationIcon, ApplicationWindowIcon); |
442 | 445 |
|
... | ... | |
445 | 448 |
|
446 | 449 |
if (HideReleaseNotes) |
447 | 450 |
frm.RemoveReleaseNotesControls(); |
451 |
|
|
448 | 452 |
|
449 | 453 |
// show it |
450 | 454 |
DialogResult dlgResult = frm.ShowDialog(); |
b/trunk/NetSparkle/NetSparkle2010.csproj | ||
---|---|---|
61 | 61 |
<AssemblyOriginatorKeyFile>pithos.snk</AssemblyOriginatorKeyFile> |
62 | 62 |
</PropertyGroup> |
63 | 63 |
<ItemGroup> |
64 |
<Reference Include="log4net"> |
|
65 |
<HintPath>..\Libraries\log4net.dll</HintPath> |
|
66 |
</Reference> |
|
67 |
<Reference Include="PresentationCore" /> |
|
68 |
<Reference Include="PresentationFramework" /> |
|
64 | 69 |
<Reference Include="System" /> |
65 | 70 |
<Reference Include="System.Core"> |
66 | 71 |
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
... | ... | |
68 | 73 |
<Reference Include="System.Drawing" /> |
69 | 74 |
<Reference Include="System.Management" /> |
70 | 75 |
<Reference Include="System.Windows.Forms" /> |
76 |
<Reference Include="System.Xaml" /> |
|
71 | 77 |
<Reference Include="System.Xml.Linq"> |
72 | 78 |
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
73 | 79 |
</Reference> |
... | ... | |
76 | 82 |
</Reference> |
77 | 83 |
<Reference Include="System.Data" /> |
78 | 84 |
<Reference Include="System.Xml" /> |
85 |
<Reference Include="WindowsBase" /> |
|
79 | 86 |
</ItemGroup> |
80 | 87 |
<ItemGroup> |
81 | 88 |
<Compile Include="AssemblyInfo.cs" /> |
b/trunk/NetSparkle/NetSparkleMainWindows.cs | ||
---|---|---|
4 | 4 |
using System.Data; |
5 | 5 |
using System.Drawing; |
6 | 6 |
using System.Linq; |
7 |
using System.Reflection; |
|
7 | 8 |
using System.Text; |
8 | 9 |
using System.Windows.Forms; |
9 | 10 |
using System.IO; |
11 |
using log4net; |
|
10 | 12 |
|
11 | 13 |
namespace AppLimit.NetSparkle |
12 | 14 |
{ |
13 | 15 |
public partial class NetSparkleMainWindows : Form, IDisposable |
14 | 16 |
{ |
15 |
private StreamWriter sw = null;
|
|
17 |
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
16 | 18 |
|
17 | 19 |
public NetSparkleMainWindows() |
18 | 20 |
{ |
19 | 21 |
// init ui |
20 | 22 |
InitializeComponent(); |
21 | 23 |
|
22 |
// init logfile |
|
23 |
sw = File.CreateText(Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "NetSparkle.log")); |
|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
public void Report(String message) |
... | ... | |
45 | 45 |
{ |
46 | 46 |
try |
47 | 47 |
{ |
48 |
// write |
|
49 |
sw.WriteLine(msg); |
|
50 |
|
|
51 |
// flush |
|
52 |
sw.Flush(); |
|
48 |
Log.Info(msg); |
|
53 | 49 |
} catch(Exception) |
54 | 50 |
{ |
55 | 51 |
|
... | ... | |
60 | 56 |
|
61 | 57 |
void IDisposable.Dispose() |
62 | 58 |
{ |
63 |
// flush again |
|
64 |
sw.Flush(); |
|
65 |
|
|
66 |
// close the stream |
|
67 |
sw.Dispose(); |
|
68 | 59 |
|
69 | 60 |
// close the base |
70 | 61 |
base.Dispose(); |
b/trunk/Pithos.Client.WPF/App.xaml.cs | ||
---|---|---|
75 | 75 |
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; |
76 | 76 |
TaskScheduler.UnobservedTaskException += OnUnobservedException; |
77 | 77 |
|
78 |
//_sparkle = new Sparkle(Settings.Default.UpdateUrl); |
|
79 |
//_sparkle.updateDetected += OnUpdateDetected; |
|
80 |
//_sparkle.ShowDiagnosticWindow = true; |
|
81 |
|
|
82 |
//Must delay opening the upgrade window |
|
83 |
//to avoid Windows Messages sent by the TaskbarIcon |
|
84 |
//TaskEx.Delay(5000).ContinueWith(_=>_sparkle.StartLoop(true,true),TaskScheduler.FromCurrentSynchronizationContext()); |
|
85 | 78 |
|
86 | 79 |
//Fix incorrect proxy settings by switching to default proxy, if the proxy server settings is empty |
87 | 80 |
if (Settings.Default.UseManualProxy && String.IsNullOrWhiteSpace(Settings.Default.ProxyServer)) |
b/trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs | ||
---|---|---|
120 | 120 |
|
121 | 121 |
public AccountsCollection Accounts |
122 | 122 |
{ |
123 |
get |
|
124 |
{ |
|
125 |
if (_settings.Accounts==null) |
|
126 |
_settings.Accounts=new AccountsCollection(); |
|
127 |
return _settings.Accounts; |
|
128 |
} |
|
123 |
get { return _settings.Accounts ?? (_settings.Accounts = new AccountsCollection()); } |
|
129 | 124 |
set { _settings.Accounts = value; } |
130 | 125 |
} |
131 | 126 |
|
... | ... | |
221 | 216 |
set { _settings.HashingParallelism = value; } |
222 | 217 |
} |
223 | 218 |
|
219 |
public string UpdateUrl |
|
220 |
{ |
|
221 |
get { return _settings.UpdateUrl; } |
|
222 |
} |
|
223 |
|
|
224 |
public bool UpdateDiagnostics |
|
225 |
{ |
|
226 |
get { return _settings.UpdateDiagnostics; } |
|
227 |
} |
|
228 |
|
|
229 |
public TimeSpan UpdateCheckInterval |
|
230 |
{ |
|
231 |
get { return _settings.UpdateCheckInterval; } |
|
232 |
} |
|
233 |
|
|
224 | 234 |
public void Save() |
225 | 235 |
{ |
226 | 236 |
_settings.Save(); |
b/trunk/Pithos.Client.WPF/Pithos.Client.WPF.csproj | ||
---|---|---|
469 | 469 |
<Project>{C45218F8-09E7-4F57-85BC-5D8D2AC736A3}</Project> |
470 | 470 |
<Name>ParallelExtensionsExtras</Name> |
471 | 471 |
</ProjectReference> |
472 |
<ProjectReference Include="..\NetSparkle\NetSparkle2010.csproj"> |
|
473 |
<Project>{74635A21-2BAD-4522-AB95-E3E5703CD301}</Project> |
|
474 |
<Name>NetSparkle2010</Name> |
|
475 |
</ProjectReference> |
|
472 | 476 |
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj"> |
473 | 477 |
<Project>{7AC63864-7638-41C4-969C-D3197EF2BED9}</Project> |
474 | 478 |
<Name>NotifyIconWpf</Name> |
b/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs | ||
---|---|---|
93 | 93 |
// You can specify all the values or you can default the Build and Revision Numbers |
94 | 94 |
// by using the '*' as shown below: |
95 | 95 |
// [assembly: AssemblyVersion("1.0.*")] |
96 |
[assembly: AssemblyVersion("0.7.0.0")]
|
|
96 |
[assembly: AssemblyVersion("0.7.20305.0")]
|
|
97 | 97 |
[assembly: AssemblyFileVersionAttribute("0.7.20305.0")] |
b/trunk/Pithos.Client.WPF/Properties/Settings.Designer.cs | ||
---|---|---|
322 | 322 |
[global::System.Configuration.ApplicationScopedSettingAttribute()] |
323 | 323 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
324 | 324 |
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] |
325 |
[global::System.Configuration.DefaultSettingValueAttribute("file:///E:/Projects/PITHOS/Source/Pithos/trunk/Pithos.AppCast/versioninfo.xml")]
|
|
325 |
[global::System.Configuration.DefaultSettingValueAttribute("https://github.com/pkanavos/PithosUpdateTest/raw/master/versioninfo.xml")]
|
|
326 | 326 |
public string UpdateUrl { |
327 | 327 |
get { |
328 | 328 |
return ((string)(this["UpdateUrl"])); |
329 | 329 |
} |
330 | 330 |
} |
331 |
|
|
332 |
[global::System.Configuration.UserScopedSettingAttribute()] |
|
333 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
|
334 |
[global::System.Configuration.DefaultSettingValueAttribute("False")] |
|
335 |
public bool UpdateDiagnostics { |
|
336 |
get { |
|
337 |
return ((bool)(this["UpdateDiagnostics"])); |
|
338 |
} |
|
339 |
set { |
|
340 |
this["UpdateDiagnostics"] = value; |
|
341 |
} |
|
342 |
} |
|
343 |
|
|
344 |
[global::System.Configuration.UserScopedSettingAttribute()] |
|
345 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
|
346 |
[global::System.Configuration.DefaultSettingValueAttribute("24.00:00:00")] |
|
347 |
public global::System.TimeSpan UpdateCheckInterval { |
|
348 |
get { |
|
349 |
return ((global::System.TimeSpan)(this["UpdateCheckInterval"])); |
|
350 |
} |
|
351 |
set { |
|
352 |
this["UpdateCheckInterval"] = value; |
|
353 |
} |
|
354 |
} |
|
331 | 355 |
} |
332 | 356 |
} |
b/trunk/Pithos.Client.WPF/Properties/Settings.settings | ||
---|---|---|
81 | 81 |
<Value Profile="(Default)">00:01:00</Value> |
82 | 82 |
</Setting> |
83 | 83 |
<Setting Name="UpdateUrl" Type="(Web Service URL)" Scope="Application"> |
84 |
<Value Profile="(Default)">file:///E:/Projects/PITHOS/Source/Pithos/trunk/Pithos.AppCast/versioninfo.xml</Value> |
|
84 |
<Value Profile="(Default)">https://github.com/pkanavos/PithosUpdateTest/raw/master/versioninfo.xml</Value> |
|
85 |
</Setting> |
|
86 |
<Setting Name="UpdateDiagnostics" Type="System.Boolean" Scope="User"> |
|
87 |
<Value Profile="(Default)">False</Value> |
|
88 |
</Setting> |
|
89 |
<Setting Name="UpdateCheckInterval" Type="System.TimeSpan" Scope="User"> |
|
90 |
<Value Profile="(Default)">24.00:00:00</Value> |
|
85 | 91 |
</Setting> |
86 | 92 |
</Settings> |
87 | 93 |
</SettingsFile> |
b/trunk/Pithos.Client.WPF/Shell/ShellView.xaml | ||
---|---|---|
102 | 102 |
<Image Source="/Pithos.Client.WPF;component/Images/About.ico" /> |
103 | 103 |
</MenuItem.Icon> |
104 | 104 |
</MenuItem> |
105 |
<MenuItem Header="Check For Upgrade" x:Name="CheckForUpgrade" cal:Message.Attach="CheckForUpgrade"/> |
|
105 | 106 |
<MenuItem x:Name="GoToSiteRootMenu" cal:Message.Attach="[Event MouseLeftButtonUp]=[Action GoToSite()]" |
106 | 107 |
cal:Action.TargetWithoutContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem, AncestorLevel=1}, Path=DataContext}" > |
107 | 108 |
<MenuItem.HeaderTemplate> |
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
50 | 50 |
using System.Threading.Tasks; |
51 | 51 |
using System.Windows; |
52 | 52 |
using System.Windows.Controls.Primitives; |
53 |
using AppLimit.NetSparkle; |
|
53 | 54 |
using Caliburn.Micro; |
54 | 55 |
using Hardcodet.Wpf.TaskbarNotification; |
55 | 56 |
using Pithos.Client.WPF.Configuration; |
... | ... | |
179 | 180 |
{ |
180 | 181 |
base.OnActivate(); |
181 | 182 |
|
182 |
|
|
183 |
_sparkle = new Sparkle(Settings.UpdateUrl); |
|
184 |
_sparkle.updateDetected += OnUpgradeDetected; |
|
185 |
_sparkle.ShowDiagnosticWindow = Settings.UpdateDiagnostics; |
|
186 |
|
|
187 |
//Must delay opening the upgrade window |
|
188 |
//to avoid Windows Messages sent by the TaskbarIcon |
|
189 |
TaskEx.Delay(5000).ContinueWith(_=> |
|
190 |
Execute.OnUIThread(()=> _sparkle.StartLoop(true,true,Settings.UpdateCheckInterval))); |
|
191 |
|
|
183 | 192 |
|
184 | 193 |
StartMonitoring(); |
185 | 194 |
} |
186 | 195 |
|
196 |
private void OnUpgradeDetected(object sender, UpdateDetectedEventArgs e) |
|
197 |
{ |
|
198 |
Log.InfoFormat("Update detected {0}",e.LatestVersion); |
|
199 |
} |
|
187 | 200 |
|
201 |
public void CheckForUpgrade() |
|
202 |
{ |
|
203 |
_sparkle.StopLoop(); |
|
204 |
_sparkle.Dispose(); |
|
205 |
_sparkle=new Sparkle(Settings.UpdateUrl); |
|
206 |
_sparkle.StartLoop(true,true,Settings.UpdateCheckInterval); |
|
207 |
} |
|
188 | 208 |
|
189 |
private async void StartMonitoring()
|
|
209 |
private async void StartMonitoring()
|
|
190 | 210 |
{ |
191 | 211 |
try |
192 | 212 |
{ |
... | ... | |
831 | 851 |
|
832 | 852 |
|
833 | 853 |
private bool _pollStarted; |
854 |
private Sparkle _sparkle; |
|
834 | 855 |
|
835 |
//SMELL: Doing so much work for notifications in the shell is wrong
|
|
856 |
//SMELL: Doing so much work for notifications in the shell is wrong
|
|
836 | 857 |
//The notifications should be moved to their own view/viewmodel pair |
837 | 858 |
//and different templates should be used for different message types |
838 | 859 |
//This will also allow the addition of extra functionality, eg. actions |
b/trunk/Pithos.Client.WPF/app.config | ||
---|---|---|
87 | 87 |
<setting name="StartupDelay" serializeAs="String"> |
88 | 88 |
<value>00:01:00</value> |
89 | 89 |
</setting> |
90 |
<setting name="UpdateDiagnostics" serializeAs="String"> |
|
91 |
<value>False</value> |
|
92 |
</setting> |
|
93 |
<setting name="UpdateCheckInterval" serializeAs="String"> |
|
94 |
<value>24.00:00:00</value> |
|
95 |
</setting> |
|
90 | 96 |
</Pithos.Client.WPF.Properties.Settings> |
91 | 97 |
</userSettings> |
92 | 98 |
<connectionStrings> |
... | ... | |
120 | 126 |
<value>https://pithos.dev.grnet.gr</value> |
121 | 127 |
</setting> |
122 | 128 |
<setting name="UpdateUrl" serializeAs="String"> |
123 |
<value>file:///E:/Projects/PITHOS/Source/Pithos/trunk/Pithos.AppCast/versioninfo.xml</value>
|
|
129 |
<value>https://github.com/pkanavos/PithosUpdateTest/raw/master/versioninfo.xml</value>
|
|
124 | 130 |
</setting> |
125 | 131 |
</Pithos.Client.WPF.Properties.Settings> |
126 | 132 |
</applicationSettings> |
Also available in: Unified diff