Пример #1
0
        private void OnEditEntry(object sender, EventArgs e)
        {
            if (lvTranslations.SelectedItems.Count == 1)
            {
                TranslationItem ti = lvTranslations.SelectedItems[0].Tag as TranslationItem;
                if (ti != null && _tf.Items.ContainsKey(ti.StringName))
                {
                    string oldName = ti.StringName;

                    EntryNameDialog dlg = new EntryNameDialog(oldName, ti.BaseString, ti.TranslatedString, chkReadOnly.Checked, cmbLanguage.Text);
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        ti.StringName       = dlg.EntryName;
                        ti.BaseString       = dlg.EnglishString;
                        ti.TranslatedString = dlg.TranslatedString;

                        _tf.Items.Remove(oldName);
                        _tf.Items.Add(ti.StringName, ti);

                        lvTranslations.SelectedItems[0].SubItems[0].Text = ti.StringName;
                        lvTranslations.SelectedItems[0].SubItems[1].Text = ti.BaseString;
                        lvTranslations.SelectedItems[0].SubItems[2].Text = ti.TranslatedString;
                    }
                }
            }
        }
Пример #2
0
        private void OnNewEntry(object sender, EventArgs e)
        {
            EntryNameDialog dlg = new EntryNameDialog("TXT_ENTRY_NAME", "", "", chkReadOnly.Checked, cmbLanguage.Text);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TranslationItem ti = new TranslationItem(string.Empty);
                ti.StringName       = dlg.EntryName;
                ti.BaseString       = dlg.EnglishString;
                ti.TranslatedString = dlg.TranslatedString;

                _tf.Items.Add(ti.StringName, ti);

                ListViewItem item = new ListViewItem(new string[]
                {
                    ti.StringName, ti.BaseString, ti.TranslatedString
                });

                item.Tag = ti;
                lvTranslations.Items.Add(item);

                lvTranslations.SelectedItems.Clear();
                item.Selected = true;

                lvTranslations.EnsureVisible(item.Index);
            }
        }
Пример #3
0
        private void OnEditEntry(object sender, EventArgs e)
        {
            if (lvTranslations.SelectedItems.Count == 1)
            {
                TranslationItem ti = lvTranslations.SelectedItems[0].Tag as TranslationItem;
                if (ti != null && _tf.Items.ContainsKey(ti.StringName))
                {
                    string oldName = ti.StringName;

                    EntryNameDialog dlg = new EntryNameDialog(oldName, ti.BaseString, ti.TranslatedString, chkReadOnly.Checked, cmbLanguage.Text);
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        ti.StringName = dlg.EntryName;
                        ti.BaseString = dlg.EnglishString;
                        ti.TranslatedString = dlg.TranslatedString;

                        _tf.Items.Remove(oldName);
                        _tf.Items.Add(ti.StringName, ti);

                        lvTranslations.SelectedItems[0].SubItems[0].Text = ti.StringName;
                        lvTranslations.SelectedItems[0].SubItems[1].Text = ti.BaseString;
                        lvTranslations.SelectedItems[0].SubItems[2].Text = ti.TranslatedString;
                    }
                }
            }
        }
Пример #4
0
        private void OnNewEntry(object sender, EventArgs e)
        {
            EntryNameDialog dlg = new EntryNameDialog("TXT_ENTRY_NAME", "", "", chkReadOnly.Checked, cmbLanguage.Text);
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TranslationItem ti = new TranslationItem(string.Empty);
                ti.StringName = dlg.EntryName;
                ti.BaseString = dlg.EnglishString;
                ti.TranslatedString = dlg.TranslatedString;

                _tf.Items.Add(ti.StringName, ti);

                ListViewItem item = new ListViewItem(new string[]
                {
                    ti.StringName, ti.BaseString, ti.TranslatedString
                });

                item.Tag = ti;
                lvTranslations.Items.Add(item);

                lvTranslations.SelectedItems.Clear();
                item.Selected = true;

                lvTranslations.EnsureVisible(item.Index);
            }
        }