sorted keys and added key filters

This commit is contained in:
Tim Young 2017-10-31 16:36:14 -05:00
parent f1632bb8df
commit 308857a0d8
2 changed files with 63 additions and 4 deletions

View File

@ -51,6 +51,8 @@
this.cbFormLang1Choice = new System.Windows.Forms.ComboBox();
this.lblFormDir = new System.Windows.Forms.Label();
this.btnChooseDir = new System.Windows.Forms.Button();
this.cbFormHighPriority = new System.Windows.Forms.CheckBox();
this.cbFormSkipDone = new System.Windows.Forms.CheckBox();
this.tcTabPages.SuspendLayout();
this.tpMessageTitle.SuspendLayout();
this.tpFormStuff.SuspendLayout();
@ -199,6 +201,8 @@
//
// tpFormStuff
//
this.tpFormStuff.Controls.Add(this.cbFormSkipDone);
this.tpFormStuff.Controls.Add(this.cbFormHighPriority);
this.tpFormStuff.Controls.Add(this.panelTranslateFormItems);
this.tpFormStuff.Controls.Add(this.lblFormDir);
this.tpFormStuff.Controls.Add(this.btnChooseDir);
@ -297,6 +301,30 @@
this.btnChooseDir.UseVisualStyleBackColor = true;
this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click);
//
// cbFormHighPriority
//
this.cbFormHighPriority.AutoSize = true;
this.cbFormHighPriority.Checked = true;
this.cbFormHighPriority.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbFormHighPriority.Location = new System.Drawing.Point(28, 49);
this.cbFormHighPriority.Name = "cbFormHighPriority";
this.cbFormHighPriority.Size = new System.Drawing.Size(107, 21);
this.cbFormHighPriority.TabIndex = 3;
this.cbFormHighPriority.Text = "High Priority";
this.cbFormHighPriority.UseVisualStyleBackColor = true;
//
// cbFormSkipDone
//
this.cbFormSkipDone.AutoSize = true;
this.cbFormSkipDone.Checked = true;
this.cbFormSkipDone.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbFormSkipDone.Location = new System.Drawing.Point(141, 49);
this.cbFormSkipDone.Name = "cbFormSkipDone";
this.cbFormSkipDone.Size = new System.Drawing.Size(95, 21);
this.cbFormSkipDone.TabIndex = 4;
this.cbFormSkipDone.Text = "Skip Done";
this.cbFormSkipDone.UseVisualStyleBackColor = true;
//
// TranslationWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@ -347,5 +375,7 @@
private System.Windows.Forms.ComboBox cbFormLang1Choice;
private System.Windows.Forms.Label lblFormDir;
private System.Windows.Forms.Button btnChooseDir;
private System.Windows.Forms.CheckBox cbFormSkipDone;
private System.Windows.Forms.CheckBox cbFormHighPriority;
}
}

View File

@ -45,6 +45,9 @@ namespace EduNetworkBuilder
cbFormLang1Choice.Items.Clear();
cbFormLang2Choice.Items.Clear();
cbFormHighPriority.CheckedChanged += PopulateFormTranslationItems;
cbFormSkipDone.CheckedChanged += PopulateFormTranslationItems;
panelTranslateFormItems.Enabled = false;
NBSettings mySettings = NB.GetSettings();
@ -310,14 +313,38 @@ namespace EduNetworkBuilder
PopulateFormTranslationItems();
}
void PopulateFormTranslationItems(object sender, EventArgs e)
{
PopulateFormTranslationItems();
}
private void PopulateFormTranslationItems()
{
cbFormItemChoice.Items.Clear();
TranslationResxFile en = FileFromLangCode("en");
List<string> Priorities = new List<string>() { "_", "NB_", "DC_" };
if(en != null)
{
foreach(TranslationItem TI in en.Items)
{
bool AddTranslated = false;
bool AddHigh = false;
if (!TI.translated || !cbFormSkipDone.Checked)
AddTranslated = true;
if (cbFormHighPriority.Checked)
{
foreach(string one in Priorities)
{
if(TI.Key.StartsWith(one))
{
AddHigh = true;
break;
}
}
}
else
AddHigh = true;
if(AddTranslated && AddHigh)
cbFormItemChoice.Items.Add(TI.Key);
}
}
@ -369,12 +396,13 @@ namespace EduNetworkBuilder
{
filename = File;
Load();
if (filename == "edustrings.resx")
string fn = Path.GetFileName(File);
if (fn == "edustrings.resx")
{
language = "en";
}
else
language = filename.Substring(0, 2);
language = fn.Substring(11, 2);
}
void Load()
@ -404,6 +432,7 @@ namespace EduNetworkBuilder
TI.Value = (string)rdn.GetValue(new System.Reflection.AssemblyName[] { currentAssembly.GetName() });
Items.Add(TI);
}
Items.Sort((a,b) => a.Key.CompareTo(b.Key));
InResx.Close();
}