Skip to content

Commit

Permalink
bugfix form portal licensing
Browse files Browse the repository at this point in the history
  • Loading branch information
Senad Mulaosmanovic committed May 16, 2024
1 parent c6ca327 commit 13e9a27
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion DWSIM.ProFeatures/FormPortal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
using DWSIM.ExtensionMethods;
using Microsoft.Win32;
using System.Text.RegularExpressions;
using System.Threading;
using Timer = System.Windows.Forms.Timer;

namespace DWSIM.ProFeatures
{
Expand All @@ -36,6 +38,8 @@ public FormPortal()

FileManagementService.GetInstance().OnFileSavedToDashboard += FileManagementService_FileSavedToDashboard;
UserService.GetInstance().OnUserLoggedIn += UserService_OnUserLoggedIn;

Disposed += OnDispose;
}
public void SetFlowsheet(IFlowsheet fs)
{
Expand All @@ -56,6 +60,21 @@ private void FormPortal_Load(object sender, EventArgs e)

}

private void OnDispose(object sender, EventArgs e)
{
try
{
UserService.GetInstance().OnUserLoggedIn -= UserService_OnUserLoggedIn;
FileManagementService.GetInstance().OnFileSavedToDashboard -= FileManagementService_FileSavedToDashboard;
}
catch (Exception)
{


}

}

public async Task OnInitialize()
{
// Debugger.Launch();
Expand Down Expand Up @@ -139,8 +158,11 @@ private async void SaveStartupActionAndRedirect()
}
}

private static SemaphoreSlim __licenseRequestLock = new SemaphoreSlim(1);

private async Task<LicenseResponseModel> GetLicenseInfo()
{
await __licenseRequestLock.WaitAsync();

string url = $"{DashboardSettings.DashboardServiceUrl}/api/licensing/license-info";
var token = UserService.GetInstance().GetUserToken();
Expand Down Expand Up @@ -175,8 +197,10 @@ private async Task<LicenseResponseModel> GetLicenseInfo()
}
finally
{
__licenseRequestLock.Release();
IsLoadingLicenseInfo = false;
}

return null;
}

Expand Down Expand Up @@ -382,7 +406,7 @@ private void saveToDashboardBtn_Click(object sender, EventArgs e)
}

private void registerLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
{
Process.Start("https://simulate365.com/registration/");
}
}
Expand Down

0 comments on commit 13e9a27

Please sign in to comment.