Skip to content

Commit 299d242

Browse files
committed
Prompting if query will be reloaded after changing connection #1077 #1076
1 parent dacbd86 commit 299d242

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

FetchXmlBuilder/FetchXmlBuilder.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public partial class FetchXmlBuilder : PluginControlBase
5555
private int resultpanecount = 0;
5656
private Entity view;
5757
private bool alreadyloaded;
58+
private string lastconnection;
5859

5960
#endregion Private Fields
6061

@@ -508,8 +509,15 @@ private void FetchXmlBuilder_ConnectionUpdated(object sender, ConnectionUpdatedE
508509
{
509510
if (!working)
510511
{
512+
var reinit = string.IsNullOrEmpty(lastconnection) ||
513+
(lastconnection != e.ConnectionDetail.ConnectionName &&
514+
MessageBoxEx.Show(this, $"Switching from connection \"{lastconnection}\" to \"{e.ConnectionDetail.ConnectionName}\".\n\nReload last used query for {e.ConnectionDetail.ConnectionName}?", "New Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
515+
lastconnection = e.ConnectionDetail.ConnectionName;
511516
LoadEntities();
512-
dockControlBuilder?.Init(connectionsettings.FetchXML, connectionsettings.LayoutXML, false, "loaded from last session", false);
517+
if (reinit)
518+
{
519+
dockControlBuilder?.Init(connectionsettings.FetchXML, connectionsettings.LayoutXML, false, "loaded from last session", false);
520+
}
513521
}
514522
}
515523
else

0 commit comments

Comments
 (0)