private void toolStripMoveRecordUp_Click(object sender, EventArgs e)
        {
            if (listSubrecord.SelectedIndices.Count < 1)
            {
                return;
            }
            int idx = listSubrecord.SelectedIndices[0];

            if (idx < 1 || idx >= (listSubrecord.Items.Count))
            {
                return;
            }

            var rec = Selection.Record as Record;

            if (rec != null)
            {
                SubRecord sr = subrecords[idx];
                SelectIndex(idx - 1);
                subrecords.RemoveAt(idx);
                subrecords.Insert(idx - 1, sr);

                Selection.SubRecord = GetSelectedSubrecord();
                rec.MatchRecordStructureToRecord(SubRecords.ToArray());
                FireDataChanged();
            }
        }
Esempio n. 2
0
        public override void InsertRecord(int idx, BaseRecord br)
        {
            var sr = br as SubRecord;

            if (sr == null)
            {
                throw new TESParserException("Record to add was not of the correct type." +
                                             Environment.NewLine + "Records can only hold Subrecords.");
            }
            sr.Parent = this;
            SubRecords.Insert(idx, sr);
        }