예제 #1
0
        private async Task Callback(string sectionId)
        {
            if (string.IsNullOrEmpty(sectionId))
            {
                // cancelled
                return;
            }

            logger.Start($"..{command} {pageIds.Count} pages");

            try
            {
                using (var one = new OneNote())
                {
                    var service = new SearchServices(owner, one, sectionId);

                    switch (command)
                    {
                    case TaggedDialog.Commands.Index:
                        await service.IndexPages(pageIds);

                        break;

                    case TaggedDialog.Commands.Copy:
                        await service.CopyPages(pageIds);

                        break;

                    case TaggedDialog.Commands.Move:
                        await service.MovePages(pageIds);

                        break;
                    }
                }
            }
            catch (Exception exc)
            {
                logger.WriteLine(exc);
            }
            finally
            {
                logger.End();
            }
        }
예제 #2
0
        private async Task Callback(string sectionId)
        {
            if (string.IsNullOrEmpty(sectionId))
            {
                // cancelled
                return;
            }

            var action = copying ? "copying" : "moving";

            logger.Start($"..{action} {pageIds.Count} pages");

            try
            {
                using (var one = new OneNote())
                {
                    var service = new SearchServices(owner, one, sectionId);

                    if (copying)
                    {
                        await service.CopyPages(pageIds);
                    }
                    else
                    {
                        await service.MovePages(pageIds);
                    }
                }
            }
            catch (Exception exc)
            {
                logger.WriteLine(exc);
            }
            finally
            {
                logger.End();
            }
        }