コード例 #1
0
        private void Button25_Click(object sender, EventArgs e) //select building tasks for new village
        {
            string location = IoHelperForms.PromptUserForBuidTasksLocation();

            GetSelectedAcc().NewVillages.BuildingTasksLocationNewVillage = location;
            UpdateUc();
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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);
                }
            }

        }