示例#1
0
        private void bt_add_Click(object sender, EventArgs e)
        {
            DialogAdd wndAdd = new DialogAdd(notes, true);

            wndAdd.ShowDialog();
            ShowNotes();
        }
示例#2
0
        private void bt_search_Click(object sender, EventArgs e)
        {
            if (txtBx_surname.Text.Length == 0 || txtBx_name.Text.Length == 0)
            {
                lb_warning.ForeColor = Color.Red;
                lb_warning.Text      = "ВСЕ ПОЛЯ ДОЛЖНЫ БЫТЬ ЗАПОЛНЕНЫ!";
                lb_warning.Visible   = true;
                TimerCallback          tmclb = new TimerCallback(BackVisible);
                System.Threading.Timer tmp   = new System.Threading.Timer(tmclb, null, 1000, 0);
                return;
            }
            int idx = notes.SearchBySurnameAndName(txtBx_surname.Text, txtBx_name.Text);

            if (idx < 0)
            {
                lb_warning.ForeColor = Color.Red;
                lb_warning.Text      = "ЗАПИСЬ НЕ НАЙДЕНА :(";
                lb_warning.Visible   = true;
                TimerCallback          tmclb = new TimerCallback(BackVisible);
                System.Threading.Timer tmp   = new System.Threading.Timer(tmclb, null, 1000, 0);
                return;
            }
            DialogAdd dlg = new DialogAdd(notes, false, idx);

            notes.removeNote(idx);
            dlg.ShowDialog();
            notes = dlg.GetNotes();
            Close();
        }