private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "build") { if (e.Url.LocalPath == "profile") { e.Cancel = true; MagicItemProfileForm dlg = new MagicItemProfileForm(fMagicItem); if (dlg.ShowDialog() == DialogResult.OK) { fMagicItem.Name = dlg.MagicItem.Name; fMagicItem.Level = dlg.MagicItem.Level; fMagicItem.Type = dlg.MagicItem.Type; fMagicItem.Rarity = dlg.MagicItem.Rarity; update_statblock(); } } if (e.Url.LocalPath == "desc") { e.Cancel = true; DetailsForm dlg = new DetailsForm(fMagicItem.Description, "Description", null); if (dlg.ShowDialog() == DialogResult.OK) { fMagicItem.Description = dlg.Details; update_statblock(); } } } if (e.Url.Scheme == "section") { e.Cancel = true; if (e.Url.LocalPath == "new") { MagicItemSection section = new MagicItemSection(); section.Header = "New Section"; MagicItemSectionForm dlg = new MagicItemSectionForm(section); if (dlg.ShowDialog() == DialogResult.OK) { fMagicItem.Sections.Add(dlg.Section); update_statblock(); } } } if (e.Url.Scheme == "edit") { e.Cancel = true; int index = int.Parse(e.Url.LocalPath); MagicItemSectionForm dlg = new MagicItemSectionForm(fMagicItem.Sections[index]); if (dlg.ShowDialog() == DialogResult.OK) { fMagicItem.Sections[index] = dlg.Section; update_statblock(); } } if (e.Url.Scheme == "remove") { e.Cancel = true; int index = int.Parse(e.Url.LocalPath); fMagicItem.Sections.RemoveAt(index); update_statblock(); } if (e.Url.Scheme == "moveup") { e.Cancel = true; int index = int.Parse(e.Url.LocalPath); MagicItemSection tmp = fMagicItem.Sections[index - 1]; fMagicItem.Sections[index - 1] = fMagicItem.Sections[index]; fMagicItem.Sections[index] = tmp; update_statblock(); } if (e.Url.Scheme == "movedown") { e.Cancel = true; int index = int.Parse(e.Url.LocalPath); MagicItemSection tmp = fMagicItem.Sections[index + 1]; fMagicItem.Sections[index + 1] = fMagicItem.Sections[index]; fMagicItem.Sections[index] = tmp; update_statblock(); } }
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "build") { if (e.Url.LocalPath == "profile") { e.Cancel = true; MagicItemProfileForm magicItemProfileForm = new MagicItemProfileForm(this.fMagicItem); if (magicItemProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fMagicItem.Name = magicItemProfileForm.MagicItem.Name; this.fMagicItem.Level = magicItemProfileForm.MagicItem.Level; this.fMagicItem.Type = magicItemProfileForm.MagicItem.Type; this.fMagicItem.Rarity = magicItemProfileForm.MagicItem.Rarity; this.update_statblock(); } } if (e.Url.LocalPath == "desc") { e.Cancel = true; DetailsForm detailsForm = new DetailsForm(this.fMagicItem.Description, "Description", null); if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fMagicItem.Description = detailsForm.Details; this.update_statblock(); } } } if (e.Url.Scheme == "section") { e.Cancel = true; if (e.Url.LocalPath == "new") { MagicItemSectionForm magicItemSectionForm = new MagicItemSectionForm(new MagicItemSection() { Header = "New Section" }); if (magicItemSectionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fMagicItem.Sections.Add(magicItemSectionForm.Section); this.update_statblock(); } } } if (e.Url.Scheme == "edit") { e.Cancel = true; int section = int.Parse(e.Url.LocalPath); MagicItemSectionForm magicItemSectionForm1 = new MagicItemSectionForm(this.fMagicItem.Sections[section]); if (magicItemSectionForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fMagicItem.Sections[section] = magicItemSectionForm1.Section; this.update_statblock(); } } if (e.Url.Scheme == "remove") { e.Cancel = true; int num = int.Parse(e.Url.LocalPath); this.fMagicItem.Sections.RemoveAt(num); this.update_statblock(); } if (e.Url.Scheme == "moveup") { e.Cancel = true; int item = int.Parse(e.Url.LocalPath); MagicItemSection magicItemSection = this.fMagicItem.Sections[item - 1]; this.fMagicItem.Sections[item - 1] = this.fMagicItem.Sections[item]; this.fMagicItem.Sections[item] = magicItemSection; this.update_statblock(); } if (e.Url.Scheme == "movedown") { e.Cancel = true; int item1 = int.Parse(e.Url.LocalPath); MagicItemSection magicItemSection1 = this.fMagicItem.Sections[item1 + 1]; this.fMagicItem.Sections[item1 + 1] = this.fMagicItem.Sections[item1]; this.fMagicItem.Sections[item1] = magicItemSection1; this.update_statblock(); } }