Esempio n. 1
0
        private void Create_Click(object sender, EventArgs e)
        {
            CivMenu civMenu = new CivMenu(Config, 0);

            civMenu.Closed += delegate
            {
                Invoke((MethodInvoker)Close);
            };

            int index = -1;

            civMenu.CivilianDownloaded += delegate
            {
                Civilians.Add(civMenu.LocalCivilian);

                ListViewItem item = new ListViewItem(new[] { civMenu.LocalCivilian.ID.ToSplitID(), "" });
#pragma warning disable CS1690 // Accessing a member on a field of a marshal-by-reference class may cause a runtime exception
                civs.Items.Add(item);
#pragma warning restore CS1690 // Accessing a member on a field of a marshal-by-reference class may cause a runtime exception
                index = civs.Items.IndexOf(item);
            };

            civMenu.NameBox.TextChanged += delegate
            {
                civs.Items[index].SubItems[1].Text = civMenu.NameBox.Text;
            };

            civMenu.Show();
            ThreadPool.QueueUserWorkItem(async x => await civMenu.Sync());
        }
Esempio n. 2
0
        private void Civs_DoubleClick(object sender, EventArgs e)
        {
            int index = civs.SelectedItems[0].Index;

            CivMenu civMenu = new CivMenu(Config, civs.Items[index].SubItems[0].Text.ToRawID());

            civMenu.Closed += delegate
            {
                Invoke((MethodInvoker)Close);
            };

            civMenu.NameBox.TextChanged += delegate
            {
                civs.Items[index].SubItems[1].Text = civMenu.NameBox.Text;
            };


            civMenu.Show();
            ThreadPool.QueueUserWorkItem(async x => await civMenu.Sync());
        }