Skip to content

Commit fc02b6e

Browse files
author
VPKSoft
committed
Fixed file save indicator.
1 parent d3e7428 commit fc02b6e

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

ScriptNotepad/FormMain.cs

+14-3
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,17 @@ private void CloseSession()
11761176
sttcMain.CloseAllDocuments();
11771177
}
11781178

1179+
/// <summary>
1180+
/// Determines whether this instance can display a query dialog. I.e. the main for is active and visible.
1181+
/// </summary>
1182+
/// <returns><c>true</c> if this instance can display a query dialog; otherwise, <c>false</c>.</returns>
1183+
private bool CanDisplayQueryDialog()
1184+
{
1185+
var result = !runningConstructor && MessageBoxBase.MessageBoxInstances.Count == 0 && Visible &&
1186+
(WindowState == FormWindowState.Normal || WindowState == FormWindowState.Maximized);
1187+
return result;
1188+
}
1189+
11791190
/// <summary>
11801191
/// Checks if an open document has been changed in the file system or removed from the file system and
11811192
/// queries the user form appropriate action for the file.
@@ -1199,7 +1210,7 @@ private void CheckFileSysChanges()
11991210
{
12001211
// query the user if one wishes to reload
12011212
// the changed file from the disk..
1202-
if (fileSave.GetShouldQueryDiskReload() && !runningConstructor)
1213+
if (CanDisplayQueryDialog() && fileSave.GetShouldQueryDiskReload())
12031214
{
12041215
if (MessageBoxExtended.Show(
12051216
DBLangEngine.GetMessage("msgFileHasChanged", "The file '{0}' has been changed. Reload from the file system?|As in the opened file has been changed outside the software so do as if a reload should happen", fileSave.FileNameFull),
@@ -1240,7 +1251,7 @@ private void CheckFileSysChanges()
12401251
{
12411252
// query the user if one wishes to keep a deleted
12421253
// file from the file system in the editor..
1243-
if (fileSave.ShouldQueryKeepFile() && !runningConstructor)
1254+
if (CanDisplayQueryDialog() && fileSave.ShouldQueryKeepFile())
12441255
{
12451256
if (MessageBoxExtended.Show(
12461257
DBLangEngine.GetMessage("msgFileHasBeenDeleted", "The file '{0}' has been deleted. Keep the file in the editor?|As in the opened file has been deleted from the file system and user is asked if to keep the deleted file in the editor", fileSave.FileNameFull),
@@ -1268,7 +1279,7 @@ private void CheckFileSysChanges()
12681279
sttcMain.Documents[i].Scintilla.CurrentPosition);
12691280
}
12701281
}
1271-
else if (fileSave.ShouldQueryFileReappeared() && !runningConstructor)
1282+
else if (CanDisplayQueryDialog() && fileSave.ShouldQueryFileReappeared())
12721283
{
12731284
if (MessageBoxExtended.Show(
12741285
DBLangEngine.GetMessage("msgFileHasReappeared", "The file '{0}' has reappeared. Reload from the file system?|As in the file has reappeared to the file system and the software queries whether to reload it's contents from the file system", fileSave.FileNameFull),

0 commit comments

Comments
 (0)