Skip to content

Commit

Permalink
Update IDSDKManager.cs (#13737)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusongit authored Feb 8, 2023
1 parent 4df27eb commit 42056f0
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/DynamoCore/Core/IDSDKManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using Autodesk.IDSDK;
using Greg;
using Greg.AuthProviders;
Expand Down Expand Up @@ -207,17 +208,31 @@ private string IDSDK_GetToken()

private bool Initialize()
{
if (Client.IsInitialized()) return true;
idsdk_status_code bRet = Client.Init();

if (Client.IsSuccess(bRet))
{
if (Client.IsInitialized())
{
bool ret = GetClientIDAndServer(out idsdk_server server, out string client_id);
if (ret)
try
{
ret = SetProductConfigs("Dynamo", server, client_id);
return ret;
IntPtr hWnd = Process.GetCurrentProcess().MainWindowHandle;
if (hWnd != null)
{
Client.SetHost(hWnd);
}

bool ret = GetClientIDAndServer(out idsdk_server server, out string client_id);
if (ret)
{
ret = SetProductConfigs("Dynamo", server, client_id);
return ret;
}
}
catch (Exception e)
{
return false;
}
}
}
Expand Down

0 comments on commit 42056f0

Please sign in to comment.