コード例 #1
0
        private void AddReplace()
        {
            FormReplace frm = new FormReplace(null);

            if (frm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            ReplacementRuleItem item = frm.RuleItem;

            if (item == null)
            {
                return;
            }

            foreach (ReplacementRuleItem i in Program.ServiceMgt.Config.Replacement.Fields)
            {
                if (item.Table == i.Table &&
                    item.FieldName == i.FieldName)
                {
                    MessageBox.Show(this, "Field " + i.ToString() + " is already in the list.", "Warning",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            Program.ServiceMgt.Config.Replacement.Fields.Add(item);
            RefreshReplaceList();
        }
コード例 #2
0
        private void EditReplace()
        {
            if (this.listViewReplace.SelectedItems.Count < 1)
            {
                return;
            }

            ReplacementRuleItem f = this.listViewReplace.SelectedItems[0].Tag as ReplacementRuleItem;

            if (f == null)
            {
                return;
            }

            FormReplace frm = new FormReplace(f);

            if (frm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            RefreshReplaceList();
        }