/// <summary> /// Modify method. /// </summary> /// <remarks> /// The main method of that class that initialize the components in the form. /// </remarks> /// <param name="iVehicle">The selected vehicle from the previos form</param> /// <param name="modList">List with all stock vehicles</param> /// <param name="sName">The name of the user (buyer)</param> /// <param name="cBudget">The budget of the user</param> public Modify(int iVehicle, ModifiableList modList, string sName, Budget cBudget) { InitializeComponent(); this.FormClosing += ThisForm_FormClosing; //check if the red "X" is pressed Debug.WriteLine("ListSize() in Modify: " + modList.ListSize()); // the size of the list in this form imb = modList.GetObjectFromList(iVehicle); this.sName = sName; this.cBudget = cBudget; Modify_Load(); }
/// <summary> /// ShowAllModifiedVehicles method. /// </summary> /// <remarks> /// Save the last modified vehicles in a file and then read all the saved vehicles /// and show them on the screen. /// </remarks> /// <param name="imb"></param> private void ShowAllModifiedVehicles(IModifiable imb) { //save the last modivified vehicle autoshow.SaveNewCar(imb); modlist = autoshow.ShowAll(); //get each object in that list for (int i = 0; i < modlist.ListSize(); i++) { imb = modlist.GetObjectFromList(i); //print the object in textbox. txtHistory.AppendText(imb.ToString()); txtHistory.AppendText(Environment.NewLine); } }