mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-04-19 19:15:28 +00:00
Fix application closing when choosing mode on Windows
When a new sub form is opened, the main form's ``Close()`` method is called, which halts the entire application on Windows. Instead, we create an instance of the sub form, and bind its ``Closed`` event to an event handler that will halt the entire application. We can then hide the main form, rather than closing it completely, which resolves the issue and allows the app to run as intended.
This commit is contained in:
parent
7191d00d26
commit
b872ebaee6
1 changed files with 13 additions and 3 deletions
|
@ -27,14 +27,24 @@ public class ModeSelectionForm : Form {
|
|||
}
|
||||
|
||||
private void openRemotePatcher(object sender, EventArgs e) {
|
||||
new RemotePatchForm().Show();
|
||||
this.Close();
|
||||
RemotePatchForm rpForm = new RemotePatchForm();
|
||||
rpForm.Show();
|
||||
rpForm.Closed += OnSubFormClose;
|
||||
|
||||
this.Visible = false;
|
||||
}
|
||||
private void openLocalPatcher(object sender, EventArgs e) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
private void openFilePatcher(object sender, EventArgs e) {
|
||||
new FilePatchForm().Show();
|
||||
FilePatchForm fpForm = new FilePatchForm();
|
||||
fpForm.Show();
|
||||
fpForm.Closed += OnSubFormClose;
|
||||
|
||||
this.Visible = false;
|
||||
}
|
||||
private void OnSubFormClose(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue