//------------------------------------------------------------- // Next button Event //------------------------------------------------------------- private void btnNext_Click(object sender, EventArgs e) { string pathError = ""; // Error from isFileValid. Is empty if not error. // Set vmxPath and isoPath for ConfirmForm to use this.vmxPath = this.txtBxConfig.Text; this.isoPath = this.txtBxISOpath.Text; // pathError equals the error for vmxPath, if there is one. // If there is no error, pathError should = "" pathError = isFileValid(this.vmxPath, ".vmx"); // Check to see if there was a problem with vmxPath if (pathError.Equals("")) { // If there is no error with vmxPath, now do the same error check with isoPath. if (this.isoPath.EndsWith(".iso")) { pathError = isFileValid(this.isoPath, ".iso"); } else if (this.isoPath.EndsWith(".img")) { pathError = isFileValid(this.isoPath, ".img"); } else { pathError = "The file: \n\n " + this.isoPath + "\n\nis not a supported file format (.iso or .img)"; } // Check to see if there was an error with isoPath. if (pathError.Equals("")) { //If there was not an error, make a confirmation page and show it. ConfirmForm confirmForm = new ConfirmForm(this); confirmForm.ShowDialog(); } // Else there was an error from isoPath, Message is displayed. else { MessageBox.Show(pathError, "Error!"); } } // Else there was an error from vmxPath, Message is displayed. else { MessageBox.Show(pathError, "Error!"); } }
//------------------------------------------------------------- // Next button Event //------------------------------------------------------------- private void btnNext_Click(object sender, EventArgs e) { string pathError = ""; // Error from isFileValid. Is empty if not error. // Set vmxPath and isoPath for ConfirmForm to use this.vmxPath = this.txtBxConfig.Text; this.isoPath = this.txtBxISOpath.Text; // pathError equals the error for vmxPath, if there is one. // If there is no error, pathError should = "" pathError = isFileValid(this.vmxPath, ".vmx"); // Check to see if there was a problem with vmxPath if(pathError.Equals("")) { // If there is no error with vmxPath, now do the same error check with isoPath. if (this.isoPath.EndsWith(".iso")) { pathError = isFileValid(this.isoPath, ".iso"); } else if (this.isoPath.EndsWith(".img")) { pathError = isFileValid(this.isoPath, ".img"); } else { pathError = "The file: \n\n " + this.isoPath + "\n\nis not a supported file format (.iso or .img)"; } // Check to see if there was an error with isoPath. if(pathError.Equals("")) { //If there was not an error, make a confirmation page and show it. ConfirmForm confirmForm = new ConfirmForm(this); confirmForm.ShowDialog(); } // Else there was an error from isoPath, Message is displayed. else { MessageBox.Show(pathError, "Error!"); } } // Else there was an error from vmxPath, Message is displayed. else { MessageBox.Show(pathError, "Error!"); } }