コード例 #1
0
        void GridShortNamesCellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 2)
            {
                string       abbreviationText;
                Abbreviation abbreviation = gridShortNames.Rows[e.RowIndex].Cells["ColumnShortName"].Value as Abbreviation;
                if (EditValueDialog.ShowDialog(
                        this,
                        Strings.Abbreviation,
                        Strings.EnterAbbreviation,
                        abbreviation == null ? string.Empty : abbreviation.Name,
                        out abbreviationText))
                {
                    if (abbreviation == null)
                    {
                        abbreviation = new Abbreviation();
                    }

                    abbreviation.Name     = abbreviationText;
                    abbreviation.Language = (Language)gridShortNames.Rows[e.RowIndex].Tag;
                    gridShortNames.Rows[e.RowIndex].Cells["ColumnShortName"].Value = abbreviation;
                    gridShortNames.Refresh();
                }
            }
        }
コード例 #2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var lvi = listView.SelectedItems;
                if (lvi[0] == null)
                {
                    MessageBox.Show("Select at least one item");
                    return;
                }

                RegistryValue value = lvi[0] as RegistryValue;
                RegistryKey   currentRegistryKey = GetCurrentRegistryKey();

                if (currentRegistryKey == null)
                {
                    return;
                }

                EditValueDialog dialog = new EditValueDialog(currentRegistryKey, value.Name);
                dialog.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
 void ButtonAddTenseClick(object sender, EventArgs e)
 {
     if (listLang.SelectedIndex != -1)
     {
         string tenseName;
         if (EditValueDialog.ShowDialog(this, Strings.TenseNameHeader, Strings.TenseNameEnter, string.Empty, out tenseName))
         {
             KryptonListItem item     = (KryptonListItem)this.listLang.Items[this.listLang.SelectedIndex];
             Language        language = (Language)item.Tag;
             listTenses.Items.Add(language.AddTense(tenseName));
         }
     }
 }
コード例 #4
0
        void ButtonChangeTenseClick(object sender, EventArgs e)
        {
            if (listLang.SelectedIndex != -1 && listTenses.SelectedIndex != -1)
            {
                string tenseName;
                Tense  selected_tense = (Tense)listTenses.SelectedItem;
                if (EditValueDialog.ShowDialog(this, Strings.TenseNameHeader, Strings.TenseNameEnter, selected_tense.Name, out tenseName))
                {
                    KryptonListItem item     = (KryptonListItem)listLang.Items[this.listLang.SelectedIndex];
                    Language        language = (Language)item.Tag;

                    selected_tense.Name = tenseName;
                    listTenses.Refresh();
                }
            }
        }