Exemple #1
0
        private void addBt_Click(object sender, EventArgs e)
        {
            var epdlg = new EditPrizeForm("添加", new Prize("", 0, ""));

            epdlg.StartPosition = FormStartPosition.CenterParent;
            if (epdlg.ShowDialog() == DialogResult.OK)
            {
                prizes.Add(epdlg.Prize);
                this.prizeListLv.VirtualListSize = prizes.Count;
                prizeListLv.Invalidate();
            }
        }
Exemple #2
0
        private void updateBt_Click(object sender, EventArgs e)
        {
            int index;

            try
            {
                index = prizeListLv.SelectedIndices[0];
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("{0}", ex.Message);
                return;
            }
            Prize tprize = new Prize(prizes.GetPrize(index).Name, prizes.GetPrize(index).Num, prizes.GetPrize(index).Picpath);
            var   epdlg  = new EditPrizeForm("修改", tprize);

            epdlg.StartPosition = FormStartPosition.CenterParent;

            if (epdlg.ShowDialog() == DialogResult.OK)
            {
                prizes.UpdatePrize(index, tprize);
                prizeListLv.Invalidate();
            }
        }