Exemplo n.º 1
0
        private void ratioListView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewItem item = ratioListView.HitTest(e.Location).Item;

            if (item != null)
            {
                int         index = (int)item.Tag;
                TorqueRatio ratio = Ratios[index];

                using (TorqueCurveForm frm = new TorqueCurveForm((int)torqueBox.Value, ratio))
                {
                    // Show form
                    var result = frm.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        Ratios[index] = frm.GetRatio();

                        // Flag change
                        RatiosChanged = true;

                        // Force Points Redraw
                        PopulateTorqueRatios();

                        // Force a chart redraw
                        torqueBox_ValueChanged(this, EventArgs.Empty);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void ratioListView_KeyDown(object sender, KeyEventArgs e)
        {
            if (ratioListView.SelectedItems.Count == 0)
            {
                return;
            }

            ListViewItem item  = ratioListView.SelectedItems[0];
            int          index = (int)item.Tag;

            if (e.KeyCode == Keys.Delete)
            {
                // Remove torque ratio
                Ratios.RemoveAt(index);

                // Flag change
                RatiosChanged = true;

                // Force Points Redraw
                PopulateTorqueRatios();

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

                e.Handled = true;
            }
            else if (e.KeyCode == Keys.Enter)
            {
                TorqueRatio ratio = Ratios[index];
                using (TorqueCurveForm frm = new TorqueCurveForm((int)torqueBox.Value, ratio))
                {
                    // Show form
                    var result = frm.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        // Grab Ratio
                        TorqueRatio values = frm.GetRatio();

                        // Create the new Ratio
                        ratio.RpmLevel = values.RpmLevel;
                        ratio.Ratio    = values.Ratio;

                        // Flag change
                        RatiosChanged = true;

                        // Force Points Redraw
                        PopulateTorqueRatios();

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

                e.Handled = true;
            }
        }
Exemplo n.º 3
0
        private void addPointButton_Click(object sender, EventArgs e)
        {
            using (TorqueCurveForm frm = new TorqueCurveForm((int)torqueBox.Value))
            {
                var result = frm.ShowDialog();
                if (result == DialogResult.Yes)
                {
                    // Create the new Ratio
                    TorqueRatio ratio = frm.GetRatio();
                    Ratios.Add(ratio);

                    // Flag change
                    RatiosChanged = true;

                    // Force Points Redraw
                    PopulateTorqueRatios();

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