1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[KOE-67] Added offline check to periodic tasks

This commit is contained in:
Patrick Simpson 2017-02-23 17:41:54 +01:00
parent ce6d62167f
commit c8a3c3e04b
3 changed files with 21 additions and 0 deletions

View File

@ -90,5 +90,7 @@ namespace Acacia.Stubs
ISignatures GetSignatures(); ISignatures GetSignatures();
void InUI(Action action); void InUI(Action action);
bool IsOffline { get; }
} }
} }

View File

@ -68,6 +68,22 @@ namespace Acacia.Stubs.OutlookWrappers
return new SignaturesWrapper(); return new SignaturesWrapper();
} }
public bool IsOffline
{
get
{
NSOutlook.NameSpace session = _app.Session;
try
{
return session.Offline;
}
finally
{
ComRelease.Release(session);
}
}
}
public void InUI(Action action) public void InUI(Action action)
{ {
Exception x = null; Exception x = null;

View File

@ -178,6 +178,9 @@ namespace Acacia.ZPush
/// </summary> /// </summary>
private void ExecuteTasks() private void ExecuteTasks()
{ {
if (ThisAddIn.Instance.IsOffline)
return;
foreach (ZPushAccount account in _watcher.Accounts.GetAccounts()) foreach (ZPushAccount account in _watcher.Accounts.GetAccounts())
ExecuteTasks(account); ExecuteTasks(account);
} }