Revision 133f83c2
b/trunk/Pithos.Client.WPF/AppBootstrapper.cs | ||
---|---|---|
3 | 3 |
using System.Windows.Navigation; |
4 | 4 |
using Caliburn.Micro; |
5 | 5 |
using Caliburn.Micro.Logging; |
6 |
using Microsoft.Windows.Controls; |
|
6 | 7 |
using Pithos.Client.WPF.Properties; |
7 | 8 |
using Pithos.Core; |
8 | 9 |
using Pithos.Network; |
... | ... | |
69 | 70 |
container.Compose(batch); |
70 | 71 |
|
71 | 72 |
ConventionManager.AddElementConvention<MenuItem>(ItemsControl.ItemsSourceProperty, "DataContext", "Click"); |
73 |
ConventionManager.AddElementConvention<IntegerUpDown>(IntegerUpDown.ValueProperty, "Value", "ValueChanged"); |
|
72 | 74 |
} |
73 | 75 |
|
74 | 76 |
protected override object GetInstance(Type serviceType, string key) |
b/trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs | ||
---|---|---|
168 | 168 |
get { return _settings.ShowDesktopNotifications; } |
169 | 169 |
set { _settings.ShowDesktopNotifications = value; } |
170 | 170 |
} |
171 |
|
|
172 |
|
|
173 |
public int PollingInterval |
|
174 |
{ |
|
175 |
get { return _settings.PollingInterval; } |
|
176 |
set |
|
177 |
{ |
|
178 |
if (value <= 0) |
|
179 |
throw new ArgumentOutOfRangeException(); |
|
180 |
_settings.PollingInterval = value; |
|
181 |
} |
|
182 |
} |
|
171 | 183 |
/* |
172 | 184 |
public override IEnumerable<string> GetDynamicMemberNames() |
173 | 185 |
{ |
b/trunk/Pithos.Client.WPF/Preferences/PreferencesView.xaml | ||
---|---|---|
172 | 172 |
<TabItem.Header> |
173 | 173 |
<StackPanel> |
174 | 174 |
<Image Source="/Pithos.Client.WPF;component/Images/Advanced.png" Stretch="Uniform" Height="32"/> |
175 |
<TextBlock Text="Advanced"/> |
|
175 |
<TextBlock Text="Advanced"/>
|
|
176 | 176 |
</StackPanel> |
177 | 177 |
</TabItem.Header> |
178 | 178 |
<StackPanel> |
179 | 179 |
<CheckBox Content="Activate Shell Extensions" Height="16" HorizontalAlignment="Left" Margin="5" Name="ExtensionsActivated" VerticalAlignment="Top" /> |
180 | 180 |
<Button Content="Refresh Overlays" Name="RefreshOverlays" HorizontalAlignment="Left" Margin="5" Style="{StaticResource ButtonStyle}" Width="Auto" /> |
181 |
<TextBlock Text="Polling Interval (secs)" Margin="5"/> |
|
182 |
<extToolkit:IntegerUpDown x:Name="Settings_PollingInterval" HorizontalAlignment="Left" Width="100" Margin="5,0" Watermark="Enter seconds" Minimum="10" /> |
|
181 | 183 |
</StackPanel> |
182 | 184 |
</TabItem> |
183 | 185 |
</TabControl> |
b/trunk/Pithos.Client.WPF/Properties/Settings.Designer.cs | ||
---|---|---|
270 | 270 |
this["Accounts"] = value; |
271 | 271 |
} |
272 | 272 |
} |
273 |
|
|
274 |
[global::System.Configuration.UserScopedSettingAttribute()] |
|
275 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
|
276 |
[global::System.Configuration.DefaultSettingValueAttribute("10")] |
|
277 |
public int PollingInterval { |
|
278 |
get { |
|
279 |
return ((int)(this["PollingInterval"])); |
|
280 |
} |
|
281 |
set { |
|
282 |
this["PollingInterval"] = value; |
|
283 |
} |
|
284 |
} |
|
273 | 285 |
} |
274 | 286 |
} |
b/trunk/Pithos.Client.WPF/Properties/Settings.settings | ||
---|---|---|
68 | 68 |
<Setting Name="Accounts" Type="Pithos.Interfaces.AccountsCollection" Scope="User"> |
69 | 69 |
<Value Profile="(Default)" /> |
70 | 70 |
</Setting> |
71 |
<Setting Name="PollingInterval" Type="System.Int32" Scope="User"> |
|
72 |
<Value Profile="(Default)">10</Value> |
|
73 |
</Setting> |
|
71 | 74 |
</Settings> |
72 | 75 |
</SettingsFile> |
b/trunk/Pithos.Client.WPF/Shell/ShellView.xaml | ||
---|---|---|
64 | 64 |
</DataTemplate> |
65 | 65 |
</MenuItem.ItemTemplate> |
66 | 66 |
</MenuItem> |
67 |
<MenuItem Header="Synch Now" x:Name="SynchNow"/> |
|
67 | 68 |
<Separator /> |
68 | 69 |
<MenuItem Header="Usage" x:Name="Usages" ItemsSource="{Binding Accounts}"> |
69 | 70 |
<MenuItem.ItemTemplate> |
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
404 | 404 |
_windowManager.ShowWindow(containerProperties); |
405 | 405 |
} |
406 | 406 |
|
407 |
public void SynchNow() |
|
408 |
{} |
|
409 |
|
|
407 | 410 |
public ObjectInfo RefreshObjectInfo(ObjectInfo currentInfo) |
408 | 411 |
{ |
409 | 412 |
if (currentInfo==null) |
b/trunk/Pithos.Client.WPF/app.config | ||
---|---|---|
75 | 75 |
<setting name="MustUpgrade" serializeAs="String"> |
76 | 76 |
<value>True</value> |
77 | 77 |
</setting> |
78 |
<setting name="PollingInterval" serializeAs="String"> |
|
79 |
<value>10</value> |
|
80 |
</setting> |
|
78 | 81 |
</Pithos.Client.WPF.Properties.Settings> |
79 | 82 |
</userSettings> |
80 | 83 |
<connectionStrings> |
b/trunk/Pithos.Core.Test/MockSettings.cs | ||
---|---|---|
36 | 36 |
public bool ProxyAuthentication { get; set; } |
37 | 37 |
public bool ExtensionsActivated { get; set; } |
38 | 38 |
|
39 |
public int PollingInterval { get; set; } |
|
40 |
|
|
39 | 41 |
|
40 | 42 |
public void Save() |
41 | 43 |
{ |
b/trunk/Pithos.Core/Agents/NetworkAgent.cs | ||
---|---|---|
76 | 76 |
|
77 | 77 |
private readonly ConcurrentBag<AccountInfo> _accounts = new ConcurrentBag<AccountInfo>(); |
78 | 78 |
|
79 |
[System.ComponentModel.Composition.Import] |
|
80 |
public IPithosSettings Settings { get; set; } |
|
79 | 81 |
|
80 | 82 |
private bool _firstPoll = true; |
81 | 83 |
public void Start() |
... | ... | |
431 | 433 |
|
432 | 434 |
|
433 | 435 |
//Remote files are polled periodically. Any changes are processed |
434 |
public async Task ProcessRemoteFiles(DateTime? since = null)
|
|
436 |
public async Task PollRemoteFiles(DateTime? since = null)
|
|
435 | 437 |
{ |
436 |
await TaskEx.Delay(TimeSpan.FromSeconds(10),_agent.CancellationToken);
|
|
438 |
await TaskEx.Delay(TimeSpan.FromSeconds(Settings.PollingInterval),_agent.CancellationToken);
|
|
437 | 439 |
|
438 | 440 |
using (log4net.ThreadContext.Stacks["Retrieve Remote"].Push("All accounts")) |
439 | 441 |
{ |
... | ... | |
450 | 452 |
await TaskEx.WhenAll(tasks.ToList()); |
451 | 453 |
|
452 | 454 |
_firstPoll = false; |
453 |
ProcessRemoteFiles(nextSince);
|
|
455 |
PollRemoteFiles(nextSince);
|
|
454 | 456 |
} |
455 | 457 |
catch (Exception ex) |
456 | 458 |
{ |
457 | 459 |
Log.ErrorFormat("Error while processing accounts\r\n{0}",ex); |
458 | 460 |
//In case of failure retry with the same parameter |
459 |
ProcessRemoteFiles(since);
|
|
461 |
PollRemoteFiles(since);
|
|
460 | 462 |
} |
461 | 463 |
|
462 | 464 |
|
... | ... | |
547 | 549 |
ProcessTrashedFiles(accountInfo, realTrash); |
548 | 550 |
|
549 | 551 |
|
550 |
var cleanRemotes = from info in remoteObjects |
|
552 |
var cleanRemotes = (from info in remoteObjects
|
|
551 | 553 |
//.Union(sharedObjects) |
552 | 554 |
let name = info.Name |
553 | 555 |
where !name.EndsWith(".ignore", StringComparison.InvariantCultureIgnoreCase) && |
554 | 556 |
!name.StartsWith(FolderConstants.CacheFolder + "/", |
555 | 557 |
StringComparison.InvariantCultureIgnoreCase) |
556 |
select info; |
|
558 |
select info).ToList();
|
|
557 | 559 |
|
558 | 560 |
|
559 |
|
|
560 | 561 |
|
562 |
ProcessDeletedFiles(accountInfo, cleanRemotes, pollTime); |
|
561 | 563 |
|
562 | 564 |
//Create a list of actions from the remote files |
563 | 565 |
var allActions = ObjectsToActions(accountInfo, cleanRemotes); |
564 | 566 |
|
565 |
ProcessDeletedFiles(accountInfo, cleanRemotes, pollTime); |
|
567 |
|
|
566 | 568 |
//var relativePath = objectInfo.RelativeUrlToFilePath(accountInfo.UserName); |
567 | 569 |
|
568 | 570 |
//And remove those that are already being processed by the agent |
b/trunk/Pithos.Core/PithosMonitor.cs | ||
---|---|---|
346 | 346 |
|
347 | 347 |
NetworkAgent.Start(); |
348 | 348 |
|
349 |
NetworkAgent.ProcessRemoteFiles();
|
|
349 |
NetworkAgent.PollRemoteFiles();
|
|
350 | 350 |
} |
351 | 351 |
|
352 | 352 |
//Make sure a hidden cache folder exists to store partial downloads |
b/trunk/Pithos.Interfaces/IPithosSettings.cs | ||
---|---|---|
35 | 35 |
|
36 | 36 |
bool ExtensionsActivated { get; set; } |
37 | 37 |
|
38 |
int PollingInterval { get; set; } |
|
39 |
|
|
38 | 40 |
void Save(); |
39 | 41 |
void Reload(); |
40 | 42 |
} |
b/trunk/Pithos.Interfaces/PithosSettingsData.cs | ||
---|---|---|
64 | 64 |
public string ProxyPassword { get; set; } |
65 | 65 |
public bool ProxyAuthentication { get; set; } |
66 | 66 |
public bool ExtensionsActivated { get; set; } |
67 |
public int PollingInterval { get; set; } |
|
67 | 68 |
|
68 | 69 |
public PithosSettingsData() |
69 | 70 |
{ |
... | ... | |
89 | 90 |
ProxyPassword = other.ProxyPassword; |
90 | 91 |
ProxyAuthentication = other.ProxyAuthentication; |
91 | 92 |
ExtensionsActivated = other.ExtensionsActivated; |
93 |
PollingInterval = other.PollingInterval; |
|
92 | 94 |
} |
93 | 95 |
|
94 | 96 |
public virtual void Save() |
b/trunk/Pithos.ShellExtensions.Test/TestPithosSettings.cs | ||
---|---|---|
49 | 49 |
public bool ProxyAuthentication { get; set; } |
50 | 50 |
|
51 | 51 |
public bool ExtensionsActivated { get; set; } |
52 |
|
|
53 |
public int PollingInterval { get; set; } |
|
54 |
|
|
52 | 55 |
public void Save() |
53 | 56 |
{ |
54 | 57 |
|
b/trunk/Pithos.ShellExtensions/ShellSettings.cs | ||
---|---|---|
155 | 155 |
get { return _settings.Value.ExtensionsActivated; } |
156 | 156 |
set { _settings.Value.ExtensionsActivated = value; } |
157 | 157 |
} |
158 |
|
|
159 |
public int PollingInterval |
|
160 |
{ |
|
161 |
get { return _settings.Value.PollingInterval; } |
|
162 |
set { _settings.Value.PollingInterval = value; } |
|
163 |
} |
|
158 | 164 |
public void Save() |
159 | 165 |
{ |
160 | 166 |
|
b/trunk/Pithos.ShellExtensions/TestPithosSettings.cs | ||
---|---|---|
48 | 48 |
|
49 | 49 |
public bool ExtensionsActivated { get; set; } |
50 | 50 |
|
51 |
public int PollingInterval { get; set; } |
|
52 |
|
|
51 | 53 |
|
52 | 54 |
public bool ProxyAuthentication { get; set; } |
53 | 55 |
public void Save() |
Also available in: Unified diff