initial filter drop-down

This commit is contained in:
Tim Young 2017-11-01 12:57:00 -05:00
parent 45e95666c5
commit 96da03128e
2 changed files with 38 additions and 5 deletions

View File

@ -55,6 +55,7 @@
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cbFormHighPriority = new System.Windows.Forms.CheckBox(); this.cbFormHighPriority = new System.Windows.Forms.CheckBox();
this.cbFormShowTranslated = new System.Windows.Forms.CheckBox(); this.cbFormShowTranslated = new System.Windows.Forms.CheckBox();
this.cbFormFilter = new System.Windows.Forms.ComboBox();
this.tcTabPages.SuspendLayout(); this.tcTabPages.SuspendLayout();
this.tpMessageTitle.SuspendLayout(); this.tpMessageTitle.SuspendLayout();
this.tpFormStuff.SuspendLayout(); this.tpFormStuff.SuspendLayout();
@ -228,7 +229,7 @@
this.panelTranslateFormItems.Controls.Add(this.cbFormItemChoice); this.panelTranslateFormItems.Controls.Add(this.cbFormItemChoice);
this.panelTranslateFormItems.Controls.Add(this.cbFormLang2Choice); this.panelTranslateFormItems.Controls.Add(this.cbFormLang2Choice);
this.panelTranslateFormItems.Controls.Add(this.cbFormLang1Choice); this.panelTranslateFormItems.Controls.Add(this.cbFormLang1Choice);
this.panelTranslateFormItems.Location = new System.Drawing.Point(6, 117); this.panelTranslateFormItems.Location = new System.Drawing.Point(6, 126);
this.panelTranslateFormItems.Name = "panelTranslateFormItems"; this.panelTranslateFormItems.Name = "panelTranslateFormItems";
this.panelTranslateFormItems.Size = new System.Drawing.Size(512, 307); this.panelTranslateFormItems.Size = new System.Drawing.Size(512, 307);
this.panelTranslateFormItems.TabIndex = 2; this.panelTranslateFormItems.TabIndex = 2;
@ -321,11 +322,12 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.cbFormFilter);
this.groupBox1.Controls.Add(this.cbFormHighPriority); this.groupBox1.Controls.Add(this.cbFormHighPriority);
this.groupBox1.Controls.Add(this.cbFormShowTranslated); this.groupBox1.Controls.Add(this.cbFormShowTranslated);
this.groupBox1.Location = new System.Drawing.Point(12, 82); this.groupBox1.Location = new System.Drawing.Point(12, 82);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(505, 28); this.groupBox1.Size = new System.Drawing.Size(505, 38);
this.groupBox1.TabIndex = 6; this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Show"; this.groupBox1.Text = "Show";
@ -335,7 +337,7 @@
this.cbFormHighPriority.AutoSize = true; this.cbFormHighPriority.AutoSize = true;
this.cbFormHighPriority.Checked = true; this.cbFormHighPriority.Checked = true;
this.cbFormHighPriority.CheckState = System.Windows.Forms.CheckState.Checked; this.cbFormHighPriority.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbFormHighPriority.Location = new System.Drawing.Point(100, 7); this.cbFormHighPriority.Location = new System.Drawing.Point(57, 7);
this.cbFormHighPriority.Name = "cbFormHighPriority"; this.cbFormHighPriority.Name = "cbFormHighPriority";
this.cbFormHighPriority.Size = new System.Drawing.Size(107, 21); this.cbFormHighPriority.Size = new System.Drawing.Size(107, 21);
this.cbFormHighPriority.TabIndex = 3; this.cbFormHighPriority.TabIndex = 3;
@ -345,13 +347,22 @@
// cbFormShowTranslated // cbFormShowTranslated
// //
this.cbFormShowTranslated.AutoSize = true; this.cbFormShowTranslated.AutoSize = true;
this.cbFormShowTranslated.Location = new System.Drawing.Point(230, 8); this.cbFormShowTranslated.Location = new System.Drawing.Point(170, 7);
this.cbFormShowTranslated.Name = "cbFormShowTranslated"; this.cbFormShowTranslated.Name = "cbFormShowTranslated";
this.cbFormShowTranslated.Size = new System.Drawing.Size(150, 21); this.cbFormShowTranslated.Size = new System.Drawing.Size(150, 21);
this.cbFormShowTranslated.TabIndex = 4; this.cbFormShowTranslated.TabIndex = 4;
this.cbFormShowTranslated.Text = "Already Translated"; this.cbFormShowTranslated.Text = "Already Translated";
this.cbFormShowTranslated.UseVisualStyleBackColor = true; this.cbFormShowTranslated.UseVisualStyleBackColor = true;
// //
// cbFormFilter
//
this.cbFormFilter.FormattingEnabled = true;
this.cbFormFilter.Location = new System.Drawing.Point(326, 8);
this.cbFormFilter.Name = "cbFormFilter";
this.cbFormFilter.Size = new System.Drawing.Size(121, 24);
this.cbFormFilter.TabIndex = 5;
this.cbFormFilter.SelectedIndexChanged += new System.EventHandler(this.cbFormFilter_SelectedIndexChanged);
//
// TranslationWindow // TranslationWindow
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@ -408,5 +419,6 @@
private System.Windows.Forms.CheckBox cbFormHighPriority; private System.Windows.Forms.CheckBox cbFormHighPriority;
private System.Windows.Forms.CheckBox cbFormItemTranslated; private System.Windows.Forms.CheckBox cbFormItemTranslated;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox cbFormFilter;
} }
} }

