Revision 2341c603 trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
123 | 123 |
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
124 | 124 |
|
125 | 125 |
private readonly PollAgent _pollAgent; |
126 |
private readonly NetworkAgent _networkAgent; |
|
126 | 127 |
|
127 | 128 |
|
128 | 129 |
private MiniStatusViewModel _miniStatus; |
... | ... | |
150 | 151 |
/// The PithosSettings class encapsulates the app's settings to abstract their storage mechanism (App settings, a database or registry) |
151 | 152 |
///</remarks> |
152 | 153 |
[ImportingConstructor] |
153 |
public ShellViewModel(IWindowManager windowManager, IEventAggregator events, IStatusChecker statusChecker, PithosSettings settings,PollAgent pollAgent) |
|
154 |
public ShellViewModel(IWindowManager windowManager, IEventAggregator events, IStatusChecker statusChecker, PithosSettings settings,PollAgent pollAgent,NetworkAgent networkAgent)
|
|
154 | 155 |
{ |
155 | 156 |
try |
156 | 157 |
{ |
... | ... | |
164 | 165 |
_events.Subscribe(this); |
165 | 166 |
|
166 | 167 |
_pollAgent = pollAgent; |
168 |
_networkAgent = networkAgent; |
|
167 | 169 |
Settings = settings; |
168 | 170 |
|
169 | 171 |
Proxy.SetFromSettings(settings); |
... | ... | |
461 | 463 |
|
462 | 464 |
#region Commands |
463 | 465 |
|
466 |
public void CancelCurrentOperation() |
|
467 |
{ |
|
468 |
_networkAgent.CancelCurrentOperation(); |
|
469 |
} |
|
470 |
|
|
464 | 471 |
public void ShowPreferences() |
465 | 472 |
{ |
466 | 473 |
ShowPreferences(null); |
... | ... | |
646 | 653 |
return newInfo; |
647 | 654 |
} |
648 | 655 |
|
656 |
private bool _isPaused; |
|
657 |
public bool IsPaused |
|
658 |
{ |
|
659 |
get { return _isPaused; } |
|
660 |
set |
|
661 |
{ |
|
662 |
_isPaused = value; |
|
663 |
PauseSyncCaption = IsPaused ? "Resume syncing" : "Pause syncing"; |
|
664 |
var iconKey = IsPaused ? "TraySyncPaused" : "TrayInSynch"; |
|
665 |
StatusIcon = String.Format(@"../Images/{0}.ico", iconKey); |
|
666 |
|
|
667 |
NotifyOfPropertyChange(() => IsPaused); |
|
668 |
} |
|
669 |
} |
|
649 | 670 |
|
650 |
public void ToggleSynching()
|
|
671 |
public void ToggleSynching()
|
|
651 | 672 |
{ |
652 |
bool isPaused=false;
|
|
653 |
foreach (var pair in Monitors)
|
|
673 |
IsPaused=!IsPaused;
|
|
674 |
foreach (var monitor in Monitors.Values)
|
|
654 | 675 |
{ |
655 |
var monitor = pair.Value; |
|
656 |
monitor.Pause = !monitor.Pause; |
|
657 |
isPaused = monitor.Pause; |
|
676 |
monitor.Pause = IsPaused ; |
|
658 | 677 |
} |
659 |
|
|
678 |
_pollAgent.Pause = IsPaused; |
|
679 |
_networkAgent.Pause = IsPaused; |
|
680 |
|
|
660 | 681 |
|
661 |
PauseSyncCaption = isPaused ? "Resume syncing" : "Pause syncing"; |
|
662 |
var iconKey = isPaused? "TraySyncPaused" : "TrayInSynch"; |
|
663 |
StatusIcon = String.Format(@"../Images/{0}.ico", iconKey); |
|
664 | 682 |
} |
665 | 683 |
|
666 | 684 |
public void ExitPithos() |
Also available in: Unified diff