private void switchToBAS() { hidePrimaryWindow(); BAS_Num_Products_Input.Show(); BAS_Num_Threads_input.Show(); BAS_Product_Num_Label.Show(); BAS_Thread_Label.Show(); Buying_And_Selling_Start_Button.Show(); Step_BAS_Simulation_Button.Show(); BAS_Chart.Show(); }
private void hidePrimaryWindow() { Palindrome_Input_Label.Hide(); Palindrome_Input_Textbox.Hide(); Find_Palindrome_Activation_Button.Hide(); Find_If_Palindrome_Button.Hide(); Palindrome_Output.Hide(); BAS_Num_Products_Input.Hide(); BAS_Product_Num_Label.Hide(); BAS_Num_Threads_input.Hide(); BAS_Thread_Label.Hide(); Buying_And_Selling_Start_Button.Hide(); Step_BAS_Simulation_Button.Hide(); BAS_Chart.Hide(); }
private void updateBASChart() { //we do need to busy wait for the various threads in the background to complete their tasks //in a more refined solution, this would be programmed as a background worker so that the UI doesn't block on the update step //but for now this should be sufficient to see that the data is being updated correctly. Thread.Sleep(threadsWanted * 50); BAS_Chart.Series[0].Points.Clear(); Product[] productInfo = BASLogic.getProductInformation(); for (int i = 0; i < productInfo.Length; i++) { BAS_Chart.Series[0].Points.AddXY(i, (double)productInfo[i].getStock()); } BAS_Chart.Invalidate(); }