예제 #1
0
        private async void ApplyToken(string token)
        {
            if (!_tokenManager.StringHasValidTokenStructure(token))
            {
                var possiblyWrongTokenDialog = new ContentDialog
                {
                    Title             = "That doesn't look like a token.",
                    Content           = "The token you provided doesn't follow the basic token length and content structure.",
                    PrimaryButtonText = "Apply anyway",
                    CloseButtonText   = "Cancel"
                };

                var result = await possiblyWrongTokenDialog.ShowAsync();

                if (result != ContentDialogResult.Primary)
                {
                    return;
                }
            }

            _tokenManager.ApplyToken(token, _miunie);
            RaisePropertyChanged(nameof(BotToken));

            TokenApplied?.Invoke(this, EventArgs.Empty);
        }