コード例 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            txtCategoryName.GotFocus         += TxtCategoryName_GotFocus;
            txtFunctionValue.GotFocus        += TxtFunctionValue_GotFocus;
            txtAchievementID.GotFocus        += TxtAchievementID_GotFocus;
            txtWoWPetBattleCriteria.GotFocus += TxtWoWPetBattleCriteria_GotFocus;
            txtWoWPetBattleCriteria.ResetText(); // Trigger text changes

            var connStrBuilder = new SqliteConnectionStringBuilder();

            connStrBuilder.DataSource = "../../../../Krowi_AchievementFilter.db";
            var connection = new SqliteConnection(connStrBuilder.ConnectionString);

            connection.Open();

            functionDataManager = new FunctionDataManager(connection);
            functionHandler     = new FunctionHandler(cbxFunctions, functionDataManager);

            achievementCategoryDataManager = new AchievementCategoryDataManager(connection, functionDataManager);
            achievementCategoryHandler     = new AchievementCategoryHandler(tvwAchievementCategories, achievementCategoryDataManager, functionHandler);

            achievementDataManager = new AchievementDataManager(connection);
            achievementHandler     = new AchievementHandler(lsbAchievements, btnUpdateAchievement_AGT, pgbUpdateAchievement_AGT, achievementDataManager, achievementCategoryHandler);

            xuFuEncounterDataManager = new XuFuEncounterDataManager(connection);
            xuFuEncounterHandler     = new XuFuEncounterHandler(btnUpdateXuFuEncounter, pgbUpdateXuFuEncounter, xuFuEncounterDataManager);

            petBattleLinksDataManager = new PetBattleLinksDataManager(connection);
            petBattleLinksHandler     = new PetBattleLinksHandler(petBattleLinksDataManager, achievementDataManager, xuFuEncounterDataManager);

            uiMapDataManager = new UIMapDataManager(connection);
            uiMapHandler     = new UIMapHandler(btnUpdateUIMap, pgbUpdateUIMap, uiMapDataManager);

            exportHandler = new ExportHandler((AchievementDataManager)achievementHandler.DataManager, (AchievementCategoryDataManager)achievementCategoryHandler.DataManager, (FunctionDataManager)functionHandler.DataManager, (PetBattleLinksDataManager)petBattleLinksHandler.DataManager, (UIMapDataManager)uiMapHandler.DataManager);

            achievementCategoryHandler.RefreshTreeView();
            functionHandler.RefreshComboBox();

            btnAchievementCategoryMoveLeft.Text  = char.ConvertFromUtf32(0x2190);
            btnAchievementCategoryMoveUp.Text    = char.ConvertFromUtf32(0x2191);
            btnAchievementCategoryMoveDown.Text  = char.ConvertFromUtf32(0x2193);
            btnAchievementCategoryMoveRight.Text = char.ConvertFromUtf32(0x2192);
            btnAchievementMoveUp.Text            = char.ConvertFromUtf32(0x2191);
            btnAchievementMoveDown.Text          = char.ConvertFromUtf32(0x2193);

            //// test
            //WebClient client = new WebClient();
            //StreamWriter writer = new StreamWriter(Path.Combine(Path.GetTempPath(), "testfile.txt"), true);
            //for (int i = 2; i < 1000; i++)
            //{
            //    var source = client.DownloadString($"https://www.wow-petguide.com/Strategy/{i}");
            //    var match = Regex.Match(source, "id=\"treasure_box.*?div", RegexOptions.Singleline);

            //    if (match.Success)
            //    {
            //        var s = Regex.Replace($"-- {i} -- {match.Value}", @"\s+", " ");
            //        writer.WriteLine(s);
            //    }
            //}
            //writer.Close();
        }