コード例 #1
0
        /// <summary>
        /// Checks whether a new release is available for the product.
        ///
        /// This function should only be used if you manage your releases through
        /// Cryptlex release management API.
        /// </summary>
        /// <param name="platform">release platform e.g. windows, macos, linux</param>
        /// <param name="version">current release version</param>
        /// <param name="channel">release channel e.g. stable</param>
        /// <param name="callback">name of the callback function</param>
        public static void CheckForReleaseUpdate(string platform, string version, string channel, CallbackType callback)
        {
            var wrappedCallback = callback;

#if NETFRAMEWORK
            var syncTarget = callback.Target as System.Windows.Forms.Control;
            if (syncTarget != null)
            {
                wrappedCallback = (v) => syncTarget.Invoke(callback, new object[] { v });
            }
#endif
            callbackList.Add(wrappedCallback);
            int status;
            if (LexActivatorNative.IsWindows())
            {
                status = IntPtr.Size == 4 ? LexActivatorNative.CheckForReleaseUpdate_x86(platform, version, channel, wrappedCallback) : LexActivatorNative.CheckForReleaseUpdate(platform, version, channel, wrappedCallback);
            }
            else
            {
                status = LexActivatorNative.CheckForReleaseUpdateA(platform, version, channel, wrappedCallback);
            }
            if (LexStatusCodes.LA_OK != status)
            {
                throw new LexActivatorException(status);
            }
        }