populate the item choices

This commit is contained in:
Tim Young 2017-10-31 14:06:26 -05:00
parent 9613182a87
commit f1632bb8df
2 changed files with 117 additions and 88 deletions

View File

@ -39,18 +39,18 @@
this.tb2Title = new System.Windows.Forms.TextBox(); this.tb2Title = new System.Windows.Forms.TextBox();
this.tcTabPages = new System.Windows.Forms.TabControl(); this.tcTabPages = new System.Windows.Forms.TabControl();
this.tpMessageTitle = new System.Windows.Forms.TabPage(); this.tpMessageTitle = new System.Windows.Forms.TabPage();
this.tpFormStuff = new System.Windows.Forms.TabPage();
this.tb2URL = new System.Windows.Forms.TextBox();
this.tb1URL = new System.Windows.Forms.TextBox(); this.tb1URL = new System.Windows.Forms.TextBox();
this.btnChooseDir = new System.Windows.Forms.Button(); this.tb2URL = new System.Windows.Forms.TextBox();
this.lblFormDir = new System.Windows.Forms.Label(); this.tpFormStuff = new System.Windows.Forms.TabPage();
this.panelTranslateFormItems = new System.Windows.Forms.Panel(); this.panelTranslateFormItems = new System.Windows.Forms.Panel();
this.cbFormLang1Choice = new System.Windows.Forms.ComboBox();
this.cbFormLang2Choice = new System.Windows.Forms.ComboBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.lblFormItem = new System.Windows.Forms.Label();
this.tbFormItem1 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.tbFormItem1 = new System.Windows.Forms.TextBox();
this.lblFormItem = new System.Windows.Forms.Label();
this.cbFormItemChoice = new System.Windows.Forms.ComboBox();
this.cbFormLang2Choice = new System.Windows.Forms.ComboBox();
this.cbFormLang1Choice = new System.Windows.Forms.ComboBox();
this.lblFormDir = new System.Windows.Forms.Label();
this.btnChooseDir = new System.Windows.Forms.Button();
this.tcTabPages.SuspendLayout(); this.tcTabPages.SuspendLayout();
this.tpMessageTitle.SuspendLayout(); this.tpMessageTitle.SuspendLayout();
this.tpFormStuff.SuspendLayout(); this.tpFormStuff.SuspendLayout();
@ -181,6 +181,22 @@
this.tpMessageTitle.Text = "Messages"; this.tpMessageTitle.Text = "Messages";
this.tpMessageTitle.UseVisualStyleBackColor = true; this.tpMessageTitle.UseVisualStyleBackColor = true;
// //
// tb1URL
//
this.tb1URL.Location = new System.Drawing.Point(6, 208);
this.tb1URL.Name = "tb1URL";
this.tb1URL.Size = new System.Drawing.Size(438, 22);
this.tb1URL.TabIndex = 19;
this.tb1URL.Leave += new System.EventHandler(this.tb1URL_Leave);
//
// tb2URL
//
this.tb2URL.Location = new System.Drawing.Point(6, 413);
this.tb2URL.Name = "tb2URL";
this.tb2URL.Size = new System.Drawing.Size(438, 22);
this.tb2URL.TabIndex = 18;
this.tb2URL.Leave += new System.EventHandler(this.tb2URL_Leave);
//
// tpFormStuff // tpFormStuff
// //
this.tpFormStuff.Controls.Add(this.panelTranslateFormItems); this.tpFormStuff.Controls.Add(this.panelTranslateFormItems);
@ -194,47 +210,12 @@
this.tpFormStuff.Text = "Forms"; this.tpFormStuff.Text = "Forms";
this.tpFormStuff.UseVisualStyleBackColor = true; this.tpFormStuff.UseVisualStyleBackColor = true;
// //
// tb2URL
//
this.tb2URL.Location = new System.Drawing.Point(6, 413);
this.tb2URL.Name = "tb2URL";
this.tb2URL.Size = new System.Drawing.Size(438, 22);
this.tb2URL.TabIndex = 18;
this.tb2URL.Leave += new System.EventHandler(this.tb2URL_Leave);
//
// tb1URL
//
this.tb1URL.Location = new System.Drawing.Point(6, 208);
this.tb1URL.Name = "tb1URL";
this.tb1URL.Size = new System.Drawing.Size(438, 22);
this.tb1URL.TabIndex = 19;
this.tb1URL.Leave += new System.EventHandler(this.tb1URL_Leave);
//
// btnChooseDir
//
this.btnChooseDir.Location = new System.Drawing.Point(28, 20);
this.btnChooseDir.Name = "btnChooseDir";
this.btnChooseDir.Size = new System.Drawing.Size(75, 23);
this.btnChooseDir.TabIndex = 0;
this.btnChooseDir.Text = "...";
this.btnChooseDir.UseVisualStyleBackColor = true;
this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click);
//
// lblFormDir
//
this.lblFormDir.AutoSize = true;
this.lblFormDir.Location = new System.Drawing.Point(109, 23);
this.lblFormDir.Name = "lblFormDir";
this.lblFormDir.Size = new System.Drawing.Size(117, 17);
this.lblFormDir.TabIndex = 1;
this.lblFormDir.Text = "Choose Directory";
//
// panelTranslateFormItems // panelTranslateFormItems
// //
this.panelTranslateFormItems.Controls.Add(this.textBox1); this.panelTranslateFormItems.Controls.Add(this.textBox1);
this.panelTranslateFormItems.Controls.Add(this.tbFormItem1); this.panelTranslateFormItems.Controls.Add(this.tbFormItem1);
this.panelTranslateFormItems.Controls.Add(this.lblFormItem); this.panelTranslateFormItems.Controls.Add(this.lblFormItem);
this.panelTranslateFormItems.Controls.Add(this.comboBox1); 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, 88); this.panelTranslateFormItems.Location = new System.Drawing.Point(6, 88);
@ -242,38 +223,16 @@
this.panelTranslateFormItems.Size = new System.Drawing.Size(434, 338); this.panelTranslateFormItems.Size = new System.Drawing.Size(434, 338);
this.panelTranslateFormItems.TabIndex = 2; this.panelTranslateFormItems.TabIndex = 2;
// //
// cbFormLang1Choice // textBox1
// //
this.cbFormLang1Choice.FormattingEnabled = true; this.textBox1.AcceptsReturn = true;
this.cbFormLang1Choice.Location = new System.Drawing.Point(28, 89); this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.cbFormLang1Choice.Name = "cbFormLang1Choice"; | System.Windows.Forms.AnchorStyles.Right)));
this.cbFormLang1Choice.Size = new System.Drawing.Size(121, 24); this.textBox1.Location = new System.Drawing.Point(28, 257);
this.cbFormLang1Choice.TabIndex = 0; this.textBox1.Multiline = true;
// this.textBox1.Name = "textBox1";
// cbFormLang2Choice this.textBox1.Size = new System.Drawing.Size(384, 72);
// this.textBox1.TabIndex = 6;
this.cbFormLang2Choice.FormattingEnabled = true;
this.cbFormLang2Choice.Location = new System.Drawing.Point(28, 227);
this.cbFormLang2Choice.Name = "cbFormLang2Choice";
this.cbFormLang2Choice.Size = new System.Drawing.Size(121, 24);
this.cbFormLang2Choice.TabIndex = 1;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(106, 3);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(306, 24);
this.comboBox1.TabIndex = 3;
//
// lblFormItem
//
this.lblFormItem.AutoSize = true;
this.lblFormItem.Location = new System.Drawing.Point(21, 6);
this.lblFormItem.Name = "lblFormItem";
this.lblFormItem.Size = new System.Drawing.Size(34, 17);
this.lblFormItem.TabIndex = 4;
this.lblFormItem.Text = "Item";
// //
// tbFormItem1 // tbFormItem1
// //
@ -286,16 +245,57 @@
this.tbFormItem1.Size = new System.Drawing.Size(384, 72); this.tbFormItem1.Size = new System.Drawing.Size(384, 72);
this.tbFormItem1.TabIndex = 5; this.tbFormItem1.TabIndex = 5;
// //
// textBox1 // lblFormItem
// //
this.textBox1.AcceptsReturn = true; this.lblFormItem.AutoSize = true;
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.lblFormItem.Location = new System.Drawing.Point(21, 6);
| System.Windows.Forms.AnchorStyles.Right))); this.lblFormItem.Name = "lblFormItem";
this.textBox1.Location = new System.Drawing.Point(28, 257); this.lblFormItem.Size = new System.Drawing.Size(34, 17);
this.textBox1.Multiline = true; this.lblFormItem.TabIndex = 4;
this.textBox1.Name = "textBox1"; this.lblFormItem.Text = "Item";
this.textBox1.Size = new System.Drawing.Size(384, 72); //
this.textBox1.TabIndex = 6; // cbFormItemChoice
//
this.cbFormItemChoice.FormattingEnabled = true;
this.cbFormItemChoice.Location = new System.Drawing.Point(106, 3);
this.cbFormItemChoice.Name = "cbFormItemChoice";
this.cbFormItemChoice.Size = new System.Drawing.Size(306, 24);
this.cbFormItemChoice.TabIndex = 3;
//
// cbFormLang2Choice
//
this.cbFormLang2Choice.FormattingEnabled = true;
this.cbFormLang2Choice.Location = new System.Drawing.Point(28, 227);
this.cbFormLang2Choice.Name = "cbFormLang2Choice";
this.cbFormLang2Choice.Size = new System.Drawing.Size(121, 24);
this.cbFormLang2Choice.TabIndex = 1;
//
// cbFormLang1Choice
//
this.cbFormLang1Choice.FormattingEnabled = true;
this.cbFormLang1Choice.Location = new System.Drawing.Point(28, 89);
this.cbFormLang1Choice.Name = "cbFormLang1Choice";
this.cbFormLang1Choice.Size = new System.Drawing.Size(121, 24);
this.cbFormLang1Choice.TabIndex = 0;
//
// lblFormDir
//
this.lblFormDir.AutoSize = true;
this.lblFormDir.Location = new System.Drawing.Point(109, 23);
this.lblFormDir.Name = "lblFormDir";
this.lblFormDir.Size = new System.Drawing.Size(117, 17);
this.lblFormDir.TabIndex = 1;
this.lblFormDir.Text = "Choose Directory";
//
// btnChooseDir
//
this.btnChooseDir.Location = new System.Drawing.Point(28, 20);
this.btnChooseDir.Name = "btnChooseDir";
this.btnChooseDir.Size = new System.Drawing.Size(75, 23);
this.btnChooseDir.TabIndex = 0;
this.btnChooseDir.Text = "...";
this.btnChooseDir.UseVisualStyleBackColor = true;
this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click);
// //
// TranslationWindow // TranslationWindow
// //
@ -342,7 +342,7 @@
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox tbFormItem1; private System.Windows.Forms.TextBox tbFormItem1;
private System.Windows.Forms.Label lblFormItem; private System.Windows.Forms.Label lblFormItem;
private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ComboBox cbFormItemChoice;
private System.Windows.Forms.ComboBox cbFormLang2Choice; private System.Windows.Forms.ComboBox cbFormLang2Choice;
private System.Windows.Forms.ComboBox cbFormLang1Choice; private System.Windows.Forms.ComboBox cbFormLang1Choice;
private System.Windows.Forms.Label lblFormDir; private System.Windows.Forms.Label lblFormDir;

