示例#1
0
        private void OnCalculate(object source, System.Timers.ElapsedEventArgs e)
        {
            currFlightPath       = srcDrone.BeginFlight();
            preComputeFlightPath = srcDrone.OptimizeFlightPath();

            if (currFlightPath.isEqual(preComputeFlightPath))
            {
                System.Timers.Timer srcTimer = (System.Timers.Timer)source;
                srcTimer.Enabled    = false;
                flightPathOptimized = true;
                calcTimer           = null;

                if (button3.InvokeRequired)
                {
                    BeginInvoke((MethodInvoker) delegate() { button3.Text = "Optimize Flight Path"; });
                }
                else
                {
                    button3.Text = "Optimize Flight Path";
                }
            }

            if (InvokeRequired)
            {
                BeginInvoke((MethodInvoker) delegate() { Refresh(); Invalidate(); });
            }
            else
            {
                Refresh();
                Invalidate();
            }
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            currFlightPath       = srcDrone.BeginFlight();
            preComputeFlightPath = srcDrone.OptimizeFlightPath();

            if (currFlightPath.isEqual(preComputeFlightPath))
            {
                flightPathOptimized = true;
            }

            button2.Enabled = true;

            Refresh();
            Invalidate();
        }