コード例 #1
0
ファイル: Record.cs プロジェクト: benamehdi7/tesv-snip
        public override bool DeleteRecord(BaseRecord br)
        {
            var sr = br as SubRecord;

            if (sr == null)
            {
                return(false);
            }
            return(SubRecords.Remove(sr));
        }
コード例 #2
0
        private void btnDeleteString_Click(object sender, EventArgs e)
        {
            uint uiID;
            LocalizedStringFormat format;
            Plugin plugin;
            string text = txtString.Text;

            if (!TryGetCurrentID(out uiID))
            {
                MessageBox.Show(this, "ID Field is invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!TryGetCurrentFormat(out format))
            {
                MessageBox.Show(this, "Format is invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!TryGetCurrentPlugin(out plugin))
            {
                MessageBox.Show(this, "Plugin is invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            bool doResize = strings.Count == 0;

            StringHolder str = strings.FirstOrDefault(
                a => (a.ID == uiID && a.Plugin.Equals(plugin) && a.Format == format));

            if (str != null)
            {
                strings.Remove(str);
            }

            StringHolder remStr = remStrings.FirstOrDefault(
                a => (a.ID == uiID && a.Plugin.Equals(plugin) && a.Format == format));

            if (remStr == null)
            {
                remStrings.Add(str);
            }

            if (doResize)
            {
                FitColumns();
            }

            UpdateStatusBar();
        }