Beispiel #1
0
        public ICollection <SharedFolder> GetCurrentShares(CancellationToken?cancel)
        {
            // Fetch the shares
            ICollection <SharedFolder> shares = _api.GetCurrentShares(cancel);

            if (_feature.Reminders)
            {
                // Make sure reminders are disabled as soon as possible
                UpdateReminders(shares);

                // Remove any reminders from the shares that are not wanted, they are stale
                ((RemindersQueryFolders)OpenQuery())?.RemoveStaleReminders(
                    shares
                    .Where(x => x.IsSynced && x.SyncType.IsAppointment() && x.FlagCalendarReminders)
                    .Select(x => x.SyncId)
                    );
            }

            // Patch in the send-as addresses
            foreach (SharedFolder folder in shares)
            {
                if (folder.FlagSendAsOwner && string.IsNullOrWhiteSpace(folder.SendAsAddress))
                {
                    folder.SendAsAddress = ThisAddIn.Instance.GetFeature <FeatureSendAs>()?.FindSendAsAddress(_account, folder);
                }
            }

            // Commit changes
            if (_query != null)
            {
                _query.Commit();
            }

            return(shares);
        }
Beispiel #2
0
        public ICollection <SharedFolder> GetCurrentShares(CancellationToken?cancel)
        {
            // Fetch the shares
            ICollection <SharedFolder> shares = _api.GetCurrentShares(cancel);

            if (_feature.Reminders)
            {
                // Make sure reminders are disabled as soon as possible
                UpdateReminders(shares);

                // Remove any reminders from the shares that are not wanted, they are stale
                OpenQuery()?.RemoveStaleReminders(
                    shares
                    .Where(x => x.IsSynced && x.SyncType.IsAppointment() && x.FlagCalendarReminders)
                    .Select(x => x.SyncId)
                    );
            }

            // Commit changes
            if (_query != null)
            {
                _query.Commit();
            }

            return(shares);
        }