void CloseDog() { if (hasp == null) { return; } hasp.Logout(); hasp.Dispose(); }
/// <summary> /// Demonstrates how to perform a login using the default /// feature and how to perform an automatic logout /// using the Hasp's Dispose method. /// </summary> public void LoginDisposeDemo() { Verbose("Login/Dispose Demo with Default Feature (HaspFeature.Default)"); HaspFeature feature = HaspFeature.Default; Hasp hasp = new Hasp(feature); HaspStatus status = hasp.Login(VendorCode.Code, scope); ReportStatus(status); Verbose("Disposing object - will perform an automatic logout"); hasp.Dispose(); Verbose(""); }
/// <summary> /// Performs a logout operation on the key. /// </summary> public void LogoutDemo(ref Hasp hasp) { // sanity check if ((null == hasp) || !hasp.IsLoggedIn()) { return; } Verbose("Logout Demo"); HaspStatus status = hasp.Logout(); ReportStatus(status); // get rid of the key immediately. hasp.Dispose(); hasp = null; Verbose(""); }
/// <summary> /// Demonstrates how to perform a login and a logout /// using the default feature. /// </summary> public void LoginLogoutDefaultDemo() { HaspFeature feature = HaspFeature.Default; Hasp hasp = new Hasp(feature); HaspStatus status = hasp.Login(VendorCode.Code, scope); ReportStatus(status); if (HaspStatus.StatusOk == status) { status = hasp.Logout(); ReportStatus(status); } // recommended, but not mandatory // this call ensures that all resources to the key // are freed immediately. hasp.Dispose(); }
void CloseDog() { hasp.Logout(); hasp.Dispose(); }