Beispiel #1
0
        private void addPointButton_Click(object sender, EventArgs e)
        {
            using (var frm = new EditGearForm())
            {
                var result = frm.ShowDialog();
                if (result == DialogResult.Yes)
                {
                    // Create the new Ratio
                    var gear = frm.GetGear();

                    // Add the gear to the correct list
                    var list = (gear.IsReverse) ? ReverseGears : ForwardGears;
                    list.Add(gear);

                    // Flag
                    GearsChanged = true;

                    // Force Points Redraw
                    PopulateGears();

                    // Force a chart redraw
                    diffRatio_ValueChanged(this, EventArgs.Empty);
                }
            }
        }
Beispiel #2
0
        private void gearListView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewItem item = gearListView.HitTest(e.Location).Item;

            if (item != null)
            {
                bool isReverse = gearListView.Groups[0].Items.Contains(item);
                int  index     = (int)item.Tag;
                var  gear      = (isReverse) ? ReverseGears[index] : ForwardGears[index];

                using (var frm = new EditGearForm(gear))
                {
                    // Show form
                    var result = frm.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        // Process the modifcation
                        if (OnGearEdit(gear, frm.GetGear(), index))
                        {
                            // Force Points Redraw
                            PopulateGears();

                            // Flag
                            GearsChanged = true;

                            // Force a chart redraw
                            diffRatio_ValueChanged(this, EventArgs.Empty);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void gearListView_KeyDown(object sender, KeyEventArgs e)
        {
            if (gearListView.SelectedItems.Count == 0)
            {
                return;
            }

            ListViewItem item      = gearListView.SelectedItems[0];
            bool         isReverse = gearListView.Groups[0].Items.Contains(item);
            var          list      = (isReverse) ? ReverseGears : ForwardGears;
            int          index     = (int)item.Tag;

            // Process input
            if (e.KeyCode == Keys.Delete)
            {
                // Remove gear
                list.RemoveAt(index);

                // Force Points Redraw
                PopulateGears();

                // Flag
                GearsChanged = true;

                // Force a chart redraw
                diffRatio_ValueChanged(this, EventArgs.Empty);

                e.Handled = true;
            }
            else if (e.KeyCode == Keys.Enter)
            {
                var gear = list[index];
                using (var frm = new EditGearForm(gear))
                {
                    // Show form
                    var result = frm.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        // Process the modifcation
                        if (OnGearEdit(gear, frm.GetGear(), index))
                        {
                            // Force Points Redraw
                            PopulateGears();

                            // Flag
                            GearsChanged = true;

                            // Force a chart redraw
                            diffRatio_ValueChanged(this, EventArgs.Empty);
                        }
                    }
                }

                e.Handled = true;
            }
        }