private void Explorer_SelectionChange() { try { if (ActiveFolderChange != null) { using (IFolder folder = _addIn.GetActiveExplorer()?.GetCurrentFolder()) { try { if (folder != null) { ActiveFolderChange(folder); } } catch (System.Exception e) { Logger.Instance.Error(this, "Exception in Explorer_SelectionChange.ActiveFolderChange: {0}", e); } } } // TODO: cache value? if (ZPushAccountChange != null) { try { ZPushAccountChange(CurrentZPushAccount()); } catch (System.Exception e) { Logger.Instance.Error(this, "Exception in Explorer_SelectionChange.ZPushAccountChange: {0}", e); } } } catch (System.Exception e) { Logger.Instance.Error(this, "Exception in Explorer_SelectionChange: {0}", e); } }
public ZPushWatcher(IAddIn addIn) { this._addIn = addIn; Sync = new ZPushSync(this, addIn); Accounts = new ZPushAccounts(this, addIn); // Need to keep a link to keep receiving events // Might be null when starting a compose window only _explorer = _addIn.GetActiveExplorer(); if (_explorer != null) { _explorer.SelectionChange += Explorer_SelectionChange; } }