private void Button25_Click(object sender, EventArgs e) //select building tasks for new village { string location = IoHelperForms.PromptUserForBuidTasksLocation(); GetSelectedAcc().NewVillages.BuildingTasksLocationNewVillage = location; UpdateUc(); }
private void button9_Click(object sender, EventArgs e) //export build tasks button { //remove buildingIds, they will get choosen appropriately when imported var buildTasks = getSelectedVillage().Build.Tasks; buildTasks.ToList().ForEach(x => x.BuildingId = null); IoHelperForms.ExportBuildTasks(JsonConvert.SerializeObject(buildTasks)); }
private void button24_Click(object sender, EventArgs e) //import build tasks button { var acc = GetSelectedAcc(); var vill = GetSelectedVillage(); string location = IoHelperForms.PromptUserForBuidTasksLocation(); if (location == null) { return; } IoHelperCore.AddBuildTasksFromFile(acc, vill, location); UpdateUc(); }
private void button5_Click(object sender, EventArgs e) //all villages select from file { var acc = GetSelectedAcc(); string location = IoHelperForms.PromptUserForBuidTasksLocation(); if (location == null) { return; } foreach (var vill in acc.Villages) { IoHelperCore.AddBuildTasksFromFile(acc, vill, location); } }
private void button5_Click(object sender, EventArgs e) //all villages select from file { var acc = getSelectedAcc(); string location = IoHelperForms.PromptUserForBuidTasksLocation(); List <BuildingTask> tasks; using (StreamReader sr = new StreamReader(location)) { tasks = JsonConvert.DeserializeObject <List <BuildingTask> >(sr.ReadToEnd()); } foreach (var vill in acc.Villages) { foreach (var task in tasks) { BuildingHelper.AddBuildingTask(acc, vill, task); } BuildingHelper.RemoveCompletedTasks(vill, acc); } }
private void button9_Click(object sender, EventArgs e) //export build tasks button { DialogResult dialog = MessageBox.Show("Do you want to save building locations?", "Exporting build tasks", MessageBoxButtons.YesNoCancel); if (dialog == DialogResult.Cancel) { return; } var buildTasks = GetSelectedVillage().Build.Tasks; // Remove buildingIds if user wants that if (dialog == DialogResult.No) { buildTasks.ToList().ForEach(x => x.BuildingId = null); } IoHelperForms.ExportBuildTasks(JsonConvert.SerializeObject(buildTasks)); }
private void button1_Click_1(object sender, EventArgs e) { var acc = getSelectedAcc(); string location = IoHelperForms.PromptUserForBuidTasksLocation(); if (location == null) return; for (int i = 0; i < tableModelMain.Rows.Count; i++) { if (tableModelMain.Rows[i].SelectedItems.Count() > 0) { var cells = tableModelMain.Rows[i].Cells; //Village id var id = Int32.Parse(cells[0].Text); var vill = acc.Villages.First(x => x.Id == id); IoHelperForms.AddBuildTasksFromFile(acc, vill, location); } } }