public List <Tuple <string, string, bool> > RemovePages(List <Tuple <string, string> > pagesBeingRemoved, IProgress <Tuple <int, int, int, string> > progress, System.Threading.CancellationToken cancellationToken)
        {
            int countRemoved        = 0;
            int countFailedToRemove = 0;
            int countTotal          = pagesBeingRemoved.Count;
            List <Tuple <string, string, bool> > ret = new List <Tuple <string, string, bool> >();

            foreach (Tuple <string, string> elem in pagesBeingRemoved)
            {
                if (cancellationToken.IsCancellationRequested)
                {
                    OnCancelled.Invoke();
                    break;
                }
                if (onenoteApplication.TryDeleteHierarchy(elem.Item1))
                {
                    countRemoved += 1;
                    ret.Add(Tuple.Create(elem.Item1, elem.Item2, true));
                }
                else
                {
                    countFailedToRemove += 1;
                    ret.Add(Tuple.Create(elem.Item1, elem.Item2, false));
                }
                progress.Report(Tuple.Create(countRemoved, countFailedToRemove, countTotal, elem.Item2));
            }
            return(ret);
        }
Пример #2
0
        public bool RemovePage(string pageId)
        {
            bool success = onenoteApplication.TryDeleteHierarchy(pageId);

            if (!success)
            {
                etc.LoggerHelper.LogWarn("Remove failed. pageId:{0}", pageId);
            }
            return(success);
        }