Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                CharTitlesEntry t = new CharTitlesEntry
                {
                    Id = DBCStores.CharTitles.MaxKey + 1,
                    ConditionId = 0,
                    NameMale = Loc.GetString("NewTitle"),
                    NameFemale = Loc.GetString("NewTitle"),
                    TitleMaskId = DBCStores.CharTitles.Records.Max(ti => ti.TitleMaskId) + 1,
                };

                listTitles.Items.Add(t);
                DBCStores.CharTitles.AddEntry(t.Id, t);

                listTitles.SelectedIndex = listTitles.Items.Count - 1;
            }
            catch (Exception)
            {
                MessageBox.Show(Loc.GetString("AddTitleError"));
            }
        }
Exemplo n.º 2
0
        private void button_titleAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CharTitlesEntry t = new CharTitlesEntry
                {
                    Id = DBCStores.CharTitles.MaxKey + 1,
                    ConditionId = 0,
                    NameMale = textbox_titleMaleName.Text,
                    NameFemale = textbox_titleFemaleName.Text,
                    TitleMaskId = DBCStores.CharTitles.Records.Max(ti => ti.TitleMaskId) + 1,
                };

                listTitles.Items.Add(t);
                DBCStores.CharTitles.AddEntry(t.Id, t);

                listTitles.SelectedIndex = listTitles.Items.Count - 1;
            }
            catch (Exception)
            {
                this.ShowMessageAsync("Error", "Failed to add a new title.");
            }
        }