public void RemoveCodexSection() { if (CodexSections == null || SelectedCodexSection.Value == null) { return; } var index = CodexSections.IndexOf(SelectedCodexSection); if (!CodexSections.Remove(SelectedCodexSection)) { return; } if (CodexSections.Any()) { SelectedCodexSection = ((index - 1) >= 0) ? CodexSections[index - 1] : CodexSections.First(); } }
public void ChangeCodexSectionId() { if (SelectedCodexSection.Value == null) { return; } var dlg = new ChangeObjectIdDialog { ContentText = string.Format("Change id of codex section #{0}", SelectedCodexSection.Key), ObjectId = SelectedCodexSection.Key }; if (dlg.ShowDialog() == false || dlg.ObjectId < 0 || dlg.ObjectId == SelectedCodexSection.Key) { return; } var codexSection = SelectedCodexSection.Value; CodexSections.Remove(SelectedCodexSection); AddCodexSection(dlg.ObjectId, codexSection); }