Esempio n. 1
0
        /// <summary>
        /// Kindlegen Drop
        /// </summary>
        private void KindlegenDataGridDrop(object sender, DragEventArgs e)
        {
            // リストをクリア
            this.Vm.ClearData();

            // ドロップファイル一覧の取得
            var dropfiles = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            // 拡張子EPUBファイル一覧の取得
            string[] epubfiles = FileCollect.CollectEpubFiles(dropfiles);

            if (epubfiles == null || epubfiles.Length <= 0)
            {
                var a = LocalUtil.IsJapan ?
                        MessageBox.Show("EPUBファイルが見つかりませんでした", "EPUBファイル数チェック", MessageBoxButton.OK, MessageBoxImage.Warning) :
                        MessageBox.Show("EPUB file not found. Drop the file with the extension [.epub] ", "EPUB file check", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            if (System.IO.File.Exists(Settings.Default.KindlegenExePath) == false)
            {
                var msg = LocalUtil.IsJapan ?
                          "Kindlegen.exe が設定されていません。kindlegen をダウンロード&解凍し kindlegen.exe を指定してください。" :
                          "Kindlegen.exe is not set. Download and unzip kindlegen and specify kindlegen.exe.";

                MessageBox.Show(msg, "kindlegen check", MessageBoxButton.OK, MessageBoxImage.Question);
                return;
            }

            // パスでソート
            var sortedfiles = (from item in epubfiles
                               orderby item
                               select item).ToList();

            this.Vm.ItemCount = sortedfiles.Count;

            this.Vm.AddData(sortedfiles);
        }
Esempio n. 2
0
        /// <summary>
        /// ファイルをドロップ
        /// </summary>
        private void ListBoxDrop(object sender, DragEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(AceUtil.Version))
            {
                var a = LocalUtil.IsJapan ?
                        MessageBox.Show("Ace, by Daisy があなたのPCにインストールされていません。Ace, by Daisy環境を整えてください.", "Ace", MessageBoxButton.OK, MessageBoxImage.Warning) :
                        MessageBox.Show("Ace, check is not available. Ace(by Daisy) not found on your PC.  ", "Ace by Daisy", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            // リストをクリア
            this.Vm.ClearData();

            // ドロップファイル一覧の取得
            var dropfiles = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            // 拡張子EPUBファイル一覧の取得
            string[] epubfiles = FileCollect.CollectEpubFiles(dropfiles);

            if (epubfiles == null || epubfiles.Length <= 0)
            {
                var a = LocalUtil.IsJapan ?
                        MessageBox.Show("EPUBファイルが見つかりませんでした", "EPUBファイル数チェック", MessageBoxButton.OK, MessageBoxImage.Warning) :
                        MessageBox.Show("EPUB file not found. Drop [xxx.epub] file. ", "EPUB file check", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            this.Vm.ItemCount = epubfiles.Length;

            // パスでソートしてから登録
            var sortedfiles = (from item in epubfiles
                               orderby item
                               select item).ToList();

            this.Vm.AddData(sortedfiles);
        }