コード例 #1
0
        private void Add_Click(object sender, EventArgs e)
        {
            var form = new WayPointF(new WayPoint());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                listBox1.Items.Add(form.wp);
            }
            CostUD.Value += form.wp.TotalCost;
        }
コード例 #2
0
        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            var wp = listBox1.SelectedItem as WayPoint;

            if (wp == null)
            {
                return;
            }
            CostUD.Value -= wp.TotalCost;
            var form = new WayPointF(wp.Clone(), type, StateBox.SelectedItem.ToString());
            var res  = form.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                var si = listBox1.SelectedIndex;
                listBox1.Items.Remove(listBox1.SelectedItem);
                listBox1.Items.Insert(si, form.wp);
            }
            CostUD.Value += form.wp.TotalCost;
        }