Exemplo n.º 1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                NewContactWIndow ncw = new NewContactWIndow();
                ncw.Owner = this;
                ncw.ShowDialog();

                MessageBox.Show("預覽名片");
                ContactWindow cw = new ContactWindow(ncw.contact);
                cw.Owner = this;
                cw.ShowDialog();

                AddContact(ncw.contact);
                return;

                string fn = tbName.Text;
                string ln = tbEmail.Text;
                if (string.IsNullOrEmpty(fn) || string.IsNullOrEmpty(ln))
                {
                    MessageBox.Show("empty field!");
                    return;
                }
                AddContact(fn, ln);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Console.WriteLine(ex);
            }
        }
Exemplo n.º 2
0
        protected void ItemDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DisplayContact dc = ((ListViewItem)sender).Content as DisplayContact;

            if (dc != null)
            {
                ContactWindow window = new ContactWindow(dc.contact);
                window.Owner = GetWindow(this);
                window.ShowDialog();
            }
        }