Add button to hide queue

This commit is contained in:
Michael Bucari-Tovo 2022-05-14 20:44:53 -06:00
parent 5b05c018d5
commit 49d10273a6
2 changed files with 64 additions and 3 deletions

View File

@ -72,6 +72,7 @@
this.pdfsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel(); this.pdfsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.addQuickFilterBtn = new System.Windows.Forms.Button(); this.addQuickFilterBtn = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.hideQueueBtn = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl(); this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
@ -106,8 +107,8 @@
// filterBtn // filterBtn
// //
this.filterBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.filterBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.filterBtn.Location = new System.Drawing.Point(791, 27); this.filterBtn.Location = new System.Drawing.Point(750, 27);
this.filterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 15, 3); this.filterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.filterBtn.Name = "filterBtn"; this.filterBtn.Name = "filterBtn";
this.filterBtn.Size = new System.Drawing.Size(88, 27); this.filterBtn.Size = new System.Drawing.Size(88, 27);
this.filterBtn.TabIndex = 2; this.filterBtn.TabIndex = 2;
@ -122,7 +123,7 @@
this.filterSearchTb.Location = new System.Drawing.Point(194, 30); this.filterSearchTb.Location = new System.Drawing.Point(194, 30);
this.filterSearchTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.filterSearchTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.filterSearchTb.Name = "filterSearchTb"; this.filterSearchTb.Name = "filterSearchTb";
this.filterSearchTb.Size = new System.Drawing.Size(589, 23); this.filterSearchTb.Size = new System.Drawing.Size(548, 23);
this.filterSearchTb.TabIndex = 1; this.filterSearchTb.TabIndex = 1;
this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress); this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress);
// //
@ -443,6 +444,7 @@
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.hideQueueBtn);
this.splitContainer1.Panel1.Controls.Add(this.panel1); this.splitContainer1.Panel1.Controls.Add(this.panel1);
this.splitContainer1.Panel1.Controls.Add(this.menuStrip1); this.splitContainer1.Panel1.Controls.Add(this.menuStrip1);
this.splitContainer1.Panel1.Controls.Add(this.filterSearchTb); this.splitContainer1.Panel1.Controls.Add(this.filterSearchTb);
@ -459,6 +461,18 @@
this.splitContainer1.SplitterWidth = 8; this.splitContainer1.SplitterWidth = 8;
this.splitContainer1.TabIndex = 7; this.splitContainer1.TabIndex = 7;
// //
// hideQueueBtn
//
this.hideQueueBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.hideQueueBtn.Location = new System.Drawing.Point(846, 27);
this.hideQueueBtn.Margin = new System.Windows.Forms.Padding(4, 3, 15, 3);
this.hideQueueBtn.Name = "hideQueueBtn";
this.hideQueueBtn.Size = new System.Drawing.Size(33, 27);
this.hideQueueBtn.TabIndex = 8;
this.hideQueueBtn.Text = "❰❰❰";
this.hideQueueBtn.UseVisualStyleBackColor = true;
this.hideQueueBtn.Click += new System.EventHandler(this.HideQueueBtn_Click);
//
// panel1 // panel1
// //
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -554,5 +568,6 @@
private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.SplitContainer splitContainer1;
private LibationWinForms.ProcessQueue.ProcessQueueControl processBookQueue1; private LibationWinForms.ProcessQueue.ProcessQueueControl processBookQueue1;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button hideQueueBtn;
} }
} }

View File

@ -2,6 +2,8 @@
using LibationFileManager; using LibationFileManager;
using LibationWinForms.ProcessQueue; using LibationWinForms.ProcessQueue;
using System; using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace LibationWinForms namespace LibationWinForms
@ -12,6 +14,42 @@ namespace LibationWinForms
{ {
productsGrid.LiberateClicked += (_, lb) => processBookQueue1.AddDownloadDecrypt(lb); productsGrid.LiberateClicked += (_, lb) => processBookQueue1.AddDownloadDecrypt(lb);
processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut; processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut;
Task.Run(() =>
{
Task.Delay(3000).Wait();
var lb = ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking().Select(lb => lb.Book).ToList();
foreach (var b in lb)
{
b.UserDefinedItem.BookStatus = DataLayer.LiberatedStatus.NotLiberated;
}
LibraryCommands.UpdateUserDefinedItem(lb);
});
}
int WidthChange = 0;
private void HideQueueBtn_Click(object sender, EventArgs e)
{
if (splitContainer1.Panel2Collapsed)
{
WidthChange = WidthChange == 0 ? splitContainer1.Panel2.Width + splitContainer1.SplitterWidth : WidthChange;
Width += WidthChange;
splitContainer1.Panel2.Controls.Add(processBookQueue1);
splitContainer1.Panel2Collapsed = false;
processBookQueue1.popoutBtn.Visible = true;
hideQueueBtn.Text = "❰❰❰";
}
else
{
WidthChange = splitContainer1.Panel2.Width + splitContainer1.SplitterWidth;
splitContainer1.Panel2.Controls.Remove(processBookQueue1);
splitContainer1.Panel2Collapsed = true;
Width -= WidthChange;
hideQueueBtn.Text = "❱❱❱";
}
} }
private void ProcessBookQueue1_PopOut(object sender, EventArgs e) private void ProcessBookQueue1_PopOut(object sender, EventArgs e)
@ -26,6 +64,10 @@ namespace LibationWinForms
dockForm.PassControl(processBookQueue1); dockForm.PassControl(processBookQueue1);
dockForm.Show(); dockForm.Show();
this.Width -= dockForm.WidthChange; this.Width -= dockForm.WidthChange;
hideQueueBtn.Visible = false;
int deltax = filterBtn.Margin.Right + hideQueueBtn.Width + hideQueueBtn.Margin.Left;
filterBtn.Location= new System.Drawing.Point(filterBtn.Location.X + deltax, filterBtn.Location.Y);
filterSearchTb.Location = new System.Drawing.Point(filterSearchTb.Location.X + deltax, filterSearchTb.Location.Y);
} }
private void DockForm_FormClosing(object sender, FormClosingEventArgs e) private void DockForm_FormClosing(object sender, FormClosingEventArgs e)
@ -38,6 +80,10 @@ namespace LibationWinForms
processBookQueue1.popoutBtn.Visible = true; processBookQueue1.popoutBtn.Visible = true;
dockForm.SaveSizeAndLocation(Configuration.Instance); dockForm.SaveSizeAndLocation(Configuration.Instance);
this.Focus(); this.Focus();
hideQueueBtn.Visible = true;
int deltax = filterBtn.Margin.Right + hideQueueBtn.Width + hideQueueBtn.Margin.Left;
filterBtn.Location = new System.Drawing.Point(filterBtn.Location.X - deltax, filterBtn.Location.Y);
filterSearchTb.Location = new System.Drawing.Point(filterSearchTb.Location.X - deltax, filterSearchTb.Location.Y);
} }
} }
} }