public BulkUploadProgressDlg() { InitializeComponent(); Progress = new LogBox(); Progress.Dock = DockStyle.Fill; Controls.Add(Progress); }
/// <summary> /// Common routine used in normal upload and bulk upload. /// </summary> /// <param name="book"></param> /// <param name="progressBox"></param> /// <param name="publishView"></param> /// <param name="parseId"></param> /// <param name="languages"></param> /// <param name="invokeTarget"></param> /// <returns></returns> internal string FullUpload(Book.Book book, LogBox progressBox, PublishView publishView, string[] languages, out string parseId, Form invokeTarget = null) { var bookFolder = book.FolderPath; parseId = ""; // in case of early return // Set this in the metadata so it gets uploaded. Do this in the background task as it can take some time. // These bits of data can't easily be set while saving the book because we save one page at a time // and they apply to the book as a whole. book.BookInfo.LanguageTableReferences = _parseClient.GetLanguagePointers(book.CollectionSettings.MakeLanguageUploadData(languages)); book.BookInfo.PageCount = book.GetPages().Count(); book.BookInfo.Save(); progressBox.WriteStatus(LocalizationManager.GetString("PublishTab.Upload.MakingThumbnail", "Making thumbnail image...")); //the largest thumbnail I found on Amazon was 300px high. Prathambooks.org about the same. _thumbnailer.MakeThumbnailOfCover(book, 70, invokeTarget); // this is a sacrificial one to prime the pump, to fix BL-2673 _thumbnailer.MakeThumbnailOfCover(book, 70, invokeTarget); if (progressBox.CancelRequested) return ""; _thumbnailer.MakeThumbnailOfCover(book, 256, invokeTarget); if (progressBox.CancelRequested) return ""; // It is possible the user never went back to the Collection tab after creating/updating the book, in which case // the 'normal' thumbnail never got created/updating. See http://issues.bloomlibrary.org/youtrack/issue/BL-3469. _thumbnailer.MakeThumbnailOfCover(book, invokeTarget); if (progressBox.CancelRequested) return ""; var uploadPdfPath = UploadPdfPath(bookFolder); // If there is not already a locked preview in the book folder // (which we take to mean the user has created a customized one that he prefers), // make sure we have a current correct preview and then copy it to the book folder so it gets uploaded. if (!FileUtils.IsFileLocked(uploadPdfPath)) { progressBox.WriteStatus(LocalizationManager.GetString("PublishTab.Upload.MakingPdf", "Making PDF Preview...")); publishView.MakePublishPreview(); if (RobustFile.Exists(publishView.PdfPreviewPath)) { RobustFile.Copy(publishView.PdfPreviewPath, uploadPdfPath, true); } } if (progressBox.CancelRequested) return ""; return UploadBook(bookFolder, progressBox, out parseId, Path.GetFileName(uploadPdfPath)); }
/// <summary> /// Make folder-browsing controls invisible, and add in some progress controls for the MakeClone procedure: /// </summary> private void SwitchControlsForCloning() { panel.Visible = false; progressBar.Visible = false; var logBox = new LogBox { Location = new Point(panel.Location.X, panel.Location.Y + 50), Width = panel.Width, Height = panel.Height - 50, Anchor = panel.Anchor, ShowCopyToClipboardMenuItem = true, ShowDetailsMenuItem = true, ShowDiagnosticsMenuItem = true, ShowFontMenuItem = true }; var progressIndicator = new SimpleProgressIndicator { Location = new Point(panel.Location.X, panel.Location.Y + 35), Width = panel.Width, Height = 10, Style = ProgressBarStyle.Marquee, Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top, MarqueeAnimationSpeed = 50 }; #if MONO progressIndicator.MarqueeAnimationSpeed = 3000; #else #endif progressIndicator.IndicateUnknownProgress(); _clonerStatusLabel = new TextBox { Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right, BackColor = SystemColors.Control, BorderStyle = BorderStyle.None, Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((0))), Location = panel.Location, Multiline = true, Name = "_clonerStatusLabel", ReadOnly = true, Size = new Size(panel.Width, 25) }; Controls.Add(logBox); Controls.Add(progressIndicator); Controls.Add(_clonerStatusLabel); _clonerMultiProgess = new MultiProgress(); _clonerMultiProgess.AddMessageProgress(logBox); logBox.ProgressIndicator = progressIndicator; _clonerMultiProgess.ProgressIndicator = progressIndicator; _clonerStatusLabel.Text = string.Format(LocalizationManager.GetString("Messages.Getting","Getting {0}..."),RepositoryKindLabel); }