//add method for contact
        private void buttonAddContact_Click(object sender, EventArgs e)
        {
            Form contactOverlay = new Form();

            try
            {
                using (AddContactView addContact = new AddContactView())
                {
                    addContact.setId(user_id);
                    contactOverlay.StartPosition   = FormStartPosition.Manual;
                    contactOverlay.FormBorderStyle = FormBorderStyle.None;
                    contactOverlay.Opacity         = .50d;
                    contactOverlay.BackColor       = Color.Black;
                    contactOverlay.WindowState     = FormWindowState.Maximized;
                    contactOverlay.TopMost         = true;
                    contactOverlay.Location        = this.Location;
                    contactOverlay.ShowInTaskbar   = false;
                    contactOverlay.Show();

                    addContact.Owner = contactOverlay;
                    addContact.ShowDialog();

                    contactOverlay.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                contactOverlay.Dispose();
                loadContactData();
                loadTotalContact();
            }
        }
Example #2
0
        void OnAddContactClick(object sender, EventArgs e)
        {
            var addContactDialogBox = new AddContactView(this, ((ContactsViewModel)this.DataContext).AddContactViewModel);

            addContactDialogBox.ShowDialog();
        }