public static async Task ShowPopup(this AccountTip tip)
        {
            string title;

            switch (tip.Level)
            {
            case StartupTipLevel.Information:
                title = Texts.InformationTitle;
                break;

            case StartupTipLevel.Warning:
                title = Texts.WarningTitle;
                break;

            case StartupTipLevel.Critical:
                title = Texts.WarningTitle;
                break;

            default:
                throw new InvalidOperationException("Unexpected tip level.");
            }

            PopupButtons clicked;

            switch (tip.ButtonStyle)
            {
            case StartupTipButtonStyle.YesNo:
                clicked = await New <IPopup>().ShowAsync(PopupButtons.OkCancel, title, tip.Message);

                break;

            case StartupTipButtonStyle.Ok:
                clicked = await New <IPopup>().ShowAsync(PopupButtons.Ok, title, tip.Message);

                break;

            default:
                clicked = await New <IPopup>().ShowAsync(PopupButtons.Ok, title, tip.Message);

                break;
            }

            if (clicked != PopupButtons.Ok)
            {
                return;
            }
            if (tip.Url == null)
            {
                return;
            }
            New <ILauncher>().Launch(tip.Url.ToString());
        }
        public async Task <AccountTip> GetAccountTipAsync(AppTypes appType)
        {
            if (New <AxCryptOnlineState>().IsOffline)
            {
                return(new AccountTip());
            }

            if (Identity.IsEmpty)
            {
                return(new AccountTip());
            }

            Uri          resource = BaseUrl.PathCombine($"users/my/account/tip?apptype={(int)appType}");
            RestResponse response = await Caller.RestAsync(Identity, new RestRequest("GET", resource, Timeout));

            ApiCaller.EnsureStatusOk(response);

            AccountTip tip = Serializer.Deserialize <AccountTip>(response.Content);

            return(tip);
        }
        private async Task DoAllAsync()
        {
            CancelEventArgs e = new CancelEventArgs();

            await OnRestoreWindow(e);

            if (_signinState.IsSigningIn)
            {
                return;
            }

            _signinState.IsSigningIn = true;
            try
            {
                do
                {
                    await WrapMessageDialogsAsync(async() =>
                    {
                        await DoDialogsActionAsync();
                        if (StopAndExit)
                        {
                            return;
                        }

                        await SignInCommandAsync();
                        UserEmail = New <UserSettings>().UserEmail;
                    });

                    if (StopAndExit)
                    {
                        return;
                    }
                } while (String.IsNullOrEmpty(UserEmail));
            }
            finally
            {
                _signinState.IsSigningIn = false;
            }

            if (!New <KnownIdentities>().IsLoggedOn)
            {
                return;
            }

            await New <PremiumManager>().PlanStateWithTryPremium(New <KnownIdentities>().DefaultEncryptionIdentity, _startTrialMessage);

            if (Resolve.UserSettings.IsFirstSignIn)
            {
                await New <IPopup>().ShowAsync(PopupButtons.Ok, Texts.InformationTitle, Texts.InternetNotRequiredInformation);

                Resolve.UserSettings.IsFirstSignIn = false;
                return;
            }

            AccountTip tip = new AccountTip();

            try
            {
                tip = await New <AxCryptApiClient>().GetAccountTipAsync(AppTypes.AxCryptWindows2);
            }
            catch (ApiException aex)
            {
                await aex.HandleApiExceptionAsync();
            }
            catch (UnauthorizedException)
            {
                tip = new AccountTip();
            }

            if (!string.IsNullOrEmpty(tip.Message))
            {
                await tip.ShowPopup();
            }
        }