Changes discussed in email
This commit is contained in:
parent
109ce0dd1f
commit
843fddabde
24
Source/LibationWinForms/Form1.Designer.cs
generated
24
Source/LibationWinForms/Form1.Designer.cs
generated
@ -73,7 +73,7 @@
|
|||||||
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.panel1 = new System.Windows.Forms.Panel();
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
this.hideQueueBtn = new System.Windows.Forms.Button();
|
this.toggleQueueHideBtn = new System.Windows.Forms.Button();
|
||||||
this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl();
|
this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.statusStrip1.SuspendLayout();
|
this.statusStrip1.SuspendLayout();
|
||||||
@ -462,7 +462,7 @@
|
|||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
this.panel1.Controls.Add(this.hideQueueBtn);
|
this.panel1.Controls.Add(this.toggleQueueHideBtn);
|
||||||
this.panel1.Controls.Add(this.gridPanel);
|
this.panel1.Controls.Add(this.gridPanel);
|
||||||
this.panel1.Controls.Add(this.addQuickFilterBtn);
|
this.panel1.Controls.Add(this.addQuickFilterBtn);
|
||||||
this.panel1.Controls.Add(this.filterHelpBtn);
|
this.panel1.Controls.Add(this.filterHelpBtn);
|
||||||
@ -477,15 +477,15 @@
|
|||||||
//
|
//
|
||||||
// hideQueueBtn
|
// hideQueueBtn
|
||||||
//
|
//
|
||||||
this.hideQueueBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.toggleQueueHideBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.hideQueueBtn.Location = new System.Drawing.Point(966, 4);
|
this.toggleQueueHideBtn.Location = new System.Drawing.Point(966, 4);
|
||||||
this.hideQueueBtn.Margin = new System.Windows.Forms.Padding(5, 4, 17, 4);
|
this.toggleQueueHideBtn.Margin = new System.Windows.Forms.Padding(5, 4, 17, 4);
|
||||||
this.hideQueueBtn.Name = "hideQueueBtn";
|
this.toggleQueueHideBtn.Name = "hideQueueBtn";
|
||||||
this.hideQueueBtn.Size = new System.Drawing.Size(38, 36);
|
this.toggleQueueHideBtn.Size = new System.Drawing.Size(38, 36);
|
||||||
this.hideQueueBtn.TabIndex = 8;
|
this.toggleQueueHideBtn.TabIndex = 8;
|
||||||
this.hideQueueBtn.Text = "❰❰❰";
|
this.toggleQueueHideBtn.Text = "❱❱❱";
|
||||||
this.hideQueueBtn.UseVisualStyleBackColor = true;
|
this.toggleQueueHideBtn.UseVisualStyleBackColor = true;
|
||||||
this.hideQueueBtn.Click += new System.EventHandler(this.HideQueueBtn_Click);
|
this.toggleQueueHideBtn.Click += new System.EventHandler(this.ToggleQueueHideBtn_Click);
|
||||||
//
|
//
|
||||||
// processBookQueue1
|
// processBookQueue1
|
||||||
//
|
//
|
||||||
@ -571,6 +571,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;
|
private System.Windows.Forms.Button toggleQueueHideBtn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,12 +11,18 @@ namespace LibationWinForms
|
|||||||
|
|
||||||
//GetLibrary_Flat_NoTracking() may take a long time on a hugh library. so run in new thread
|
//GetLibrary_Flat_NoTracking() may take a long time on a hugh library. so run in new thread
|
||||||
private async void beginBookBackupsToolStripMenuItem_Click(object sender, EventArgs e)
|
private async void beginBookBackupsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
=> await Task.Run(() => processBookQueue1.AddDownloadDecrypt(ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking()
|
{
|
||||||
|
SetQueueCollapseState(false);
|
||||||
|
await Task.Run(() => processBookQueue1.AddDownloadDecrypt(ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking()
|
||||||
.Where(lb => lb.Book.UserDefinedItem.PdfStatus is DataLayer.LiberatedStatus.NotLiberated || lb.Book.UserDefinedItem.BookStatus is DataLayer.LiberatedStatus.NotLiberated)));
|
.Where(lb => lb.Book.UserDefinedItem.PdfStatus is DataLayer.LiberatedStatus.NotLiberated || lb.Book.UserDefinedItem.BookStatus is DataLayer.LiberatedStatus.NotLiberated)));
|
||||||
|
}
|
||||||
|
|
||||||
private async void beginPdfBackupsToolStripMenuItem_Click(object sender, EventArgs e)
|
private async void beginPdfBackupsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
=> await Task.Run(() => processBookQueue1.AddDownloadPdf(ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking()
|
{
|
||||||
.Where(lb => lb.Book.UserDefinedItem.PdfStatus is DataLayer.LiberatedStatus.NotLiberated)));
|
SetQueueCollapseState(false);
|
||||||
|
await Task.Run(() => processBookQueue1.AddDownloadPdf(ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking()
|
||||||
|
.Where(lb => lb.Book.UserDefinedItem.PdfStatus is DataLayer.LiberatedStatus.NotLiberated)));
|
||||||
|
}
|
||||||
|
|
||||||
private async void convertAllM4bToMp3ToolStripMenuItem_Click(object sender, EventArgs e)
|
private async void convertAllM4bToMp3ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -29,8 +35,11 @@ namespace LibationWinForms
|
|||||||
MessageBoxButtons.YesNo,
|
MessageBoxButtons.YesNo,
|
||||||
MessageBoxIcon.Warning);
|
MessageBoxIcon.Warning);
|
||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
SetQueueCollapseState(false);
|
||||||
await Task.Run(() => processBookQueue1.AddConvertMp3(ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking()
|
await Task.Run(() => processBookQueue1.AddConvertMp3(ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking()
|
||||||
.Where(lb=>lb.Book.UserDefinedItem.BookStatus is DataLayer.LiberatedStatus.Liberated)));
|
.Where(lb => lb.Book.UserDefinedItem.BookStatus is DataLayer.LiberatedStatus.Liberated)));
|
||||||
|
}
|
||||||
//Only Queue Liberated books for conversion. This isn't a perfect filter, but it's better than nothing.
|
//Only Queue Liberated books for conversion. This isn't a perfect filter, but it's better than nothing.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,41 +1,73 @@
|
|||||||
using ApplicationServices;
|
using DataLayer;
|
||||||
|
using Dinah.Core;
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
using LibationWinForms.ProcessQueue;
|
using LibationWinForms.ProcessQueue;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace LibationWinForms
|
namespace LibationWinForms
|
||||||
{
|
{
|
||||||
public partial class Form1
|
public partial class Form1
|
||||||
{
|
{
|
||||||
private void Configure_ProcessQueue()
|
|
||||||
{
|
|
||||||
productsGrid.LiberateClicked += (_, lb) => processBookQueue1.AddDownloadDecrypt(lb);
|
|
||||||
processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
int WidthChange = 0;
|
int WidthChange = 0;
|
||||||
private void HideQueueBtn_Click(object sender, EventArgs e)
|
private void Configure_ProcessQueue()
|
||||||
{
|
{
|
||||||
if (splitContainer1.Panel2Collapsed)
|
productsGrid.LiberateClicked += ProductsGrid_LiberateClicked;
|
||||||
|
processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut;
|
||||||
|
var coppalseState = Configuration.Instance.GetNonString<bool>(nameof(splitContainer1.Panel2Collapsed));
|
||||||
|
WidthChange = splitContainer1.Panel2.Width + splitContainer1.SplitterWidth;
|
||||||
|
SetQueueCollapseState(coppalseState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProductsGrid_LiberateClicked(object sender, LibraryBook e)
|
||||||
|
{
|
||||||
|
if (e.Book.UserDefinedItem.BookStatus != LiberatedStatus.Liberated)
|
||||||
{
|
{
|
||||||
WidthChange = WidthChange == 0 ? splitContainer1.Panel2.Width + splitContainer1.SplitterWidth : WidthChange;
|
SetQueueCollapseState(false);
|
||||||
Width += WidthChange;
|
processBookQueue1.AddDownloadDecrypt(e);
|
||||||
splitContainer1.Panel2.Controls.Add(processBookQueue1);
|
|
||||||
splitContainer1.Panel2Collapsed = false;
|
|
||||||
processBookQueue1.popoutBtn.Visible = true;
|
|
||||||
hideQueueBtn.Text = "❰❰❰";
|
|
||||||
}
|
}
|
||||||
else
|
else if (e.Book.UserDefinedItem.PdfStatus is not null and LiberatedStatus.NotLiberated)
|
||||||
|
{
|
||||||
|
SetQueueCollapseState(false);
|
||||||
|
processBookQueue1.AddDownloadPdf(e);
|
||||||
|
}
|
||||||
|
else if (e.Book.Audio_Exists())
|
||||||
|
{
|
||||||
|
// liberated: open explorer to file
|
||||||
|
var filePath = AudibleFileStorage.Audio.GetPath(e.Book.AudibleProductId);
|
||||||
|
if (!Go.To.File(filePath))
|
||||||
|
{
|
||||||
|
var suffix = string.IsNullOrWhiteSpace(filePath) ? "" : $":\r\n{filePath}";
|
||||||
|
MessageBox.Show($"File not found" + suffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetQueueCollapseState(bool collapsed)
|
||||||
|
{
|
||||||
|
if (collapsed && !splitContainer1.Panel2Collapsed)
|
||||||
{
|
{
|
||||||
WidthChange = splitContainer1.Panel2.Width + splitContainer1.SplitterWidth;
|
WidthChange = splitContainer1.Panel2.Width + splitContainer1.SplitterWidth;
|
||||||
splitContainer1.Panel2.Controls.Remove(processBookQueue1);
|
splitContainer1.Panel2.Controls.Remove(processBookQueue1);
|
||||||
splitContainer1.Panel2Collapsed = true;
|
splitContainer1.Panel2Collapsed = true;
|
||||||
Width -= WidthChange;
|
Width -= WidthChange;
|
||||||
hideQueueBtn.Text = "❱❱❱";
|
|
||||||
}
|
}
|
||||||
|
else if (!collapsed && splitContainer1.Panel2Collapsed)
|
||||||
|
{
|
||||||
|
Width += WidthChange;
|
||||||
|
splitContainer1.Panel2.Controls.Add(processBookQueue1);
|
||||||
|
splitContainer1.Panel2Collapsed = false;
|
||||||
|
processBookQueue1.popoutBtn.Visible = true;
|
||||||
|
}
|
||||||
|
toggleQueueHideBtn.Text = splitContainer1.Panel2Collapsed ? "❰❰❰" : "❱❱❱";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleQueueHideBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SetQueueCollapseState(!splitContainer1.Panel2Collapsed);
|
||||||
|
Configuration.Instance.SetObject(nameof(splitContainer1.Panel2Collapsed), splitContainer1.Panel2Collapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessBookQueue1_PopOut(object sender, EventArgs e)
|
private void ProcessBookQueue1_PopOut(object sender, EventArgs e)
|
||||||
@ -50,8 +82,8 @@ namespace LibationWinForms
|
|||||||
dockForm.PassControl(processBookQueue1);
|
dockForm.PassControl(processBookQueue1);
|
||||||
dockForm.Show();
|
dockForm.Show();
|
||||||
this.Width -= dockForm.WidthChange;
|
this.Width -= dockForm.WidthChange;
|
||||||
hideQueueBtn.Visible = false;
|
toggleQueueHideBtn.Visible = false;
|
||||||
int deltax = filterBtn.Margin.Right + hideQueueBtn.Width + hideQueueBtn.Margin.Left;
|
int deltax = filterBtn.Margin.Right + toggleQueueHideBtn.Width + toggleQueueHideBtn.Margin.Left;
|
||||||
filterBtn.Location= new System.Drawing.Point(filterBtn.Location.X + deltax, filterBtn.Location.Y);
|
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);
|
filterSearchTb.Location = new System.Drawing.Point(filterSearchTb.Location.X + deltax, filterSearchTb.Location.Y);
|
||||||
}
|
}
|
||||||
@ -66,8 +98,8 @@ 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;
|
toggleQueueHideBtn.Visible = true;
|
||||||
int deltax = filterBtn.Margin.Right + hideQueueBtn.Width + hideQueueBtn.Margin.Left;
|
int deltax = filterBtn.Margin.Right + toggleQueueHideBtn.Width + toggleQueueHideBtn.Margin.Left;
|
||||||
filterBtn.Location = new System.Drawing.Point(filterBtn.Location.X - deltax, filterBtn.Location.Y);
|
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);
|
filterSearchTb.Location = new System.Drawing.Point(filterSearchTb.Location.X - deltax, filterSearchTb.Location.Y);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,10 @@ namespace LibationWinForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async void liberateVisible(object sender, EventArgs e)
|
private async void liberateVisible(object sender, EventArgs e)
|
||||||
=> await Task.Run(() => processBookQueue1.AddDownloadDecrypt(productsGrid.GetVisible()));
|
{
|
||||||
|
SetQueueCollapseState(false);
|
||||||
|
await Task.Run(() => processBookQueue1.AddDownloadDecrypt(productsGrid.GetVisible()));
|
||||||
|
}
|
||||||
|
|
||||||
private void replaceTagsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void replaceTagsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,6 +42,8 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
public bool Running => !QueueRunner?.IsCompleted ?? false;
|
public bool Running => !QueueRunner?.IsCompleted ?? false;
|
||||||
public ToolStripButton popoutBtn = new();
|
public ToolStripButton popoutBtn = new();
|
||||||
|
|
||||||
|
private System.Threading.SynchronizationContext syncContext { get; } = System.Threading.SynchronizationContext.Current;
|
||||||
|
|
||||||
public ProcessQueueControl()
|
public ProcessQueueControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -122,12 +124,13 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
|
|
||||||
private void AddToQueue(ProcessBook pbook)
|
private void AddToQueue(ProcessBook pbook)
|
||||||
{
|
{
|
||||||
BeginInvoke(() =>
|
syncContext.Post(_ =>
|
||||||
{
|
{
|
||||||
Queue.Enqueue(pbook);
|
Queue.Enqueue(pbook);
|
||||||
if (!Running)
|
if (!Running)
|
||||||
QueueRunner = QueueLoop();
|
QueueRunner = QueueLoop();
|
||||||
});
|
},
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime StartintTime;
|
DateTime StartintTime;
|
||||||
@ -264,7 +267,7 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
|
|
||||||
var proc = Queue[queueIndex];
|
var proc = Queue[queueIndex];
|
||||||
|
|
||||||
Panels[i].Invoke(() =>
|
syncContext.Send(_ =>
|
||||||
{
|
{
|
||||||
Panels[i].SuspendLayout();
|
Panels[i].SuspendLayout();
|
||||||
if (propertyName is null || propertyName == nameof(proc.Cover))
|
if (propertyName is null || propertyName == nameof(proc.Cover))
|
||||||
@ -285,7 +288,7 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
if (propertyName is null || propertyName == nameof(proc.TimeRemaining))
|
if (propertyName is null || propertyName == nameof(proc.TimeRemaining))
|
||||||
Panels[i].SetRemainingTime(proc.TimeRemaining);
|
Panels[i].SetRemainingTime(proc.TimeRemaining);
|
||||||
Panels[i].ResumeLayout();
|
Panels[i].ResumeLayout();
|
||||||
});
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAllControls()
|
private void UpdateAllControls()
|
||||||
|
|||||||
@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ApplicationServices;
|
using ApplicationServices;
|
||||||
using DataLayer;
|
using DataLayer;
|
||||||
using Dinah.Core;
|
|
||||||
using Dinah.Core.Windows.Forms;
|
using Dinah.Core.Windows.Forms;
|
||||||
using FileLiberator;
|
using FileLiberator;
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
@ -128,20 +127,6 @@ namespace LibationWinForms
|
|||||||
|
|
||||||
private void Liberate_Click(GridEntry liveGridEntry)
|
private void Liberate_Click(GridEntry liveGridEntry)
|
||||||
{
|
{
|
||||||
var libraryBook = liveGridEntry.LibraryBook;
|
|
||||||
|
|
||||||
// liberated: open explorer to file
|
|
||||||
if (libraryBook.Book.Audio_Exists())
|
|
||||||
{
|
|
||||||
var filePath = AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId);
|
|
||||||
if (!Go.To.File(filePath))
|
|
||||||
{
|
|
||||||
var suffix = string.IsNullOrWhiteSpace(filePath) ? "" : $":\r\n{filePath}";
|
|
||||||
MessageBox.Show($"File not found" + suffix);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LiberateClicked?.Invoke(this, liveGridEntry.LibraryBook);
|
LiberateClicked?.Invoke(this, liveGridEntry.LibraryBook);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +192,7 @@ namespace LibationWinForms
|
|||||||
|
|
||||||
if (bindingList.Count != visibleCount)
|
if (bindingList.Count != visibleCount)
|
||||||
{
|
{
|
||||||
//refilter for newly added items
|
//re-filter for newly added items
|
||||||
Filter(null);
|
Filter(null);
|
||||||
Filter(existingFilter);
|
Filter(existingFilter);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user