Esempio n. 1
0
 public void CreateManyPersonInfo()
 {
     for (int count = 0; count < 1000; count += 1)
     {
         PersonInfo info = new PersonInfo("Fred", 123);
         info.Dispose();
     }
 }
Esempio n. 2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.AppStarting;
            var frm = new PersonInfo(person);

            frm.Location      = this.ParentForm.Location;
            frm.StartPosition = FormStartPosition.Manual;
            frm.FormClosing  += delegate { frm.Dispose(); Program.CloseAllButSearch(); };
            frm.KeyDown      += new KeyEventHandler((s, key) =>
            {
                if (key.KeyCode == Keys.X)
                {
                    Console.WriteLine("key pressed");
                    this.FindForm().Show();
                    frm.Close();
                    frm.Dispose();
                }
            });
            frm.Show();
            this.ParentForm.Hide();
        }