able to save translated state of items

This commit is contained in:
Tim Young 2017-11-01 08:19:09 -05:00
parent 8e2d54e924
commit bd4f3af010
2 changed files with 56 additions and 36 deletions

View File

@ -42,9 +42,8 @@
this.tb1URL = new System.Windows.Forms.TextBox();
this.tb2URL = new System.Windows.Forms.TextBox();
this.tpFormStuff = new System.Windows.Forms.TabPage();
this.cbFormShowTranslated = new System.Windows.Forms.CheckBox();
this.cbFormHighPriority = new System.Windows.Forms.CheckBox();
this.panelTranslateFormItems = new System.Windows.Forms.Panel();
this.cbFormItemTranslated = new System.Windows.Forms.CheckBox();
this.tbFormItem2 = new System.Windows.Forms.TextBox();
this.tbFormItem1 = new System.Windows.Forms.TextBox();
this.lblFormItem = new System.Windows.Forms.Label();
@ -53,8 +52,9 @@
this.cbFormLang1Choice = new System.Windows.Forms.ComboBox();
this.lblFormDir = new System.Windows.Forms.Label();
this.btnChooseDir = new System.Windows.Forms.Button();
this.cbFormItemTranslated = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cbFormHighPriority = new System.Windows.Forms.CheckBox();
this.cbFormShowTranslated = new System.Windows.Forms.CheckBox();
this.tcTabPages.SuspendLayout();
this.tpMessageTitle.SuspendLayout();
this.tpFormStuff.SuspendLayout();
@ -216,28 +216,6 @@
this.tpFormStuff.Text = "Forms";
this.tpFormStuff.UseVisualStyleBackColor = true;
//
// cbFormShowTranslated
//
this.cbFormShowTranslated.AutoSize = true;
this.cbFormShowTranslated.Location = new System.Drawing.Point(230, 8);
this.cbFormShowTranslated.Name = "cbFormShowTranslated";
this.cbFormShowTranslated.Size = new System.Drawing.Size(150, 21);
this.cbFormShowTranslated.TabIndex = 4;
this.cbFormShowTranslated.Text = "Already Translated";
this.cbFormShowTranslated.UseVisualStyleBackColor = true;
//
// cbFormHighPriority
//
this.cbFormHighPriority.AutoSize = true;
this.cbFormHighPriority.Checked = true;
this.cbFormHighPriority.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbFormHighPriority.Location = new System.Drawing.Point(100, 7);
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;
//
// panelTranslateFormItems
//
this.panelTranslateFormItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -255,6 +233,17 @@
this.panelTranslateFormItems.Size = new System.Drawing.Size(512, 307);
this.panelTranslateFormItems.TabIndex = 2;
//
// cbFormItemTranslated
//
this.cbFormItemTranslated.AutoSize = true;
this.cbFormItemTranslated.Location = new System.Drawing.Point(221, 178);
this.cbFormItemTranslated.Name = "cbFormItemTranslated";
this.cbFormItemTranslated.Size = new System.Drawing.Size(98, 21);
this.cbFormItemTranslated.TabIndex = 7;
this.cbFormItemTranslated.Text = "Translated";
this.cbFormItemTranslated.UseVisualStyleBackColor = true;
this.cbFormItemTranslated.CheckedChanged += new System.EventHandler(this.cbFormItemTranslated_CheckedChanged);
//
// tbFormItem2
//
this.tbFormItem2.AcceptsReturn = true;
@ -329,16 +318,6 @@
this.btnChooseDir.UseVisualStyleBackColor = true;
this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click);
//
// cbFormItemTranslated
//
this.cbFormItemTranslated.AutoSize = true;
this.cbFormItemTranslated.Location = new System.Drawing.Point(221, 178);
this.cbFormItemTranslated.Name = "cbFormItemTranslated";
this.cbFormItemTranslated.Size = new System.Drawing.Size(98, 21);
this.cbFormItemTranslated.TabIndex = 7;
this.cbFormItemTranslated.Text = "Translated";
this.cbFormItemTranslated.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.cbFormHighPriority);
@ -350,6 +329,28 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Show";
//
// cbFormHighPriority
//
this.cbFormHighPriority.AutoSize = true;
this.cbFormHighPriority.Checked = true;
this.cbFormHighPriority.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbFormHighPriority.Location = new System.Drawing.Point(100, 7);
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;
//
// cbFormShowTranslated
//
this.cbFormShowTranslated.AutoSize = true;
this.cbFormShowTranslated.Location = new System.Drawing.Point(230, 8);
this.cbFormShowTranslated.Name = "cbFormShowTranslated";
this.cbFormShowTranslated.Size = new System.Drawing.Size(150, 21);
this.cbFormShowTranslated.TabIndex = 4;
this.cbFormShowTranslated.Text = "Already Translated";
this.cbFormShowTranslated.UseVisualStyleBackColor = true;
//
// TranslationWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);

View File

@ -368,7 +368,15 @@ namespace EduNetworkBuilder
return null;
}
private void btnChooseDir_Click(object sender, EventArgs e)
private TranslationItem GetEditedTranslationItem()
{
string code = CodeFromLang(cbFormLang1Choice.Text);
TranslationResxFile TRf = FileFromLangCode(code);
TranslationItem TI = ItemFromKey(TRf, cbFormItemChoice.Text);
return TI;
}
private void btnChooseDir_Click(object sender, EventArgs e)
{
string startingDir = FormChosenDir;
if (FormChosenDir == "" && File.Exists(myNet.NetworkFilename))
@ -402,9 +410,20 @@ namespace EduNetworkBuilder
if (TRf != null && TI != null)
{
tbFormItem2.Text = TI.Value;
cbFormItemTranslated.Checked = TI.translated;
}
}
private void cbFormItemTranslated_CheckedChanged(object sender, EventArgs e)
{
TranslationItem TI = GetEditedTranslationItem();
if(TI != null)
{
TI.translated = cbFormItemTranslated.Checked;
ChangedFormData = true;
}
}
}
#region TranslationClasses