private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly PollAgent _pollAgent;
+ private readonly NetworkAgent _networkAgent;
private MiniStatusViewModel _miniStatus;
/// The PithosSettings class encapsulates the app's settings to abstract their storage mechanism (App settings, a database or registry)
///</remarks>
[ImportingConstructor]
- public ShellViewModel(IWindowManager windowManager, IEventAggregator events, IStatusChecker statusChecker, PithosSettings settings,PollAgent pollAgent)
+ public ShellViewModel(IWindowManager windowManager, IEventAggregator events, IStatusChecker statusChecker, PithosSettings settings,PollAgent pollAgent,NetworkAgent networkAgent)
{
try
{
_events.Subscribe(this);
_pollAgent = pollAgent;
+ _networkAgent = networkAgent;
Settings = settings;
Proxy.SetFromSettings(settings);
#region Commands
+ public void CancelCurrentOperation()
+ {
+ _networkAgent.CancelCurrentOperation();
+ }
+
public void ShowPreferences()
{
ShowPreferences(null);
return newInfo;
}
+ private bool _isPaused;
+ public bool IsPaused
+ {
+ get { return _isPaused; }
+ set
+ {
+ _isPaused = value;
+ PauseSyncCaption = IsPaused ? "Resume syncing" : "Pause syncing";
+ var iconKey = IsPaused ? "TraySyncPaused" : "TrayInSynch";
+ StatusIcon = String.Format(@"../Images/{0}.ico", iconKey);
+
+ NotifyOfPropertyChange(() => IsPaused);
+ }
+ }
- public void ToggleSynching()
+ public void ToggleSynching()
{
- bool isPaused=false;
- foreach (var pair in Monitors)
+ IsPaused=!IsPaused;
+ foreach (var monitor in Monitors.Values)
{
- var monitor = pair.Value;
- monitor.Pause = !monitor.Pause;
- isPaused = monitor.Pause;
+ monitor.Pause = IsPaused ;
}
-
+ _pollAgent.Pause = IsPaused;
+ _networkAgent.Pause = IsPaused;
+
- PauseSyncCaption = isPaused ? "Resume syncing" : "Pause syncing";
- var iconKey = isPaused? "TraySyncPaused" : "TrayInSynch";
- StatusIcon = String.Format(@"../Images/{0}.ico", iconKey);
}
public void ExitPithos()