Example #1
0
 void OpenPreview(Citizen citizen)
 {
     if (citizen == null)
     {
         MessageBox.Show("User not found.");
         return;
     }
     using (var preview = new Preview())
     {
         preview.AcceptDetails(citizen);
         preview.OnRecordDeleted += Preview_OnRecordDeleted;
         preview.ShowDialog();
     }
 }
Example #2
0
 void OpenPreview(Citizen citizen)
 {
     if (citizen == null)
     {
         MessageBox.Show("User not found.");
         return;
     }
     if (preview == null)
     {
         preview = new Preview();
         preview.AcceptDetails(citizen);
         preview.FormClosing     += (a, b) => { preview = null; };
         preview.OnRecordDeleted += (a, b) => { searchBtn.PerformClick(); };
         preview.Show();
     }
     else
     {
         preview.AcceptDetails(citizen);
         preview.BringToFront();
     }
 }
        private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;
            object       val = dgv.Rows[e.RowIndex].Cells[1].Value;

            if (val == null || string.IsNullOrEmpty(val.ToString()))
            {
                return;
            }

            Citizen citizen = null;

            if (CitizenExtensions.CitizenById(val.ToString(), out citizen))
            {
                Preview prev = new Preview();
                prev.AcceptDetails(citizen);
                prev.FormClosed += (ss, ee) => { Enabled = true; };
                Enabled          = false;
                prev.Show();
                return;
            }
            MessageBox.Show("Entry not found");
        }