using System.Windows.Navigation;
using Caliburn.Micro;
using Caliburn.Micro.Logging;
+using Microsoft.Windows.Controls;
using Pithos.Client.WPF.Properties;
using Pithos.Core;
using Pithos.Network;
container.Compose(batch);
ConventionManager.AddElementConvention<MenuItem>(ItemsControl.ItemsSourceProperty, "DataContext", "Click");
+ ConventionManager.AddElementConvention<IntegerUpDown>(IntegerUpDown.ValueProperty, "Value", "ValueChanged");
}
protected override object GetInstance(Type serviceType, string key)
get { return _settings.ShowDesktopNotifications; }
set { _settings.ShowDesktopNotifications = value; }
}
+
+
+ public int PollingInterval
+ {
+ get { return _settings.PollingInterval; }
+ set
+ {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException();
+ _settings.PollingInterval = value;
+ }
+ }
/*
public override IEnumerable<string> GetDynamicMemberNames()
{
<TabItem.Header>
<StackPanel>
<Image Source="/Pithos.Client.WPF;component/Images/Advanced.png" Stretch="Uniform" Height="32"/>
- <TextBlock Text="Advanced"/>
+ <TextBlock Text="Advanced"/>
</StackPanel>
</TabItem.Header>
<StackPanel>
<CheckBox Content="Activate Shell Extensions" Height="16" HorizontalAlignment="Left" Margin="5" Name="ExtensionsActivated" VerticalAlignment="Top" />
<Button Content="Refresh Overlays" Name="RefreshOverlays" HorizontalAlignment="Left" Margin="5" Style="{StaticResource ButtonStyle}" Width="Auto" />
+ <TextBlock Text="Polling Interval (secs)" Margin="5"/>
+ <extToolkit:IntegerUpDown x:Name="Settings_PollingInterval" HorizontalAlignment="Left" Width="100" Margin="5,0" Watermark="Enter seconds" Minimum="10" />
</StackPanel>
</TabItem>
</TabControl>
this["Accounts"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("10")]
+ public int PollingInterval {
+ get {
+ return ((int)(this["PollingInterval"]));
+ }
+ set {
+ this["PollingInterval"] = value;
+ }
+ }
}
}
<Setting Name="Accounts" Type="Pithos.Interfaces.AccountsCollection" Scope="User">
<Value Profile="(Default)" />
</Setting>
+ <Setting Name="PollingInterval" Type="System.Int32" Scope="User">
+ <Value Profile="(Default)">10</Value>
+ </Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
</DataTemplate>
</MenuItem.ItemTemplate>
</MenuItem>
+ <MenuItem Header="Synch Now" x:Name="SynchNow"/>
<Separator />
<MenuItem Header="Usage" x:Name="Usages" ItemsSource="{Binding Accounts}">
<MenuItem.ItemTemplate>
_windowManager.ShowWindow(containerProperties);
}
+ public void SynchNow()
+ {}
+
public ObjectInfo RefreshObjectInfo(ObjectInfo currentInfo)
{
if (currentInfo==null)
<setting name="MustUpgrade" serializeAs="String">
<value>True</value>
</setting>
+ <setting name="PollingInterval" serializeAs="String">
+ <value>10</value>
+ </setting>
</Pithos.Client.WPF.Properties.Settings>
</userSettings>
<connectionStrings>
public bool ProxyAuthentication { get; set; }
public bool ExtensionsActivated { get; set; }
+ public int PollingInterval { get; set; }
+
public void Save()
{
private readonly ConcurrentBag<AccountInfo> _accounts = new ConcurrentBag<AccountInfo>();
+ [System.ComponentModel.Composition.Import]
+ public IPithosSettings Settings { get; set; }
private bool _firstPoll = true;
public void Start()
//Remote files are polled periodically. Any changes are processed
- public async Task ProcessRemoteFiles(DateTime? since = null)
+ public async Task PollRemoteFiles(DateTime? since = null)
{
- await TaskEx.Delay(TimeSpan.FromSeconds(10),_agent.CancellationToken);
+ await TaskEx.Delay(TimeSpan.FromSeconds(Settings.PollingInterval),_agent.CancellationToken);
using (log4net.ThreadContext.Stacks["Retrieve Remote"].Push("All accounts"))
{
await TaskEx.WhenAll(tasks.ToList());
_firstPoll = false;
- ProcessRemoteFiles(nextSince);
+ PollRemoteFiles(nextSince);
}
catch (Exception ex)
{
Log.ErrorFormat("Error while processing accounts\r\n{0}",ex);
//In case of failure retry with the same parameter
- ProcessRemoteFiles(since);
+ PollRemoteFiles(since);
}
ProcessTrashedFiles(accountInfo, realTrash);
- var cleanRemotes = from info in remoteObjects
+ var cleanRemotes = (from info in remoteObjects
//.Union(sharedObjects)
let name = info.Name
where !name.EndsWith(".ignore", StringComparison.InvariantCultureIgnoreCase) &&
!name.StartsWith(FolderConstants.CacheFolder + "/",
StringComparison.InvariantCultureIgnoreCase)
- select info;
+ select info).ToList();
-
+ ProcessDeletedFiles(accountInfo, cleanRemotes, pollTime);
//Create a list of actions from the remote files
var allActions = ObjectsToActions(accountInfo, cleanRemotes);
- ProcessDeletedFiles(accountInfo, cleanRemotes, pollTime);
+
//var relativePath = objectInfo.RelativeUrlToFilePath(accountInfo.UserName);
//And remove those that are already being processed by the agent
NetworkAgent.Start();
- NetworkAgent.ProcessRemoteFiles();
+ NetworkAgent.PollRemoteFiles();
}
//Make sure a hidden cache folder exists to store partial downloads
bool ExtensionsActivated { get; set; }
+ int PollingInterval { get; set; }
+
void Save();
void Reload();
}
public string ProxyPassword { get; set; }
public bool ProxyAuthentication { get; set; }
public bool ExtensionsActivated { get; set; }
+ public int PollingInterval { get; set; }
public PithosSettingsData()
{
ProxyPassword = other.ProxyPassword;
ProxyAuthentication = other.ProxyAuthentication;
ExtensionsActivated = other.ExtensionsActivated;
+ PollingInterval = other.PollingInterval;
}
public virtual void Save()
public bool ProxyAuthentication { get; set; }
public bool ExtensionsActivated { get; set; }
+
+ public int PollingInterval { get; set; }
+
public void Save()
{
get { return _settings.Value.ExtensionsActivated; }
set { _settings.Value.ExtensionsActivated = value; }
}
+
+ public int PollingInterval
+ {
+ get { return _settings.Value.PollingInterval; }
+ set { _settings.Value.PollingInterval = value; }
+ }
public void Save()
{
public bool ExtensionsActivated { get; set; }
+ public int PollingInterval { get; set; }
+
public bool ProxyAuthentication { get; set; }
public void Save()