public string GetLicError(int statcode) { byte[] errbytes = new byte[1000]; IntPtr errmsg = RLMEZ.rlmez_errstring(statcode, errbytes); string errstring = Marshal.PtrToStringAnsi(errmsg); return(errstring); }
//get message in LicMessage property and number of days in DaysLeft property public int CheckLicStatus(bool ShowDaysLeftReminderPopup) { int dayslft = 0; string maxver = _maxversion; _validLic = false; int statcode = -9999; try { statcode = RLMEZ.rlmez_checkout(maxver, ref dayslft); _daysleft = dayslft - 1; } catch (Exception ex) { _licmessage = "Checkout Failed. Probably DLLs missing." + ex.Message; return(statcode); } if (_daysleft == -1 && statcode == 0) //valid permanent license. Never Expires { _licmessage = "Permanent License!!"; // No Expiry Date!"; _validLic = true; } else if (_daysleft >= 0)//Valid License (Trial of Full Version) { _licmessage = "License will expire in " + (_daysleft) + " day(s)"; _validLic = true; } else//Lic not valid { _licmessage = GetLicError(statcode); } //Show popup for specific number of days left, only if license is valid and popup is allowed to be displayed if (statcode == 0 && _validLic && ShowDaysLeftReminderPopup)//valid Lic { ShowDaysLeftReminder(); } return(statcode); }
//get message in LicMessage property public void InstallDemoLic(int days) { _validLic = false; string message = string.Empty; int statcode = RLMEZ.rlmez_demo(_maxversion, 30);//trial days switch (statcode) { case RLMEZ.RLM_EL_DEMOEXP: message = "Trial License Has Expired"; break; case RLMEZ.RLM_EL_EXPIRED: message = "Authorization Has Expired"; break; case RLMEZ.RLM_EH_DEMOEXISTS: message = "Trial Already Exists"; break; case RLMEZ.RLM_EH_EVAL_EXPIRED: message = "RLM Evaluation Expired"; break; case 0: message = "Trial Installed Successfully"; _validLic = true; break; default: message = "Error Installing Trial"; break; } _licmessage = message; //return statcode; }