Exemple #1
0
        private void TextTable_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (textTable.SelectedCells.Count > 0)
            {
                string langCode = textTable[grid_lang.Index, e.RowIndex].Value.ToString();

                StringEditor stringEditor = new StringEditor("Insert the text to display - " + langCode);

                stringEditor.textBox.Text =
                    textTable[grid_content.Index, e.RowIndex].Value.ToString();

                if (stringEditor.ShowDialog() == DialogResult.OK)
                {
                    if (stringEditor.textBox.Text.Length == 0)
                    {
                        Funcs.Error("The label text must be at least 1 character long !");
                    }
                    else
                    {
                        Target.ContentTable[langCode] = stringEditor.textBox.Text;
                    }
                }

                textTable[grid_content.Index, e.RowIndex].Value = Target.ContentTable[langCode];
                LivePreview.Update();
            }
        }
        private void Lab_preview_Click(object sender, EventArgs e)
        {
            StringEditor stringEditor = new StringEditor();

            stringEditor.textBox.Text = lab_preview.Text;

            if (stringEditor.ShowDialog() == DialogResult.OK)
            {
                lab_preview.Text = stringEditor.textBox.Text;
            }
        }
        private void Btn_edit_name_Click(object sender, EventArgs e)
        {
            if (fontsTable.SelectedCells.Count > 0)
            {
                string fontID = fontsTable[grid_id.Index, fontsTable.SelectedCells[0].RowIndex].Value.ToString();

                StringEditor stringEditor = new StringEditor();
                stringEditor.textBox.Text = Fonts.fontList[fontID].CustomName;

                if (stringEditor.ShowDialog() == DialogResult.OK)
                {
                    Fonts.fontList[fontID].CustomName = stringEditor.textBox.Text;
                    LoadFonts();
                }
            }
        }
        private void Btn_add_lang_Click(object sender, EventArgs e)
        {
            StringEditor stringEditor = new StringEditor("Insert a language code :");

            if (stringEditor.ShowDialog() == DialogResult.OK)
            {
                foreach (string l in Languages.UsedLanguages)
                {
                    if (l == stringEditor.textBox.Text)
                    {
                        Funcs.Information("You can't add a language twice!");
                        return;
                    }
                }
            }

            Languages.UsedLanguages.Add(stringEditor.textBox.Text);
            Objects.AddLanguage(stringEditor.textBox.Text);
            LoadLanguages();
        }