View File

@ -42,6 +42,9 @@ namespace EduNetworkBuilder
cb1Language.Items.Clear(); cb1Language.Items.Clear();
cb2Language.Items.Clear(); cb2Language.Items.Clear();
cbFormLang1Choice.Items.Clear();
cbFormLang2Choice.Items.Clear();
panelTranslateFormItems.Enabled = false; panelTranslateFormItems.Enabled = false;
NBSettings mySettings = NB.GetSettings(); NBSettings mySettings = NB.GetSettings();
@ -55,13 +58,18 @@ namespace EduNetworkBuilder
{ {
cb1Language.Items.Add(LanguageChoices[i, 0]); cb1Language.Items.Add(LanguageChoices[i, 0]);
cb2Language.Items.Add(LanguageChoices[i, 0]); cb2Language.Items.Add(LanguageChoices[i, 0]);
cbFormLang1Choice.Items.Add(LanguageChoices[i, 0]);
cbFormLang2Choice.Items.Add(LanguageChoices[i, 0]);
if (mySettings.LastTrans1Lang == LanguageChoices[i, 1]) if (mySettings.LastTrans1Lang == LanguageChoices[i, 1])
{ {
cb1Language.SelectedItem = LanguageChoices[i, 0]; cb1Language.SelectedItem = LanguageChoices[i, 0];
cbFormLang1Choice.SelectedItem = LanguageChoices[i, 0];
} }
if (mySettings.LastTrans2Lang == LanguageChoices[i, 1]) if (mySettings.LastTrans2Lang == LanguageChoices[i, 1])
{ {
cb2Language.SelectedItem = LanguageChoices[i, 0]; cb2Language.SelectedItem = LanguageChoices[i, 0];
cbFormLang2Choice.SelectedItem = LanguageChoices[i, 0];
} }
} }
if (cb1Language.SelectedIndex == -1) cb1Language.SelectedIndex = 0; if (cb1Language.SelectedIndex == -1) cb1Language.SelectedIndex = 0;
@ -299,6 +307,27 @@ namespace EduNetworkBuilder
TranslationResxFile TRF = new TranslationResxFile(currentFile); TranslationResxFile TRF = new TranslationResxFile(currentFile);
TranslationResxFiles.Add(TRF); TranslationResxFiles.Add(TRF);
} }
PopulateFormTranslationItems();
}
private void PopulateFormTranslationItems()
{
cbFormItemChoice.Items.Clear();
TranslationResxFile en = FileFromLangCode("en");
if(en != null)
{
foreach(TranslationItem TI in en.Items)
{
cbFormItemChoice.Items.Add(TI.Key);
}
}
}
private TranslationResxFile FileFromLangCode(string code)
{
foreach (TranslationResxFile one in TranslationResxFiles)
if (one.language == code) return one;
return null;
} }
private void btnChooseDir_Click(object sender, EventArgs e) private void btnChooseDir_Click(object sender, EventArgs e)
@ -332,7 +361,7 @@ namespace EduNetworkBuilder
public class TranslationResxFile public class TranslationResxFile
{ {
public string filename; public string filename;
List<TranslationItem> Items = new List<TranslationItem>(); public List<TranslationItem> Items = new List<TranslationItem>();
public string language = ""; public string language = "";
string beginning = "translated: "; string beginning = "translated: ";