diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj
index bd81c98f..adda89af 100644
--- a/LibationLauncher/LibationLauncher.csproj
+++ b/LibationLauncher/LibationLauncher.csproj
@@ -13,7 +13,7 @@
win-x64
- 5.5.1.1
+ 5.5.1.3
diff --git a/LibationWinForms/Dialogs/BookDetailsDialog.Designer.cs b/LibationWinForms/Dialogs/BookDetailsDialog.Designer.cs
index 2022c1bb..db8a63d1 100644
--- a/LibationWinForms/Dialogs/BookDetailsDialog.Designer.cs
+++ b/LibationWinForms/Dialogs/BookDetailsDialog.Designer.cs
@@ -30,19 +30,26 @@
{
this.saveBtn = new System.Windows.Forms.Button();
this.newTagsTb = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
+ this.tagsDescLbl = new System.Windows.Forms.Label();
this.coverPb = new System.Windows.Forms.PictureBox();
this.detailsTb = new System.Windows.Forms.TextBox();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.tagsGb = new System.Windows.Forms.GroupBox();
this.cancelBtn = new System.Windows.Forms.Button();
+ this.liberatedGb = new System.Windows.Forms.GroupBox();
+ this.pdfLiberatedCb = new System.Windows.Forms.ComboBox();
+ this.pdfLiberatedLbl = new System.Windows.Forms.Label();
+ this.bookLiberatedCb = new System.Windows.Forms.ComboBox();
+ this.bookLiberatedLbl = new System.Windows.Forms.Label();
+ this.liberatedDescLbl = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.coverPb)).BeginInit();
- this.groupBox1.SuspendLayout();
+ this.tagsGb.SuspendLayout();
+ this.liberatedGb.SuspendLayout();
this.SuspendLayout();
//
// saveBtn
//
this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.saveBtn.Location = new System.Drawing.Point(481, 247);
+ this.saveBtn.Location = new System.Drawing.Point(376, 427);
this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(88, 27);
@@ -59,18 +66,18 @@
this.newTagsTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.newTagsTb.Name = "newTagsTb";
this.newTagsTb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
- this.newTagsTb.Size = new System.Drawing.Size(661, 23);
+ this.newTagsTb.Size = new System.Drawing.Size(556, 23);
this.newTagsTb.TabIndex = 1;
//
- // label1
+ // tagsDescLbl
//
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(7, 19);
- this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(458, 15);
- this.label1.TabIndex = 0;
- this.label1.Text = "Tags are separated by a space. Each tag can contain letters, numbers, and undersc" +
+ this.tagsDescLbl.AutoSize = true;
+ this.tagsDescLbl.Location = new System.Drawing.Point(7, 19);
+ this.tagsDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.tagsDescLbl.Name = "tagsDescLbl";
+ this.tagsDescLbl.Size = new System.Drawing.Size(458, 15);
+ this.tagsDescLbl.TabIndex = 0;
+ this.tagsDescLbl.Text = "Tags are separated by a space. Each tag can contain letters, numbers, and undersc" +
"ores";
//
// coverPb
@@ -83,39 +90,102 @@
//
// detailsTb
//
- this.detailsTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.detailsTb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.detailsTb.Location = new System.Drawing.Point(98, 12);
this.detailsTb.Multiline = true;
this.detailsTb.Name = "detailsTb";
this.detailsTb.ReadOnly = true;
this.detailsTb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
- this.detailsTb.Size = new System.Drawing.Size(589, 151);
+ this.detailsTb.Size = new System.Drawing.Size(484, 202);
this.detailsTb.TabIndex = 0;
//
- // groupBox1
+ // tagsGb
//
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.tagsGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.newTagsTb);
- this.groupBox1.Location = new System.Drawing.Point(12, 169);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(675, 73);
- this.groupBox1.TabIndex = 1;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Edit Tags";
+ this.tagsGb.Controls.Add(this.tagsDescLbl);
+ this.tagsGb.Controls.Add(this.newTagsTb);
+ this.tagsGb.Location = new System.Drawing.Point(12, 220);
+ this.tagsGb.Name = "tagsGb";
+ this.tagsGb.Size = new System.Drawing.Size(570, 73);
+ this.tagsGb.TabIndex = 1;
+ this.tagsGb.TabStop = false;
+ this.tagsGb.Text = "Edit Tags";
//
// cancelBtn
//
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.cancelBtn.Location = new System.Drawing.Point(599, 247);
+ this.cancelBtn.Location = new System.Drawing.Point(494, 427);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(88, 27);
this.cancelBtn.TabIndex = 4;
this.cancelBtn.Text = "Cancel";
this.cancelBtn.UseVisualStyleBackColor = true;
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
+ //
+ // liberatedGb
+ //
+ this.liberatedGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.liberatedGb.Controls.Add(this.pdfLiberatedCb);
+ this.liberatedGb.Controls.Add(this.pdfLiberatedLbl);
+ this.liberatedGb.Controls.Add(this.bookLiberatedCb);
+ this.liberatedGb.Controls.Add(this.bookLiberatedLbl);
+ this.liberatedGb.Controls.Add(this.liberatedDescLbl);
+ this.liberatedGb.Location = new System.Drawing.Point(12, 299);
+ this.liberatedGb.Name = "liberatedGb";
+ this.liberatedGb.Size = new System.Drawing.Size(570, 122);
+ this.liberatedGb.TabIndex = 2;
+ this.liberatedGb.TabStop = false;
+ this.liberatedGb.Text = "Liberated status: Whether the book/pdf has been downloaded";
+ //
+ // pdfLiberatedCb
+ //
+ this.pdfLiberatedCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.pdfLiberatedCb.FormattingEnabled = true;
+ this.pdfLiberatedCb.Location = new System.Drawing.Point(244, 86);
+ this.pdfLiberatedCb.Name = "pdfLiberatedCb";
+ this.pdfLiberatedCb.Size = new System.Drawing.Size(121, 23);
+ this.pdfLiberatedCb.TabIndex = 4;
+ //
+ // pdfLiberatedLbl
+ //
+ this.pdfLiberatedLbl.AutoSize = true;
+ this.pdfLiberatedLbl.Location = new System.Drawing.Point(210, 89);
+ this.pdfLiberatedLbl.Name = "pdfLiberatedLbl";
+ this.pdfLiberatedLbl.Size = new System.Drawing.Size(28, 15);
+ this.pdfLiberatedLbl.TabIndex = 3;
+ this.pdfLiberatedLbl.Text = "PDF";
+ //
+ // bookLiberatedCb
+ //
+ this.bookLiberatedCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.bookLiberatedCb.FormattingEnabled = true;
+ this.bookLiberatedCb.Location = new System.Drawing.Point(47, 86);
+ this.bookLiberatedCb.Name = "bookLiberatedCb";
+ this.bookLiberatedCb.Size = new System.Drawing.Size(121, 23);
+ this.bookLiberatedCb.TabIndex = 2;
+ //
+ // bookLiberatedLbl
+ //
+ this.bookLiberatedLbl.AutoSize = true;
+ this.bookLiberatedLbl.Location = new System.Drawing.Point(7, 89);
+ this.bookLiberatedLbl.Name = "bookLiberatedLbl";
+ this.bookLiberatedLbl.Size = new System.Drawing.Size(34, 15);
+ this.bookLiberatedLbl.TabIndex = 1;
+ this.bookLiberatedLbl.Text = "Book";
+ //
+ // liberatedDescLbl
+ //
+ this.liberatedDescLbl.AutoSize = true;
+ this.liberatedDescLbl.Location = new System.Drawing.Point(20, 31);
+ this.liberatedDescLbl.Name = "liberatedDescLbl";
+ this.liberatedDescLbl.Size = new System.Drawing.Size(312, 30);
+ this.liberatedDescLbl.TabIndex = 0;
+ this.liberatedDescLbl.Text = "To download again next time: change to Not Downloaded\r\nTo not download: change to" +
+ " Downloaded";
//
// BookDetailsDialog
//
@@ -123,9 +193,10 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelBtn;
- this.ClientSize = new System.Drawing.Size(699, 286);
+ this.ClientSize = new System.Drawing.Size(594, 466);
+ this.Controls.Add(this.liberatedGb);
this.Controls.Add(this.cancelBtn);
- this.Controls.Add(this.groupBox1);
+ this.Controls.Add(this.tagsGb);
this.Controls.Add(this.detailsTb);
this.Controls.Add(this.coverPb);
this.Controls.Add(this.saveBtn);
@@ -139,8 +210,10 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Book Details";
((System.ComponentModel.ISupportInitialize)(this.coverPb)).EndInit();
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
+ this.tagsGb.ResumeLayout(false);
+ this.tagsGb.PerformLayout();
+ this.liberatedGb.ResumeLayout(false);
+ this.liberatedGb.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -149,10 +222,16 @@
#endregion
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.TextBox newTagsTb;
- private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label tagsDescLbl;
private System.Windows.Forms.PictureBox coverPb;
private System.Windows.Forms.TextBox detailsTb;
- private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox tagsGb;
private System.Windows.Forms.Button cancelBtn;
+ private System.Windows.Forms.GroupBox liberatedGb;
+ private System.Windows.Forms.ComboBox pdfLiberatedCb;
+ private System.Windows.Forms.Label pdfLiberatedLbl;
+ private System.Windows.Forms.ComboBox bookLiberatedCb;
+ private System.Windows.Forms.Label bookLiberatedLbl;
+ private System.Windows.Forms.Label liberatedDescLbl;
}
}
\ No newline at end of file
diff --git a/LibationWinForms/Dialogs/BookDetailsDialog.cs b/LibationWinForms/Dialogs/BookDetailsDialog.cs
index b0fe66e7..8a6c6bbf 100644
--- a/LibationWinForms/Dialogs/BookDetailsDialog.cs
+++ b/LibationWinForms/Dialogs/BookDetailsDialog.cs
@@ -9,7 +9,16 @@ namespace LibationWinForms.Dialogs
{
public partial class BookDetailsDialog : Form
{
+ public class liberatedComboBoxItem
+ {
+ public LiberatedStatus Status { get; set; }
+ public string Text { get; set; }
+ public override string ToString() => Text;
+ }
+
public string NewTags { get; private set; }
+ public LiberatedStatus BookLiberatedStatus { get; private set; }
+ public LiberatedStatus? PdfLiberatedStatus { get; private set; }
private LibraryBook _libraryBook { get; }
private Book Book => _libraryBook.Book;
@@ -23,7 +32,7 @@ namespace LibationWinForms.Dialogs
_libraryBook = ArgumentValidator.EnsureNotNull(libraryBook, nameof(libraryBook));
initDetails();
initTags();
-//initLiberated();
+ initLiberated();
}
// 1st draft: lazily cribbed from GridEntry.ctor()
private void initDetails()
@@ -56,10 +65,60 @@ Purchase Date: {_libraryBook.DateAdded.ToString("d")}
this.detailsTb.Text = t;
}
private void initTags() => this.newTagsTb.Text = Book.UserDefinedItem.Tags;
+ private void initLiberated()
+ {
+ {
+ var status = Book.UserDefinedItem.BookStatus;
+
+ this.bookLiberatedCb.Items.Add(new liberatedComboBoxItem { Status = LiberatedStatus.Liberated, Text = "Downloaded" });
+ this.bookLiberatedCb.Items.Add(new liberatedComboBoxItem { Status = LiberatedStatus.NotLiberated, Text = "Not Downloaded" });
+
+ // this should only appear if is already an error. User should not be able to set status to error, only away from error
+ if (status == LiberatedStatus.Error)
+ this.bookLiberatedCb.Items.Add(new liberatedComboBoxItem { Status = LiberatedStatus.Error, Text = "Error" });
+
+
+ setDefaultComboBox(this.bookLiberatedCb, status);
+ }
+
+ {
+ var status = Book.UserDefinedItem.PdfStatus;
+
+ if (status is null)
+ this.pdfLiberatedCb.Enabled = false;
+ else
+ {
+ this.pdfLiberatedCb.Items.Add(new liberatedComboBoxItem { Status = LiberatedStatus.Liberated, Text = "Downloaded" });
+ this.pdfLiberatedCb.Items.Add(new liberatedComboBoxItem { Status = LiberatedStatus.NotLiberated, Text = "Not Downloaded" });
+
+ setDefaultComboBox(this.pdfLiberatedCb, status);
+ }
+ }
+ }
+ private static void setDefaultComboBox(ComboBox comboBox, LiberatedStatus? status)
+ {
+ if (!status.HasValue)
+ {
+ comboBox.SelectedIndex = 0;
+ return;
+ }
+
+ var item = comboBox.Items.Cast().SingleOrDefault(item => item.Status == status.Value);
+ if (item is not null)
+ comboBox.SelectedItem = item;
+ else
+ comboBox.SelectedIndex = 0;
+ }
private void saveBtn_Click(object sender, EventArgs e)
{
NewTags = this.newTagsTb.Text;
+
+ BookLiberatedStatus = ((liberatedComboBoxItem)this.bookLiberatedCb.SelectedItem).Status;
+
+ if (this.pdfLiberatedCb.Enabled)
+ PdfLiberatedStatus = ((liberatedComboBoxItem)this.pdfLiberatedCb.SelectedItem).Status;
+
this.DialogResult = DialogResult.OK;
}