Пример #1
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var apiKey = ApiKeyStore.GetApiKey();

            if (string.IsNullOrEmpty(apiKey))
            {
                var needKeyMessage = "In order to use this app, you'll need to register an API Key. Do you want do do this now?";
                if (MessageBox.Show(needKeyMessage, "API Review List", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No)
                {
                    Environment.Exit(1);
                }

                await SetApiKey();
            }
            else if (!await GitHubClientFactory.IsValidKeyAsync(apiKey))
            {
                var needKeyMessage = "The API key is no longer valid. In order to use this app, you'll need to register a new API Key. Do you want do do this now?";
                if (MessageBox.Show(needKeyMessage, "API Review List", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No)
                {
                    Environment.Exit(1);
                }

                await SetApiKey();
            }

            var window = new MainWindow();

            window.Show();
        }
Пример #2
0
        public static GitHubClient Create()
        {
            var key = ApiKeyStore.GetApiKey();

            return(Create(key));
        }