private void keywords_ItemCheck(object sender, ItemCheckEventArgs e) { if (!handle) { return; } HistoryManager?.MakeHistory(null); if (e.NewValue == CheckState.Checked && e.CurrentValue == CheckState.Unchecked) { Keyword kw = keywords.Items[e.Index] as Keyword; DialogResult d = DialogResult.OK; if (kw is Material) { kw = new Material(); d = new KeywordForms.MaterialForm(kw as Material).ShowDialog(); } if (kw is Range) { kw = new Range(10, 20); d = new KeywordForms.RangeForm(kw as Range).ShowDialog(); } if (kw is Versatile) { kw = new Versatile("1d8"); d = new KeywordForms.VersatileForm(kw as Versatile).ShowDialog(); } if (kw is Save) { kw = new Save(Ability.None); d = new KeywordForms.SaveForm(kw as Save).ShowDialog(); } if (d != DialogResult.Abort && d != DialogResult.Cancel) { items.Add(kw); } } else if (e.NewValue == CheckState.Unchecked && e.CurrentValue == CheckState.Checked) { items.Remove(keywords.Items[e.Index] as Keyword); } this.BeginInvoke((MethodInvoker)( () => setItems())); }
public VersatileForm(Versatile m) { InitializeComponent(); textBox1.DataBindings.Add("Text", m, "Damage", true, DataSourceUpdateMode.OnPropertyChanged); }