mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Show sidecar creation progress in GUI.
This commit is contained in:
@@ -42,8 +42,11 @@
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
ID="stkProgress" Visible="False">
|
||||
<StackLayoutItem HorizontalAlignment="Center" Expand="True">
|
||||
<Label ID="lblStatus" Visible="False"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
ID="stkProgress1">
|
||||
ID="stkProgress1" Visible="False">
|
||||
<StackLayoutItem HorizontalAlignment="Center" Expand="True">
|
||||
<Label ID="lblProgress"/>
|
||||
</StackLayoutItem>
|
||||
@@ -52,7 +55,7 @@
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
ID="stkProgress2">
|
||||
ID="stkProgress2" Visible="False">
|
||||
<StackLayoutItem HorizontalAlignment="Center" Expand="True">
|
||||
<Label ID="lblProgress2"/>
|
||||
</StackLayoutItem>
|
||||
|
||||
@@ -81,9 +81,17 @@ namespace DiscImageChef.Gui.Forms
|
||||
btnStop.Enabled = true;
|
||||
stkProgress.Visible = true;
|
||||
btnDestination.Visible = false;
|
||||
lblStatus.Visible = true;
|
||||
});
|
||||
|
||||
sidecarClass = new Sidecar(inputFormat, imageSource, filterId, encoding);
|
||||
sidecarClass = new Sidecar(inputFormat, imageSource, filterId, encoding);
|
||||
sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
sidecarClass.InitProgressEvent += InitProgress;
|
||||
sidecarClass.UpdateProgressEvent += UpdateProgress;
|
||||
sidecarClass.EndProgressEvent += EndProgress;
|
||||
sidecarClass.InitProgressEvent2 += InitProgress2;
|
||||
sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
CICMMetadataType sidecar = sidecarClass.Create();
|
||||
|
||||
DicConsole.WriteLine("Writing metadata sidecar");
|
||||
@@ -99,11 +107,77 @@ namespace DiscImageChef.Gui.Forms
|
||||
btnClose.Visible = true;
|
||||
btnStop.Visible = false;
|
||||
stkProgress.Visible = false;
|
||||
lblStatus.Visible = false;
|
||||
});
|
||||
|
||||
Statistics.AddCommand("create-sidecar");
|
||||
}
|
||||
|
||||
void EndProgress2()
|
||||
{
|
||||
Application.Instance.Invoke(() => { stkProgress2.Visible = false; });
|
||||
}
|
||||
|
||||
void UpdateProgress2(string text, long current, long maximum)
|
||||
{
|
||||
Application.Instance.Invoke(() =>
|
||||
{
|
||||
lblProgress2.Text = text;
|
||||
prgProgress2.Indeterminate = false;
|
||||
prgProgress2.MinValue = 0;
|
||||
if(maximum > int.MaxValue)
|
||||
{
|
||||
prgProgress2.MaxValue = (int)(maximum / int.MaxValue);
|
||||
prgProgress2.Value = (int)(current / int.MaxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
prgProgress2.MaxValue = (int)maximum;
|
||||
prgProgress2.Value = (int)current;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void InitProgress2()
|
||||
{
|
||||
Application.Instance.Invoke(() => { stkProgress2.Visible = true; });
|
||||
}
|
||||
|
||||
void EndProgress()
|
||||
{
|
||||
Application.Instance.Invoke(() => { stkProgress1.Visible = false; });
|
||||
}
|
||||
|
||||
void UpdateProgress(string text, long current, long maximum)
|
||||
{
|
||||
Application.Instance.Invoke(() =>
|
||||
{
|
||||
lblProgress.Text = text;
|
||||
prgProgress.Indeterminate = false;
|
||||
prgProgress.MinValue = 0;
|
||||
if(maximum > int.MaxValue)
|
||||
{
|
||||
prgProgress.MaxValue = (int)(maximum / int.MaxValue);
|
||||
prgProgress.Value = (int)(current / int.MaxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
prgProgress.MaxValue = (int)maximum;
|
||||
prgProgress.Value = (int)current;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void InitProgress()
|
||||
{
|
||||
Application.Instance.Invoke(() => { stkProgress1.Visible = true; });
|
||||
}
|
||||
|
||||
void UpdateStatus(string text)
|
||||
{
|
||||
Application.Instance.Invoke(() => { lblStatus.Text = text; });
|
||||
}
|
||||
|
||||
protected void OnBtnClose(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
@@ -147,6 +221,7 @@ namespace DiscImageChef.Gui.Forms
|
||||
Button btnStart;
|
||||
Button btnClose;
|
||||
Button btnStop;
|
||||
Label lblStatus;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user