示例#1
0
        private static void MenuAuthHelper(AuthResult result, string menuName)
        {
            string str;

            if (result == null || !result.IsLicensed)
            {
                str = "licenseUnlicensed";
            }
            else if (result.IsLifetime())
            {
                str = "licenseLifetime";
            }
            else
            {
                str = "licenseSubscription";
            }

            var expiry = result.Expiry.ToString(CultureInfo.InvariantCulture);
            var item   = Menu.GetMenu("license").Get <MenuText>(menuName);

            void Update(EventArgs _)
            {
                Menu.ResetTranslations("license", menuName);

                var inner = GetString(str).Replace("{expiry}", expiry);

                item.Text = item.Text.Replace("{status}", "\n" + inner);
            }

            if (MenuLicenseHandlers.TryGetValue(menuName, out var value))
            {
                Menu.OnLanguageChanged -= value;
            }

            MenuLicenseHandlers[menuName] = Update;
            Menu.OnLanguageChanged       += Update;

            Update(null);
        }