private void buttonOpenViewer_Click(object sender, EventArgs e) { if (fileDir != "") { viewerForm = new FormViewer(this, fileDir); viewerForm.Show(); } else { MessageBox.Show("Can not open a new file in the viewer until it is saved.", "Unsaved File", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
//Prototype: //Arguments: //Description: //Precondition: //Postcondition: //Protection Level: private void buttonViewer_Click(object sender, EventArgs e) { if (File.Exists(fileDir)) { viewerForm = new FormViewer(this, fileDir); viewerForm.Show(); Hide(); } else if (fileDir != "") { MessageBox.Show("The file could not be found. It may have been moved or " + "had its name changed", "Directory not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("You must enter the directory for a .json file to view it.", "No File Selected", MessageBoxButtons.OK, MessageBoxIcon.Error); } }