<SerializableAttribute> _ Public Class UseLimit _ Inherits ExtendableLimit
[SerializableAttribute] public class UseLimit : ExtendableLimit
See the Use Limit Reference for more information.
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms
Imports DeployLX.Licensing.v5
Namespace VBProtectedDll
Public Class UseMonitorClass
Private _license As SecureLicense
Private _monitor As UseMonitor
Public Sub New()
_license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
_monitor = _license.GetUseMonitor()
AddHandler _monitor.UseExpired, AddressOf _monitor_UseExpired
End Sub
Private Sub _monitor_UseExpired(ByVal sender As Object, ByVal e As EventArgs)
ShowExpiredNotice()
End Sub
Public Sub ShowExpiredNotice()
MessageBox.Show("Too many users are already using the software. Please wait until they are finished.", "Too many users")
End Sub
''' <summary>
''' Sample method that mimics a connect method for a client/server model.
''' </summary>
''' <returns>
''' Returns a handle to the connection.
''' </returns>
Public Function Connect() As Integer
If (Not _monitor.AddUse()) Then
ShowExpiredNotice()
End If
Return _monitor.UseCount
End Function
''' <summary>
''' Sample method that mimics the disconnect method for a client/serve model.
''' </summary>
''' <param name="handle">
''' The handle returned from <see cref="Connect"/>
''' </param>
Public Sub Disconnect(ByVal handle As Integer)
' A real client/server model would check to see if the connection with the given handle
' still exists.
_monitor.RemoveUse()
End Sub
End Class
End Namespace
using System;
using System.Windows.Forms;
using DeployLX.Licensing.v5;
namespace CSharpProtectedDll
{
public class UseMonitorClass
{
private SecureLicense _license;
private UseMonitor _monitor;
public UseMonitorClass()
{
_license = SecureLicenseManager.Validate( this, null, null );
_monitor = _license.GetUseMonitor();
_monitor.UseExpired += new EventHandler(_monitor_UseExpired);
}
void _monitor_UseExpired( object sender, EventArgs e )
{
ShowExpiredNotice();
}
public void ShowExpiredNotice()
{
MessageBox.Show( "Too many users are already using the software. Please wait until they are finished.", "Too many users" );
}
/// <summary>
/// Sample method that mimics a connect method for a client/server model.
/// </summary>
/// <returns>
/// Returns a handle to the connection.
/// </returns>
public int Connect()
{
if( !_monitor.AddUse() )
{
ShowExpiredNotice();
}
return _monitor.UseCount;
}
/// <summary>
/// Sample method that mimics the disconnect method for a client/serve model.
/// </summary>
/// <param name="handle">
/// The handle returned from <see cref="Connect"/>
/// </param>
public void Disconnect( int handle )
{
// A real client/server model would check to see if the connection with the given handle
// still exists.
_monitor.RemoveUse();
}
}
}
Assembly: DeployLX.Licensing.v5 (in DeployLX.Licensing.v5.dll)