Beispiel #1
0
        // 修改名字和注释
        void menu_Modify(object sender, System.EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择拟修改的模板记录事项...");
                return;
            }
            TemplateRecordDlg dlg = new TemplateRecordDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            string strOldName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);

            dlg.textBox_name.Text    = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);
            dlg.textBox_comment.Text = ListViewUtil.GetItemText(listView1.SelectedItems[0], 1);

            dlg.ShowDialog(this);
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            string strError = "";
            int    nRet     = ChangeRecordProperty(strOldName,
                                                   dlg.textBox_name.Text,
                                                   dlg.textBox_comment.Text,
                                                   out strError);

            if (nRet == -1)
            {
                MessageBox.Show(this, strError);
                return;
            }

            FillList(false);
        }
		// 修改名字和注释
		void menu_Modify(object sender, System.EventArgs e)
		{
			if (listView1.SelectedItems.Count == 0)
			{
                MessageBox.Show(this, "尚未选择拟修改的模板记录事项...");
				return;
			}
			TemplateRecordDlg dlg = new TemplateRecordDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

			string strOldName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);

			dlg.textBox_name.Text = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);
			dlg.textBox_comment.Text = ListViewUtil.GetItemText(listView1.SelectedItems[0], 1);

			dlg.ShowDialog(this);
			if (dlg.DialogResult != DialogResult.OK)
				return;

			string strError = "";
			int nRet = ChangeRecordProperty(strOldName, 
				dlg.textBox_name.Text,
				dlg.textBox_comment.Text,
				out strError);
			if (nRet == -1) 
			{
				MessageBox.Show(this, strError);
				return;
			}

			FillList(false);

		}