Ejemplo n.º 1
0
        private void listTranslateStrings_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label == null)
            {
                return;
            }
            string name = listDefaultStrings.Items[e.Item].Text;

            if (_editList.ContainsKey(name))
            {
                _editList[name]._text = e.Label;
            }
            else
            {
                StringLocalized newString = new StringLocalized();
                newString._name = name;
                newString._text = e.Label;
                _editList.Add(name, newString);
            }
            btnSave.Enabled  = true;
            _modifiedSection = true;
            DrawTargetList();

            // Hi James - please add something like that but matching to your concept how it should work ;)
            //if (listTranslateStrings.Items[_lastSelected].Index == _editList.Count - 2)
            //{
            //  if (listDefaultStrings.Items.Count >= _editList.Count)
            //  {
            //    listTranslateStrings.Items[_editList.Count - 1].Text = listDefaultStrings.Items[_lastSelected + 1].Text;
            //    listTranslateStrings.Items[_lastSelected + 1].BeginEdit();
            //  }
            //}
        }
Ejemplo n.º 2
0
        private void btnAddString_Click(object sender, EventArgs e)
        {
            if (_textBoxNewString.Text == String.Empty)
            {
                return;
            }

            if (tvCreateSections.SelectedNode != null)
            {
                if (!_defaultStrings._sections[tvCreateSections.SelectedNode.Index].IsString(_textBoxNewString.Text))
                {
                    StringLocalized str = new StringLocalized();
                    str._name = _textBoxNewString.Text;
//          str.isNew = true;
                    _defaultStrings._sections[tvCreateSections.SelectedNode.Index].LocalizedStrings.Add(str);
                    ListViewItem lvi = new ListViewItem(str.Text);
                    lvi.SubItems.Add(str.StringName);
                    lvCreateStrings.Items.Add(lvi);

                    _textBoxNewString.Text    = string.Empty;
                    btnSaveNewStrings.Enabled = true;
                }
                else
                {
                    MessageBox.Show("A String with the same name already exists", "String Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("No Section selected", "String Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }