Files
cuetools.net/CUETools.CTDB.EACPlugin/FormSubmitParity.cs
chudov 8b19665038 * support for new metadata sources via CTDB
* CUETools: GUI tweaks for large screen resolutions on windows 7
* CUETools.Codecs.LAMEEncoder: fix VBR header update for filenames with unicode characters
* CUERipper: more string messages for SCSI errors when ripping
2011-09-08 18:25:54 +00:00

84 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CUETools.CTDB.EACPlugin.Properties;
namespace CUETools.CTDB.EACPlugin
{
public partial class FormSubmitParity : Form
{
private CUEToolsDB ctdb;
private int confidence, quality;
private string artist, title, agent, drivename;
public FormSubmitParity(CUEToolsDB ctdb, int confidence, int quality, string artist, string title)
{
this.ctdb = ctdb;
this.confidence = confidence;
this.quality = quality;
this.artist = artist;
this.title = title;
this.InitializeComponent();
}
public FormSubmitParity(CUEToolsDB ctdb, string agent, string drivename)
{
this.ctdb = ctdb;
this.agent = agent;
this.drivename = drivename;
this.InitializeComponent();
}
private void FormMetadata_Load(object sender, EventArgs e)
{
this.Icon = Resources.ctdb;
this.backgroundWorker1.RunWorkerAsync();
}
private void UploadProgress(object sender, Krystalware.UploadHelper.UploadProgressEventArgs e)
{
this.backgroundWorker1.ReportProgress((int)e.percent, e.uri);
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
this.ctdb.UploadHelper.onProgress += UploadProgress;
if (this.agent != null)
{
this.ctdb.ContactDB(null, this.agent, this.drivename, true, false, CTDBMetadataSearch.None);
}
else
{
this.ctdb.DoVerify();
this.ctdb.Submit(this.confidence, this.quality, this.artist, this.title, null);
}
this.ctdb.UploadHelper.onProgress -= UploadProgress;
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.progressBar1.Style = e.ProgressPercentage != 0 ? ProgressBarStyle.Continuous : ProgressBarStyle.Marquee;
this.progressBar1.Value = Math.Max(0, Math.Min(100, e.ProgressPercentage));
}
private void FormSubmitParity_FormClosing(object sender, FormClosingEventArgs e)
{
if (this.backgroundWorker1.IsBusy)
{
e.Cancel = true;
this.progressBar1.Style = ProgressBarStyle.Marquee;
this.ctdb.CancelRequest();
}
}
}
}