Example #1
0
        private void menuImprtFolders_Click(object sender, RoutedEventArgs e)
        {
            dlgSaveFile.Filter          = "Folder|_Choose.Here_";
            dlgSaveFile.FileName        = "_Choose.Here_";
            dlgSaveFile.CheckFileExists = false;
            dlgSaveFile.Multiselect     = false;
            dlgSaveFile.ValidateNames   = false;
            dlgSaveFile.Title           = "Choose folder to import from:";

            if (dlgSaveFile.ShowDialog() == true)
            {
                Core.FileImporter fileImporter = new Core.FileImporter();

                var   DirPath    = new System.IO.FileInfo(dlgSaveFile.FileName).Directory.FullName;
                var   subFolders = cbSubfolders.IsChecked ?? false;
                float cutoff     = float.Parse(txtPageMaxWidth.Text);
                var   rtl        = rbRTL.IsChecked ?? false;
                var   numFix     = cbNumberFix.IsChecked ?? false;

                Func <System.IO.FileSystemInfo, object> orderFunc = (si) => si.CreationTime;
                if (rbByName.IsChecked ?? false)
                {
                    orderFunc = (si) => numFix?FileImporter.pad0AllNumbers(si.Name) : si.Name;
                }

                List <FileImporterError> importErrors = new List <FileImporterError>();
                winWorking.waitForTask(this, (updateFunc) =>
                {
                    return(fileImporter.getChapters(DirPath, subFolders, cutoff, rtl, orderFunc, importErrors, updateFunc));
                },
                                       isProgressKnwon: false)
                .ForEach(ch => mangaChapters.Add(MangaChapter.Extend <SelectableMangaChapter>(ch)));

                if (importErrors.Count > 0)
                {
                    (new dlgImportErrors()
                    {
                        DataErrors = importErrors
                    }).ShowDialog();
                }
                else
                {
                    StartWhiteRatioScan();
                }
            }
        }
Example #2
0
 private void mnuAddEmptyChapter_Click(object sender, RoutedEventArgs e)
 {
     Dialogs.dlgString dlgName = new Dialogs.dlgString()
     {
         Title      = "Enter name",
         Caption    = "Enter empty chapter title:",
         StringData = "Chapter Name"
     };
     if (dlgName.ShowDialog() ?? false)
     {
         mangaChapters.Add(MangaChapter.Extend <SelectableMangaChapter>(new Core.MangaChapter()
         {
             IsRTL = rbRTL.IsChecked ?? false,
             Pages = new ObservableCollection <Core.MangaPage>(),
             Name  = dlgName.StringData
         }));
     }
 }