mirror of
				https://github.com/Kopano-dev/kopano-ol-extension.git
				synced 2023-10-10 11:37:40 +00:00 
			
		
		
		
	[KOE-67] Added offline check to periodic tasks
This commit is contained in:
		@@ -90,5 +90,7 @@ namespace Acacia.Stubs
 | 
				
			|||||||
        ISignatures GetSignatures();
 | 
					        ISignatures GetSignatures();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void InUI(Action action);
 | 
					        void InUI(Action action);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        bool IsOffline { get; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user