Exemplo n.º 1
0
 //This function is called when the user clicks on the "Start Simulation" Button. It displays the information needed to start a simulation
 private void button_startSimulation_Click(object sender, EventArgs e)
 {
     if (!selector.IsHandleCreated) //checks to see if a window is already opened
     {
         //Creates the window and shows it to the user
         selector = new SimulationSelector();
         selector.FormClosing += HandleSelectorClosing; //the function that will be called when the window is closed
         selector.Show();
     }
     selector.Focus(); //sets the user's focus to the simulation window
 }
Exemplo n.º 2
0
        private Thread updatethread; //thread that continuously calls the paint function (to update all node movements)

        #endregion Fields

        #region Constructors

        //Constructor
        public Form_Bridge()
        {
            InitializeComponent();
            label_algorithm.Text = ""; //text displaying algorithm thats being used
            allNodes = new List<Node>();
            selector = new SimulationSelector();
            board = new PointPath(); //creates set of points
            this.DoubleBuffered = true; //avoids flickering of nodes when updating their positions
            this.Paint += new PaintEventHandler(Form_Bridge_Paint); //calls this function when form needs to be repainted
            updatethread = new Thread(new ThreadStart(UpdateThread)); //creates the thread that will update the paint function
            updatethread.Start(); //starts the update thread
        }