static void EnableUserBetaProgramIfNeeded(string unityAccessToken)
        {
            int ini = Environment.TickCount;

            UnityPackageBetaEnrollResponse response = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                response = PlasticScmRestApiClient.IsBetaEnabled(unityAccessToken);
            },
                /*afterOperationDelegate*/ delegate
            {
                mLog.DebugFormat(
                    "IsBetaEnabled time {0} ms",
                    Environment.TickCount - ini);

                if (waiter.Exception != null)
                {
                    ExceptionsHandler.LogException(
                        "CalculateUserBetaProgramSetting",
                        waiter.Exception);
                    return;
                }

                if (response == null)
                {
                    return;
                }

                if (response.Error != null)
                {
                    mLog.ErrorFormat(
                        "Unable to retrieve is beta enabled: {0} [code {1}]",
                        response.Error.Message, response.Error.ErrorCode);
                    return;
                }

                if (!response.IsBetaEnabled)
                {
                    mLog.InfoFormat(
                        "Beta is disabled for accessToken: {0}",
                        unityAccessToken);
                    return;
                }

                PlasticMenuItem.Add();
            });
        }
示例#2
0
        static void Execute(string unityAccessToken)
        {
            if (SessionState.GetInt(
                    IS_USER_BETA_PROGRAM_ALREADY_CALCULATED_KEY,
                    BETA_PROGRAM_NOT_CALCULATED) == BETA_PROGRAM_ENABLED)
            {
                PlasticMenuItem.Add();
                return;
            }

            PlasticApp.InitializeIfNeeded();

            EnableUserBetaProgramIfNeeded(unityAccessToken);
        }