From 308857a0d8cd6106182a972b1326ef881f836e54 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Tue, 31 Oct 2017 16:36:14 -0500 Subject: [PATCH] sorted keys and added key filters --- .../TranslationWindow.Designer.cs | 30 +++++++++++++++ EduNetworkBuilder/TranslationWindow.cs | 37 +++++++++++++++++-- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/EduNetworkBuilder/TranslationWindow.Designer.cs b/EduNetworkBuilder/TranslationWindow.Designer.cs index d5b84b1..1e8dae6 100644 --- a/EduNetworkBuilder/TranslationWindow.Designer.cs +++ b/EduNetworkBuilder/TranslationWindow.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/EduNetworkBuilder/TranslationWindow.cs b/EduNetworkBuilder/TranslationWindow.cs index ca1463d..d002f08 100644 --- a/EduNetworkBuilder/TranslationWindow.cs +++ b/EduNetworkBuilder/TranslationWindow.cs @@ -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,16 +313,40 @@ namespace EduNetworkBuilder PopulateFormTranslationItems(); } + void PopulateFormTranslationItems(object sender, EventArgs e) + { + PopulateFormTranslationItems(); + } + private void PopulateFormTranslationItems() { cbFormItemChoice.Items.Clear(); TranslationResxFile en = FileFromLangCode("en"); + List Priorities = new List() { "_", "NB_", "DC_" }; if(en != null) { foreach(TranslationItem TI in en.Items) { - cbFormItemChoice.Items.Add(TI.Key); - } + 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(); }