/// <summary> /// Calls the select file method and shows the next form when the open button is clicked from the file dropdown menu. /// </summary> private void OpenFileDropDown_Click(object sender, EventArgs e) { // if there is currently a file open if (FileOP.GetFile() != "") { //open a dialog asking if the consumer would like to save DialogResult savePrompt = MessageBox.Show("Would you like to save the current working file?", "Lock Current File", MessageBoxButtons.YesNo); // save the file contents if (savePrompt == DialogResult.Yes) { DataTable dataTable = FileOP.DataGridViewToDataTable(dataGridView1); UnlockFile(); FileOP.WriteToFile(dataTable); LockFile(); } // clear any references to file paths in the memory ClearMem(); } // if the dialog from fileOP returns true if (FileOP.SelectFile()) { // inflate the next form EnterPasswordForFile frm = new EnterPasswordForFile { TheParent = this }; // Adding all the enterPasswordForFile components to the list of components in the master from. // This is done to apply the same theme and text size to all of the forms textBoxes.AddRange(frm.enterPasswordForFileTextBoxes); labels.AddRange(frm.enterPasswordForFileLabels); this.buttons.AddRange(frm.enterPasswordForFileButtons); forms.Add(frm); // Changing theme of enterPasswordForFile if (darkThemeEnabled) { ChangeTheme(System.Drawing.Color.White, System.Drawing.Color.DarkGray, System.Drawing.Color.DarkSlateGray); frm.enterPasswordForFileDarkThemeEnabled = true; } else { ChangeTheme(System.Drawing.SystemColors.ControlText, System.Drawing.SystemColors.Window, System.Drawing.SystemColors.Control); frm.enterPasswordForFileDarkThemeEnabled = false; } // Changing text size of enterPasswordForFile if (defaultTextSizeEnabled) { ChangeFontSize(8.0f); frm.enterPasswordForFileDefaultTextSizeEnabled = true; frm.enterPasswordForFileSmallTextSizeEnabled = false; frm.enterPasswordForFileLargeTextSizeEnabled = false; } else if (smallTextSizeEnabled) { ChangeFontSize(6.0f); frm.enterPasswordForFileDefaultTextSizeEnabled = false; frm.enterPasswordForFileSmallTextSizeEnabled = true; frm.enterPasswordForFileLargeTextSizeEnabled = false; } else if (largeTextSizeEnabled) { ChangeFontSize(10.0f); frm.enterPasswordForFileDefaultTextSizeEnabled = false; frm.enterPasswordForFileSmallTextSizeEnabled = false; frm.enterPasswordForFileLargeTextSizeEnabled = true; } frm.ShowDialog(); } }