async Task CheckForUpdate()
        {
            var versionInfoUrl = ResourceHolder.Instance.GetString("VersionInfoUrl");
            var latestVersion  = await new LatestVersionInfoRetriever(new Uri(versionInfoUrl))
                                 .GetLatestVersionInfoAsync();

            if (latestVersion.IsNewerThan(PluginInfo.Instance.CurrentVersionString))
            {
                var caption = "提督業も忙しい! - " + ResourceHolder.Instance.GetString("PluginName");
                var message = string.Format(
                    latestVersion.IsEmergency ? "{0}\n{1}" : "{1}",
                    ResourceHolder.Instance.GetString("NewerVersionAvailableMessageEmergencyPrefix"),
                    ResourceHolder.Instance.GetString("NewerVersionAvailableMessage"));

                var app = LocalizationUtil.GetApplication();
                var ret = app?.MainWindow != null
                                        ? MessageBox.Show(app.MainWindow, message, caption, MessageBoxButton.YesNo, MessageBoxImage.Information)
                                        : MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Information);

                if (ret == MessageBoxResult.Yes)
                {
                    var url = ResourceHolder.Instance.GetString("KcvdbPluginWebUrl");
                    WebUtil.OpenUri(new Uri(url));
                }
            }
        }
        public async void Initialize()
        {
            TaihaToolkit.RegisterComponents(WPFComponent.Instance);

            TelemetryClient.TrackEvent("PluginLoaded");

            // Set a hook to detect app crash
            try {
                var app = LocalizationUtil.GetApplication();
                app.DispatcherUnhandledException += App_DispatcherUnhandledException;
            }
            catch (Exception ex) {
                TelemetryClient.TrackException("Failed to set set a hook to detect app crash.", ex);
            }

            // Obtain default app culture
            try {
                ResourceHolder.Instance.Culture = LocalizationUtil.GetCurrentAppCulture();
                UpdateChineseCulture();
            }
            catch (Exception ex) {
                TelemetryClient.TrackException("Failed to get default app culture.", ex);
            }

            // Initialize KCVDB client
            try {
                var sessionId = Guid.NewGuid().ToString();
                apiSender_ = new ApiSender(sessionId);
                viewModel_ = new ToolViewViewModel(
                    apiSender_.KcvdbClient,
                    sessionId,
                    new WPFDispatcher(Dispatcher.CurrentDispatcher));
            }
            catch (Exception ex) {
                TelemetryClient.TrackException("Failed to initialize KCVDB client.", ex);
            }

            Settings.Default.PropertyChanged += Settings_PropertyChanged;

            TelemetryClient.TrackEvent("PluginInitialized");

            try {
                await CheckForUpdate();
            }
            catch (Exception ex) {
                TelemetryClient.TrackException("Failed to check the latest version.", ex);
                if (ex.IsCritical())
                {
                    throw;
                }
            }
        }