コード例 #1
0
        /// <summary>
        /// エクスポートの開始
        /// </summary>
        /// <param name="author"></param>
        /// <param name="titles"></param>
        public bool StartExport(DB.Author author, IEnumerable <DB.Title> titles)
        {
            var ts = titles.ToList();

            if (ts.Count == 0)
            {
                throw new ExportTitleNotSelectedException();
            }
            else if ((ts.Count != 1) && (!AcceptMultipleTitle))
            {
                throw new ExporterNotAcceptMultiTitleException();
            }

            Progress.Report(0);

            var nowStr      = DateTime.Now.ToString("yyyy-mm-dd");
            var defaultName = $"{nowStr} {author.ID}.{DefaultExt}";

            var exportPath = (SelectorType == OutputPathSelectorType.File) ? getFileNameByDialog(defaultName) : getFolderNameByDialog();

            if (string.IsNullOrEmpty(exportPath))
            {
                //cancel return
                return(false);
            }

            bool ret = ExportExecute(author, ts, exportPath);

            Progress.Report(1);

            return(ret);
        }
コード例 #2
0
 /// <summary>
 /// エクスポート実作業
 /// </summary>
 /// <param name="author">誰の</param>
 /// <param name="titles">何を(author.Titlesのサブセット)</param>
 /// <param name="outPath">どこに</param>
 /// <returns></returns>
 protected abstract bool ExportExecute(DB.Author author, List <DB.Title> titles, string outPath);