mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-29 10:53:43 +00:00
Refactor code editor launch logic
Extracted the code editor launch logic into a new LaunchEditor() method to reduce duplication. Both the button and menu item now use this method, and error handling for resource server startup is centralized.
This commit is contained in:
parent
a77c83736c
commit
90806493ed
|
|
@ -243,6 +243,24 @@ namespace WelsonJS.Launcher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LaunchEditor()
|
||||||
|
{
|
||||||
|
if (RunResourceServer())
|
||||||
|
{
|
||||||
|
Program.OpenWebBrowser(Program._resourceServer.GetPrefix());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Error("Failed to start the resource server.");
|
||||||
|
MessageBox.Show(
|
||||||
|
"Failed to start the resource server. Please check your configuration or try again.",
|
||||||
|
"Resource Server Error",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void cbUseSpecificScript_CheckedChanged(object sender, EventArgs e)
|
private void cbUseSpecificScript_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
txtUseSpecificScript.Enabled = cbUseSpecificScript.Checked;
|
txtUseSpecificScript.Enabled = cbUseSpecificScript.Checked;
|
||||||
|
|
@ -291,12 +309,14 @@ namespace WelsonJS.Launcher
|
||||||
(new GlobalSettingsForm()).Show();
|
(new GlobalSettingsForm()).Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnStartTheEditor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LaunchEditor();
|
||||||
|
}
|
||||||
|
|
||||||
private void startCodeEditorToolStripMenuItem_Click(object sender, EventArgs e)
|
private void startCodeEditorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (RunResourceServer())
|
LaunchEditor();
|
||||||
{
|
|
||||||
Program.OpenWebBrowser(Program._resourceServer.GetPrefix());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openCodeEditorToolStripMenuItem_Click(object sender, EventArgs e)
|
private void openCodeEditorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
@ -315,14 +335,6 @@ namespace WelsonJS.Launcher
|
||||||
Program.OpenWebBrowser(Program.GetAppConfig("CopilotUrl"));
|
Program.OpenWebBrowser(Program.GetAppConfig("CopilotUrl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnStartTheEditor_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (RunResourceServer())
|
|
||||||
{
|
|
||||||
Program.OpenWebBrowser(Program._resourceServer.GetPrefix());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnJoinTheCommunity_Click(object sender, EventArgs e)
|
private void btnJoinTheCommunity_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Program.OpenWebBrowser(Program.GetAppConfig("RepositoryUrl"));
|
Program.OpenWebBrowser(Program.GetAppConfig("RepositoryUrl"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user