/************************************************************************************************************ * * Load External Build File * ************************************************************************************************************/ private void LoadToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "txt files (*.txt)|*.txt"; ofd.FilterIndex = 1; if (ofd.ShowDialog() == DialogResult.OK) { Build read = BuildReader.ReadFromFile(ofd.FileName); Build inList = GetBuildByNameFromList(read.Name); if (inList == null) { BuildWriter.WriteToFile(read); LoadedBuildOrders = BuildReader.ReadFromBuildDirectory(); PopulateBuildList(LoadedBuildOrders); SelectBuild(read); SelectedBuild = read; ReSelectBuildInList(); } else { MessageBox.Show(LOADING_INFO, INFO_STR, MessageBoxButtons.OK, MessageBoxIcon.Information); SelectedBuild = inList; ReSelectBuildInList(); } } }
/******************************** User Interface Utilities ********************************/ private void RefreshBuildData() { LoadedBuildOrders = BuildReader.ReadFromBuildDirectory(); if (bBuildListSortedByRace) { PopulateBuildList(GetSortedBuildsByRace(LoadedBuildOrders, SortByRaceIndex)); } else if (bBuildListSortedByMatchup) { PopulateBuildList(GetSortedBuildsByMatchup(LoadedBuildOrders, SortByMatchupIndex)); } else { PopulateBuildList(LoadedBuildOrders); } if (SelectedBuild == null) { if (LoadedBuildOrders.Count > 0) { SelectedBuild = LoadedBuildOrders[0]; } } PopulateStepList(SelectedBuild); PopulateBuildEditor(SelectedBuild); ReSelectBuildInList(); BuildList.Select(); }
/******************************** Loading & Exiting ********************************/ private void MainWindow_Load(object sender, EventArgs e) { LoadedBuildOrders = BuildReader.ReadFromBuildDirectory(); PopulateBuildList(LoadedBuildOrders); }