Пример #1
0
 public PresetForm(Form1 mainform, VillageForm vf)
 {
     mform = mainform;
     vform = vf;
     InitializeComponent();
     preset = new BuildPreset();
     preset.buildSettings = new BuildSettings();
     preset.Queue         = new List <string>(); // move it to classs itself when initialize it
     mform = mainform;
     for (int i = 0; i < Buildingslist.Items.Count; i++)
     {
         Buildingslist.Items[i].SubItems.Add(new ListViewItem.ListViewSubItem(Buildingslist.Items[i], "0"));
     }
     //Load queue
     UpdateView(preset.Queue);
 }
Пример #2
0
        private void VillagesContextMenuClick(object sender, EventArgs e)
        {
            //active / deactive
            ToolStripItem itm   = sender as ToolStripItem;
            var           match = Villages.Find((v) => v.Name == villageslist.FocusedItem.SubItems[1].Text);

            if (itm.Text == "Set active")
            {
                if (match.BuildQueue != null)
                {
                    if (match.buildSettings.AnyOption() == true)
                    {
                        match.villageSettings.Active = true;
                    }
                    else
                    {
                        MessageBox.Show("Cannot set active village without queue or buildsettings");
                    }
                }
                else
                {
                    MessageBox.Show("Cannot set active village without queue or buildsettings");
                }
            }
            else if (itm.Text == "Disable")
            {
                match.villageSettings.Active = false;
            }
            else if (itm.Text == "Configure")
            {
                VillageForm vf = new VillageForm(this, match);
                vf.Show();
            }
            else if (itm.Text == "Remove")
            {
                Villages.Remove(match);
            }
            UpdateVillageList(Villages);
        }