DeployLX Software Protection System

SecureLicense..::..GetTimeMonitor Method

Gets the active TimeMonitor for the first TimeLimit in the license.

Syntax

Public Function GetTimeMonitor As TimeMonitor
public TimeMonitor GetTimeMonitor()

Return Value

Returns the active TimeMonitor if found, otherwise nullNothingnullptra null reference (Nothing in Visual Basic).

Remarks

Normally the TimeLimit is only checked during license validation. The TimeMonitor class can be used to track the time used after the license has been validated to halt execution of the software after the time has expired.

Examples

This example shows how to use the TimeMonitor.
Visual Basic
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms
Imports DeployLX.Licensing.v5

Namespace VBProtectedDll
    Public Class TimeMonitorClass
        Private _license As SecureLicense
        Private _monitor As TimeMonitor

        Public Sub New()
            _license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
            _monitor = _license.GetTimeMonitor()
            AddHandler _monitor.TimeExpired, AddressOf _monitor_TimeExpired
        End Sub

        Private Sub _monitor_TimeExpired(ByVal sender As Object, ByVal e As EventArgs)
            MessageBox.Show("Thank you for evaluating the software. Your time has expired. Please visit www.xheo.com to purchase the full version.", "Time Expired")
        End Sub
    End Class
End Namespace
C#
using System;
using System.Windows.Forms;
using DeployLX.Licensing.v5;

namespace CSharpProtectedDll
{
    public class TimeMonitorClass
    {
        private SecureLicense _license;
        private TimeMonitor _monitor;

        public TimeMonitorClass()
        {
            _license = SecureLicenseManager.Validate( this, null, null );
            _monitor = _license.GetTimeMonitor();
            _monitor.TimeExpired += new EventHandler( _monitor_TimeExpired );
        }

        void _monitor_TimeExpired( object sender, EventArgs e )
        {
            MessageBox.Show( "Thank you for evaluating the software. Your time has expired. Please visit www.xheo.com to purchase the full version.", "Time Expired" );
        }
    }
}

Assembly:  DeployLX.Licensing.v5 (in DeployLX.Licensing.v5.dll)

See Also