View File

@ -51,6 +51,12 @@ namespace EduNetworkBuilder
cbFormHighPriority.CheckedChanged += PopulateFormTranslationItems; cbFormHighPriority.CheckedChanged += PopulateFormTranslationItems;
cbFormShowTranslated.CheckedChanged += PopulateFormTranslationItems; cbFormShowTranslated.CheckedChanged += PopulateFormTranslationItems;
cbFormFilter.Items.Clear();
foreach(TranslationFormData TFD in FormData)
{
cbFormFilter.Items.Add(TFD.Prefix);
}
panelTranslateFormItems.Enabled = false; panelTranslateFormItems.Enabled = false;
NBSettings mySettings = NB.GetSettings(); NBSettings mySettings = NB.GetSettings();
@ -360,13 +366,22 @@ namespace EduNetworkBuilder
{ {
cbFormItemChoice.Items.Clear(); cbFormItemChoice.Items.Clear();
TranslationResxFile en = FileFromLangCode("en"); TranslationResxFile en = FileFromLangCode("en");
List<string> Priorities = new List<string>() { "_", "NB_", "DC_" }; List<string> Priorities = new List<string>() { };
foreach(TranslationFormData TFD in FormData)
{
if (TFD.Importance > 5) Priorities.Add(TFD.Prefix);
}
if(en != null) if(en != null)
{ {
foreach(TranslationItem TI in en.Items) foreach(TranslationItem TI in en.Items)
{ {
bool AddTranslated = false; bool AddTranslated = false;
bool AddHigh = false; bool AddHigh = false;
if (cbFormFilter.Text != "Any")
{
if (!TI.Key.StartsWith(cbFormFilter.Text))
continue;//Skip it if it does not match the filter.
}
if (!TI.translated || cbFormShowTranslated.Checked) if (!TI.translated || cbFormShowTranslated.Checked)
AddTranslated = true; AddTranslated = true;
if (cbFormHighPriority.Checked) if (cbFormHighPriority.Checked)
@ -477,6 +492,12 @@ namespace EduNetworkBuilder
} }
} }
} }
private void cbFormFilter_SelectedIndexChanged(object sender, EventArgs e)
{
//We want to filter the form based on what we have here.
PopulateFormTranslationItems();
}
} }
#region TranslationClasses #region TranslationClasses