Esempio n. 1
0
        public static bool SetLicense(Page mainPage, bool silent = false)
        {
            // Need Page as parameter instead of using MainPage as this code may execute within the Page's constructor
            RasterSupport.Initialize(mainPage);

            if (RasterSupport.KernelExpired)
            {
                try
                {
                    byte[] licBytes = System.Text.Encoding.UTF8.GetBytes(LicContents);
                    RasterSupport.SetLicense(licBytes, KeyContents);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }

            if (RasterSupport.KernelExpired && !silent)
            {
                string msg = "Your license file is missing, invalid or expired. LEADTOOLS will not function. Please contact LEAD Sales for information on obtaining a valid license.";
                MainThread.BeginInvokeOnMainThread(async() => await mainPage.DisplayAlert("Error", msg, "OK"));
            }

            return(!RasterSupport.KernelExpired);
        }