Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0484da8
commit 25a5e82
Showing
10 changed files
with
1,403 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Windows.Forms; | ||
|
||
using NaiveSharp.ConstText; | ||
using NaiveSharp.Controller; | ||
|
||
namespace NaiveSharp.View | ||
{ | ||
public partial class AdvanceWindow : Form | ||
{ | ||
public AdvanceWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private static bool IsDebug() | ||
=> File.Exists(PATH.CONFIG_DEBUG); | ||
|
||
private static void SetDebugStatus(bool status) | ||
{ | ||
if (status) | ||
{ | ||
Create(PATH.CONFIG_DEBUG); | ||
} | ||
else | ||
{ | ||
Delete(PATH.CONFIG_DEBUG); | ||
} | ||
} | ||
|
||
private static void ResetFormSize() | ||
=> Delete(PATH.CONFIG_FORM); | ||
|
||
private static void Delete(string path) | ||
{ | ||
if (File.Exists(path)) | ||
{ | ||
File.Delete(path); | ||
} | ||
} | ||
|
||
private static void Create(string path) | ||
{ | ||
if (!File.Exists(path)) | ||
{ | ||
File.Create(path).Close(); | ||
} | ||
|
||
} | ||
|
||
private void AdvanceWindow_Load(object sender, System.EventArgs e) | ||
=> btnDebug.Text = IsDebug() ? "Turn Off" : "Turn On"; | ||
|
||
private void btnResetFormSize_Click(object sender, System.EventArgs e) | ||
{ | ||
ResetFormSize(); | ||
RequestRestart(); | ||
} | ||
|
||
private void btnDebug_Click(object sender, System.EventArgs e) | ||
{ | ||
if (btnDebug.Text.EndsWith("On")) | ||
{ | ||
SetDebugStatus(true); | ||
btnDebug.Text = "Turn Off"; | ||
} | ||
else | ||
{ | ||
SetDebugStatus(false); | ||
btnDebug.Text = "Turn On"; | ||
} | ||
RequestRestart(); | ||
} | ||
|
||
private static void RequestRestart() | ||
{ | ||
if (MessageBox.Show(Msg.ASK_CHANGES_NEED_APP_RESTART, "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) | ||
== DialogResult.Yes) | ||
{ | ||
Operation.Stop(); | ||
|
||
Process.Start(new ProcessStartInfo | ||
{ | ||
FileName = Application.ExecutablePath, | ||
Arguments = "--no-check-running", | ||
WindowStyle = ProcessWindowStyle.Normal | ||
}); | ||
Environment.Exit(0); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.