Added the translation progress component
This commit is contained in:
parent
c8b5dc9b7a
commit
1071439348
65
I18N Commander/UI WinForms/Components/TranslationProgress.Designer.cs
generated
Normal file
65
I18N Commander/UI WinForms/Components/TranslationProgress.Designer.cs
generated
Normal file
@ -0,0 +1,65 @@
|
||||
namespace UI_WinForms.Components
|
||||
{
|
||||
sealed partial class TranslationProgress
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nxProgressBar = new UI_WinForms.Components.NXProgressBar();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nxProgressBar
|
||||
//
|
||||
this.nxProgressBar.AppendPercentageToText = true;
|
||||
this.nxProgressBar.BackColor = System.Drawing.Color.LightSkyBlue;
|
||||
this.nxProgressBar.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.nxProgressBar.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.nxProgressBar.InformationText = "Overall translation progress";
|
||||
this.nxProgressBar.Location = new System.Drawing.Point(0, 0);
|
||||
this.nxProgressBar.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.nxProgressBar.Name = "nxProgressBar";
|
||||
this.nxProgressBar.Padding = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.nxProgressBar.PercentFloat = 0F;
|
||||
this.nxProgressBar.PercentInt = 0;
|
||||
this.nxProgressBar.Size = new System.Drawing.Size(832, 68);
|
||||
this.nxProgressBar.TabIndex = 0;
|
||||
//
|
||||
// TranslationProgress
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nxProgressBar);
|
||||
this.Name = "TranslationProgress";
|
||||
this.Size = new System.Drawing.Size(832, 68);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private NXProgressBar nxProgressBar;
|
||||
}
|
||||
}
|
38
I18N Commander/UI WinForms/Components/TranslationProgress.cs
Normal file
38
I18N Commander/UI WinForms/Components/TranslationProgress.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using Processor;
|
||||
|
||||
namespace UI_WinForms.Components;
|
||||
|
||||
public sealed partial class TranslationProgress : UserControl
|
||||
{
|
||||
public TranslationProgress()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.DoubleBuffered = true;
|
||||
this.Load += this.OnLoad;
|
||||
AppEvents.WhenTranslationChanged += async (_, _) => await this.TranslationChanged();
|
||||
}
|
||||
|
||||
private async void OnLoad(object? sender, EventArgs e) => await this.CalculateTranslationProgress();
|
||||
|
||||
private async Task TranslationChanged() => await this.CalculateTranslationProgress();
|
||||
|
||||
private async Task CalculateTranslationProgress()
|
||||
{
|
||||
var result = await TranslationProcessor.CalculateTranslationProgress();
|
||||
if (this.nxProgressBar.InvokeRequired)
|
||||
this.nxProgressBar.Invoke(() => SetProgress(result));
|
||||
else
|
||||
SetProgress(result);
|
||||
|
||||
void SetProgress(ProcessorResult<int> resultData)
|
||||
{
|
||||
if (resultData.Successful)
|
||||
this.nxProgressBar.PercentInt = resultData.Result;
|
||||
else
|
||||
this.nxProgressBar.PercentInt = 0;
|
||||
|
||||
this.nxProgressBar.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user