Open resevp opened 2 hours ago
I have found the reason, why loadMemoryData()
is being executed twice.
This is because I have added a MessageBox
to ask the user to choose the the Chinese version (繁體/簡體). The MessageBox will trigger the loadMemoryData()
which is set by initializeEditorFocusMonitor()
.
When the MessageBox
pop up, it make the main window loses focus, when the MessageBox
closed, the main window regains focus and due to initializeEditorFocusMonitor()
, the program executes loadMemoryData()
.
As per my personal preference, I have disabled the initializeEditorFocusMonitor()
, I will manually refresh/reload the data when needed by clicking on the button [讀取游戲].
public mainForm()
{
InitializeComponent();
// disable the focus monitor
//initializeEditorFocusMonitor();
versionLabel.Text = Application.ProductVersion;
}
I frequently switched focus between the game and editor for checking various data before doing some edits. I do not want the editor perform a fresh new reload each time I come back.
In the file:
Form1.cs
, in an unknown circumstance,loadMemoryData()
will executed twice when the buttonloadGameBtn
is clicked, which will cause the following method to face error:Therefore, I have added a global value of
the following is proposed to prevent the "double" execution: