//Initializes form and gets all the quotes. public SearchQuotes() { InitializeComponent(); List <SurfaceMaterial> surfaces = Enum.GetValues(typeof(SurfaceMaterial)).Cast <SurfaceMaterial>().ToList(); surfaceBox.DataSource = surfaces; //Calls the public GetQuotes() to retrieve all the quotes. quotes = ViewAllQuotes.GetQuotes(); }
//Hides this form and creates an instance of ViewAllQuotes and displays the viewAllQuotesForm if any quotes exist. private void ViewAllQuotes_Click(object sender, EventArgs e) { //Checks if any quotes exist. string cFile = @"desk_orders.txt"; //If quote do exist they are then displays on the viewAllQuotesForm. if (File.Exists(cFile)) { ViewAllQuotes viewAllQuotesForm = new ViewAllQuotes(); viewAllQuotesForm.Show(); Hide(); } //If there aren't any quotes a message is given to the user and the mainMenuForm remains visible. else { MessageBox.Show("No quotes have been entered."); } }