Skip to content

Commit

Permalink
Allow changing connections & disconnected tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMpn committed Jun 6, 2021
1 parent 02b5e75 commit c661a37
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 78 deletions.
3 changes: 3 additions & 0 deletions MarkMpn.Sql4Cds/MarkMpn.Sql4Cds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@
<ItemGroup>
<EmbeddedResource Include="Images\BulkDeleteJobNode.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Disconnect_Filled_16x.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
66 changes: 54 additions & 12 deletions MarkMpn.Sql4Cds/ObjectExplorer.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions MarkMpn.Sql4Cds/ObjectExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,30 @@
using XrmToolBox.Extensibility;
using Microsoft.Xrm.Sdk.Metadata.Query;
using Microsoft.Xrm.Tooling.Connector;
using System.Threading.Tasks;

namespace MarkMpn.Sql4Cds
{
partial class ObjectExplorer : WeifenLuo.WinFormsUI.Docking.DockContent
{
private readonly IDictionary<ConnectionDetail, SharedMetadataCache> _metadata;
private readonly Action<ConnectionDetail> _newQuery;
private readonly Action _connect;

class LoaderParam
{
public Func<TreeNode, TreeNode[]> Loader;
public TreeNode Parent;
}

public ObjectExplorer(IDictionary<ConnectionDetail, SharedMetadataCache> metadata, Action<WorkAsyncInfo> workAsync, Action<ConnectionDetail> newQuery)
public ObjectExplorer(IDictionary<ConnectionDetail, SharedMetadataCache> metadata, Action<WorkAsyncInfo> workAsync, Action<ConnectionDetail> newQuery, Action connect)
{
InitializeComponent();

_metadata = metadata;
WorkAsync = workAsync;
_newQuery = newQuery;
_connect = connect;
}

public Action<WorkAsyncInfo> WorkAsync { get; }
Expand Down Expand Up @@ -569,7 +572,7 @@ private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
Message = "Refreshing metadata...",
Work = (worker, args) =>
{
con.UpdateMetadataCache(false).ConfigureAwait(false).GetAwaiter().GetResult();
con.UpdateMetadataCache(con.MetadataCacheLoader.IsFaulted).ConfigureAwait(false).GetAwaiter().GetResult();
},
PostWorkCallBack = (args) =>
{
Expand All @@ -584,5 +587,10 @@ private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
}
});
}

private void tsbConnect_Click(object sender, EventArgs e)
{
_connect();
}
}
}
16 changes: 15 additions & 1 deletion MarkMpn.Sql4Cds/ObjectExplorer.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACi
GQAAAk1TRnQBSQFMAgEBGQEAAbABAAGwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
GQAAAk1TRnQBSQFMAgEBGQEAAcgBAAHIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAAXADAAEBAQABCAYAARwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down Expand Up @@ -243,4 +243,18 @@
<metadata name="serverContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>224, 34</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>407, 34</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsbDisconnect.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADTSURBVDhPY6AK2Brt8f9Ed8N/KJfhzs2T/w/X5oP5tbW1
/3NycuBy6HwwON5e83+CmuD/Cwum/791cO//bTE+/0GGgOQsLS3/gzBYIRCg8+HgzPTe/1MM5f4v8LH+
f2vfTpwacBpwacXC/9NMFSEGXDiGqQAfODdzwv9JmiL/T/U1/b++bT3YC+fun//v6+sLtg0XhmpnYFjk
7/D/QHkGXODGgb3/D9cXgfnYNIIwWCExAJtmEIZKEwbYNIMwVJowwKYZhKHSxAOyNcLAqAG4AAMDAEDZ
qWPhcBlpAAAAAElFTkSuQmCC
</value>
</data>
</root>
Loading

0 comments on commit c661a37

Please sign in to comment.