コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Kuh4ku/Mercybot
        private void HandleFilesHashesMessage(FilesHashesMessage message)
        {
            Application.Current.Dispatcher.Invoke(async() =>
            {
                // Updater
                if (await this.ShowUpdatesAsync(message.FilesHashes))
                {
                    Environment.Exit(0);
                    return;
                }

                // Loading
                try
                {
                    var controller = await this.ShowProgressAsync(LanguageManager.Translate("483"), Randomize.GetRandomLoadingText());

                    await Task.Run(async() =>
                    {
                        Protocol.Messages.MessagesBuilder.Initialize();
                        controller.SetProgress(0.14);
                        await Task.Delay(200);

                        TypesBuilder.Initialize();
                        controller.SetProgress(0.28);
                        await Task.Delay(200);

                        DataManager.Initialize(DTConstants.AssetsVersion, GlobalConfiguration.Instance.Lang);
                        controller.SetProgress(0.42);
                        await Task.Delay(200);

                        MapsManager.Initialize(DTConstants.AssetsVersion);
                        controller.SetProgress(0.56);
                        await Task.Delay(200);

                        FramesManager.Initialize();
                        controller.SetProgress(0.70);
                        await Task.Delay(200);

                        CommandsHandler.Initialize();

                        BreedsUtility.Initialize();
                        controller.SetProgress(1);
                        await Task.Delay(200);

                        LuaScriptManager.Initialize();
                    });

                    await controller.CloseAsync();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            });
        }