private void bt_Modify_Click(object sender, EventArgs e)
 {
     using (ModifyForm mf = new ModifyForm()) //caozuo是窗口类名,确保访问;后面的是构造函数
     {
         mf.ShowDialog();
     }
 }
Example #2
0
        private void ShowModifyForm(object sender, EventArgs e)
        {
            Control    c = (Control)sender;
            JSONNode   n = (JSONNode)c.Tag;
            ModifyForm m = new ModifyForm(n, c);

            m.baseForm = this;
            m.Show(this);
        }
 private void EditToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var inst = (Modify.InstructionData) illist.SelectedItem;
     if (inst == null) return;
     using (var form = new ModifyForm((Modify)Hook, method, inst))
     {
         if (form.ShowDialog(PatcherForm.MainForm) != DialogResult.OK) return;
         ((BindingSource)illist.DataSource).ResetBindings(false);
         NotifyChanges();
     }
 }
 private void NewToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var form = new ModifyForm((Modify)Hook, method))
     {
         if (form.ShowDialog(PatcherForm.MainForm) != DialogResult.OK) return;
         if (form.Instruction == null) return;
         var index = illist.SelectedIndex + form.Index;
         index = index >= 0 ? index > illist.Items.Count ? illist.Items.Count - 1 : index : 0;
         var hook = (Modify)Hook;
         hook.Instructions.Insert(index, form.Instruction);
         ((BindingSource)illist.DataSource).ResetBindings(false);
         NotifyChanges();
     }
 }
        private void EditToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var inst = (Modify.InstructionData)illist.SelectedItem;

            if (inst == null)
            {
                return;
            }
            using (var form = new ModifyForm((Modify)Hook, method, inst))
            {
                if (form.ShowDialog(PatcherForm.MainForm) != DialogResult.OK)
                {
                    return;
                }
                ((BindingSource)illist.DataSource).ResetBindings(false);
                NotifyChanges();
            }
        }
        private void ModifyButton_Click(object sender, EventArgs e)
        {
            using (var form = new ModifyForm(Field, TargetTypeText.Text))
            {
                if (form.ShowDialog(PatcherForm.MainForm) != DialogResult.OK)
                {
                    return;
                }
                if (form.Instruction == null)
                {
                    return;
                }
                TargetTypeText.Text = form.Instruction.Operand.ToString();

                Field.FieldType = TargetTypeText.Text;
                Controller.ApplyButton.Enabled = true;
            }
        }
 private void NewToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var form = new ModifyForm((Modify)Hook, method))
     {
         if (form.ShowDialog(PatcherForm.MainForm) != DialogResult.OK)
         {
             return;
         }
         if (form.Instruction == null)
         {
             return;
         }
         var index = illist.SelectedIndex + form.Index;
         index = index >= 0 ? index > illist.Items.Count ? illist.Items.Count - 1 : index : 0;
         var hook = (Modify)Hook;
         hook.Instructions.Insert(index, form.Instruction);
         ((BindingSource)illist.DataSource).ResetBindings(false);
         NotifyChanges();
     }
 }