MethodInvoker

Namespace: Spring.Core
We found 10 examples in language CSharp for this search. You will see 42 fragments of code.
        private void setImageProperties(PictureBox picture, int width, int height, int x, int y, PictureBoxSizeMode Type)
        {
            picture.BeginInvoke((MethodInvoker)delegate () { picture.Location = new System.Drawing.Point(x, y); });
            picture.BeginInvoke((MethodInvoker)delegate () { picture.Size = new System.Drawing.Size(width, height); });
            picture.BeginInvoke((MethodInvoker)delegate () { picture.SizeMode = Type; });
        }
        #endregion
        #region labelScanRFID_Thumb
        private void labelHideNshow(bool condition)
        {
            if (labelScanRFID_Thumb.InvokeRequired)
            {
                labelScanRFID_Thumb.BeginInvoke((MethodInvoker)delegate () { labelScanRFID_Thumb.Visible = condition; });
            }
        }

        private void labelHideNshowTimeDate(bool TimeCondition, bool DateCondition)
        {
            if (TimeLabel.InvokeRequired)
            {
                TimeLabel.BeginInvoke((MethodInvoker)delegate () { TimeLabel.Visible = TimeCondition; });
                DateLabel.BeginInvoke((MethodInvoker)delegate () { DateLabel.Visible = DateCondition; });
            }
        }
        #endregion
        #region pictureBoxMainImage_Default
        private void DefaultScanCenterImagelocation()
        {
            if (pictureBoxMainImage.InvokeRequired)
            {
                pictureBoxMainImage.BeginInvoke((MethodInvoker)delegate ()
                {
                    pictureBoxMainImage.Location = new System.Drawing.Point(450, 46);
                    pictureBoxMainImage.Size = new System.Drawing.Size(311, 295);
                });
            }
        }

		
		static void Proc(string command, string fileName, MethodInvoker callback)
		{
			Proc(command, fileName, callback, null);
		}
		
		public static void ShowCheckoutDialog(MethodInvoker callback)
		{
			Proc("checkout", null, callback);
		}
		
		public static void ShowExportDialog(MethodInvoker callback)
		{
			Proc("export", null, callback);
		}
		
		public static void Update(string fileName, MethodInvoker callback)
		{
			Proc("update", fileName, callback);
		}
		
		public static void ApplyPatch(string fileName, MethodInvoker callback)
		{
			//Proc("applypatch", fileName, callback);
			// TODO: Applying patches is not implemented.
			MessageService.ShowMessage("Applying patches is not implemented.");
		}
		
		public static void CreatePatch(string fileName, MethodInvoker callback)
		{
			Proc("createpatch", fileName, callback);
		}


        internal void AddKeyHandler(Set<Keys> keySet, MethodInvoker methodInvoker)
        {
            Program.AssertOnEventThread();

            if (ExtraKeys.ContainsKey(keySet))
                ExtraKeys.Remove(keySet);

            ExtraKeys.Add(keySet, methodInvoker);
        }

        internal void AddKeyHandler(Set<int> keySet, MethodInvoker methodInvoker)
        {
            Program.AssertOnEventThread();

            if (ExtraScans.ContainsKey(keySet))
                ExtraScans.Remove(keySet);

            ExtraScans.Add(keySet, methodInvoker);
        }

		
		/// <summary>
		/// Invokes the <see cref="MethodInvokerRule"/> instance.
		/// </summary>
		/// <param name="token">
		/// Autorization token
		/// </param>
		public override void Produce(IProductionToken token)
		{
			this.methodInvoker();
			this.OnAction();
		}

        public void StartEncryptThread()
        {
            CheckEncryption(MyFiles);
        }
        public void StartDecryptThread()
        {


            int count = 0;
            foreach (var file in MyFiles)
            {
                if (Path.GetExtension(file) == ".aes")
                {
                    count++;
                }
            }
            MessageBox.Show("В файлах которые вы указали, были найдено: " + count + " .aes файлов");
            if (count == 0)
            {

                textBox_password.Invoke((MethodInvoker)(() => textBox_password.Text = ""));
            }
            else
            {

                CheckDescryption(MyFiles);
                count = 0;
            }

        }
        private void button_openFile_Click(object sender, EventArgs e)
        {

            // Проверяю нажаk ли 
            if (SelectFile.ShowDialog() == DialogResult.Cancel)
                return;

            else
            {
                listBox_SelectFiles.Items.Clear();
                foreach (var file in SelectFile.FileNames.ToList())
                {
                    listBox_SelectFiles.Items.Add(Path.GetFileName(file));
                    MyFiles = SelectFile.FileNames.ToList();
                }


            }

        } // button_openFile_Click

        // Штфрование
        private void button_Encryption_Click(object sender, EventArgs e)
        {
            if (checkBoxFileKEY.Checked)
            {
                if (MyFiles != null)
                {

                    Thread thread1 = new Thread(FileKeyEncrypt);
                    thread1.Start();

                } // if
                else
                {
                  
                    label_problem.ForeColor = Color.Red;
                    label_problem.Invoke((MethodInvoker)(() => label_problem.Text = "Выберите файл для шифрования"));
                }

            } // if
            else
            {
                Thread thread = new Thread(StartEncryptThread);
                thread.Start();
            }

           
        } // button_Encryption_Click

        // Дешифровка
        private void button_NonEncryption_Click(object sender, EventArgs e)
        {
            if (saveFileDesc.ShowDialog() == DialogResult.Cancel)
                return;

            if (checkBoxFileKEY.Checked)
            {

                Thread thread1 = new Thread(FileKeyDecrypt);
                thread1.Start();
            }
            else
            {
                Thread thread = new Thread(StartDecryptThread);
                thread.Start();
            }
           


        } // button_NonEncryption_Click


        private void CheckDescryption(List<string> MyFiles)
        {
            // Проверяю выбрал и я файл 
            if (MyFiles == null)
            {
                label_problem.ForeColor = Color.Red;
                label_problem.Text = "Такого файла не существует или вы его не выбрали";
            } // if 
            else
            {
                FilesAES = new List<string>();
                foreach (var file in MyFiles)
                {

                    if (Path.GetExtension(file) == ".aes")
                    {
                        FilesAES.Add(file);
                        // MyFiles.Remove(file);
                    }

                }
                // Задал ли я пароль
                if (String.IsNullOrEmpty(textBox_password.Text))
                {
                    label_problem.ForeColor = Color.Red;
                    label_problem.Invoke((MethodInvoker)(() => label_problem.Text = "Вы не указали пароль"));

                } // if     
                else
                {
                    int i = 0;
                    progressBar_encryption.Invoke((MethodInvoker)(() => progressBar_encryption.Maximum = FilesAES.Count));
                    progressBar_encryption.Minimum = 0;
                    bool flag = true;
                    button_Encryption.Invoke((MethodInvoker)(() => button_Encryption.Enabled = false));
                    button_NonEncryption.Invoke((MethodInvoker)(() => button_NonEncryption.Enabled = false));
                    button_openFile.Invoke((MethodInvoker)(() => button_openFile.Enabled = false));
                    button_SelectFolder.Invoke((MethodInvoker)(() => button_SelectFolder.Enabled = false));
                    foreach (var file in FilesAES)
                    {

                        fullname_saveFile = saveFileDesc.SelectedPath;
                        fullname_saveFile = fullname_saveFile + @"\" + Path.GetFileName(file);
                        fullname_saveFile = fullname_saveFile.Remove(fullname_saveFile.Length - 4);

                        if (myEncrypt.FileDecrypt(file, fullname_saveFile, textBox_password.Text))
                        {
                            i++;
                            progressBar_encryption.Invoke((MethodInvoker)(() => progressBar_encryption.Value = i));
                            label_problem.ForeColor = Color.Green;
                            label_problem.Invoke((MethodInvoker)(() => label_problem.Text = "Дешифровка..."));
                            flag = true;
                        }
                        else
                        {
                            i++;
                            progressBar_encryption.Invoke((MethodInvoker)(() => progressBar_encryption.Value = i));
                            label_problem.ForeColor = Color.Red;
                            label_problem.Invoke((MethodInvoker)(() => label_problem.Text = "Проблемы с паролем..."));
                            flag = false;
                        }

                    }
                    Thread.Sleep(3000);
                    button_Encryption.Invoke((MethodInvoker)(() => button_Encryption.Enabled = true));
                    button_NonEncryption.Invoke((MethodInvoker)(() => button_NonEncryption.Enabled = true));
                    button_openFile.Invoke((MethodInvoker)(() => button_openFile.Enabled = true));
                    button_SelectFolder.Invoke((MethodInvoker)(() => button_SelectFolder.Enabled = true));
                    i = 0;
                   
                    MyFiles.Clear();
                    progressBar_encryption.Invoke((MethodInvoker)(() => progressBar_encryption.Value = 0));
                    if (flag)
                    {
                        label_problem.ForeColor = Color.Green;
                        label_problem.Invoke((MethodInvoker)(() => label_problem.Text = "Дешифровка закончена..."));
                        textBox_password.Invoke((MethodInvoker)(() => textBox_password.Text = ""));
                        listBox_SelectFiles.Invoke((MethodInvoker)(() => listBox_SelectFiles.Items.Clear()));
                        MyFiles.Clear();
                    }
                    else
                    {
                        label_problem.ForeColor = Color.Red;
                        label_problem.Invoke((MethodInvoker)(() => label_problem.Text = "Дешифровка неудалась..."));
                        textBox_password.Invoke((MethodInvoker)(() => textBox_password.Text = ""));
                        //  listBox_SelectFiles.Invoke((MethodInvoker)(() => listBox_SelectFiles.Items.Clear()));
                    }


                }

            }
        }


        //#region display initialization text

        public void initText()
        {
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.Clear(); }));

            printText = "\nTFS Project Audit 2.3.0 by Jay Eberhard Copyright 2019\n\n";
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionLength = printText.Length; }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionFont = new Font("Arial",mainForm.rtfAbout.Font.Size, FontStyle.Bold); }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.AppendText(printText); }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionFont = new Font("Arial", mainForm.rtfAbout.Font.Size, FontStyle.Regular); }));
            printText = "";

            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.AppendText("Press the Help button at any time for information for the description and usage info.\n\n"); }));

            printText = "Protected by GPL, read COPYING.rtf before making any changes.\n\n";
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionLength = printText.Length; }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionFont = new Font("Arial", mainForm.rtfAbout.Font.Size, FontStyle.Underline); }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.AppendText(printText); }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionFont = new Font("Arial", mainForm.rtfAbout.Font.Size, FontStyle.Regular); }));
            printText = "";

            printText = "The TFS 2010 Forward Compatibility Pack is no longer required for TFS Projects.\n\n";
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionLength = printText.Length; }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionColor = Color.Red; }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.AppendText(printText); }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.SelectionColor = Color.Black; }));
            printText = "";

            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.AppendText("TFS 2005 Users MUST use version 1.0 of TFS Projects, which is available on http://tfsprojects.codeplex.com"); }));
            mainForm.rtfAbout.Invoke(new MethodInvoker(delegate { mainForm.rtfAbout.AppendText("\n\tFor email list generation, TFS 2005 users must use TFS Users, which is available at http://tfsusers.codeplex.com"); }));
        }

        //#endregion

        #region display user guide text

        public void helpText()
        {
            float zoom = mainForm.rtfHelp.ZoomFactor;
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.Clear(); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.ZoomFactor = zoom; }));

            printText = "TFS Projects -- Team Foundation Server Project Audit Tool\n\n";
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionLength = printText.Length; }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionFont = new Font("Arial", mainForm.rtfHelp.Font.Size, FontStyle.Bold); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText(printText); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionFont = new Font("Arial", mainForm.rtfHelp.Font.Size, FontStyle.Regular); }));
            printText = "";

            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("FUNCTION: lists all users for each project for all collections or a specified collection or for only one project within a collection and their roles for a TFS installation. "); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("Individual projects may be selected from the provided combo box once the connection is established.\n\n"); }));

            printText = "USAGE: Supply a valid server name, port number, TFS Version, TFS path and HTTP/S selection and (if applicable) collection name, then click Connect.\nUpon successful connection, select project role or all roles for all projects or individual project and click OK.\n";
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionLength = printText.Length; }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionFont = new Font("Arial", mainForm.rtfHelp.Font.Size, FontStyle.Underline); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText(printText); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionFont = new Font("Arial", mainForm.rtfHelp.Font.Size, FontStyle.Regular); }));
            printText = "";

            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("\nDefault values, which are loaded on startup, can be viewed and set on the Defaults tab.\n\n"); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("Project related user interface items will only become available upon successful connection to the TFS instance provided. A specific project or role on the server may be selected once connected. Results can be saved by clicking the Save Output... button. To generate a list of email addresses rather than verbose project information based on the specified criteria, check the Email Address List check box.\n\n"); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("When specifying a collection for TFS 2010 or later, you only need supply the actual collection name. A server name or any slashes or backslashes should not be included in the collection name.\n\n"); }));

            printText = "To gather data from all collections on TFS 2010 or later specify \"all-collections\" without quotes as the collection name in the Collection field.\n\n";
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionLength = printText.Length; }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionColor = Color.Red; }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText(printText); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionColor = Color.Black; }));
            printText = "";

            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("If no collection names are known use all-collections and a list of collections on the server will be provided then you can simply reconnect to the one you need.\n\n"); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("TFS port is 8080 by default, if this value gives an error contact your TFS admin for your port number."); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("\n\nTFS 2005 Users MUST use version 1.0 of TFS Projects, which is available at http://tfsprojects.codeplex.com"); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText("\n\tFor email list generation, TFS 2005 users must use TFS Users, which is available at http://tfsusers.codeplex.com"); }));
            
            printText = "\n\nTFS Project Audit 2.1 by Jay Eberhard Copyright 2016.\n\n";
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionLength = printText.Length; }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionFont = new Font("Arial", mainForm.rtfHelp.Font.Size, FontStyle.Bold); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.AppendText(printText); }));
            mainForm.rtfHelp.Invoke(new MethodInvoker(delegate { mainForm.rtfHelp.SelectionFont = new Font("Arial", mainForm.rtfHelp.Font.Size, FontStyle.Regular); }));
            printText = "";
        }

        #endregion

        #region display legal licence information

        public void copyingText()
        {
            try
            {
                mainForm.rtfLegal.Invoke(new MethodInvoker(delegate { mainForm.rtfLegal.Clear(); }));

                //load all the legal info from the COPYING.rtf file, in the app dir path
                //using (StreamReader sr = new StreamReader("Resources\\COPYING.rtf"))
                string copyFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\TFSProjects\\COPYING.rtf";
                using (StreamReader sr = new StreamReader(copyFile));
                {
                    mainForm.rtfLegal.Invoke(new MethodInvoker
                        //(delegate { mainForm.rtfLegal.LoadFile(Environment.SpecialFolder.LocalApplicationData + "\\TFSProjects\\COPYING.rtf"); })
                        (delegate { mainForm.rtfLegal.LoadFile(copyFile); })
                    );
                }
            }
            catch (Exception e)
            {
                mainForm.rtfLegal.Invoke(new MethodInvoker(delegate { mainForm.rtfLegal.AppendText("ERROR: Copyright information file is not in its expected location!\n\n"); }));
                mainForm.rtfLegal.Invoke(new MethodInvoker(delegate { mainForm.rtfLegal.AppendText("This code is still bound by the license agreement which was installed with the program.\n\n"); }));
                mainForm.rtfLegal.Invoke(new MethodInvoker(delegate { mainForm.rtfLegal.AppendText("Please re-install TFSProjects, the most current version is available at http://tfsprojects.codeplex.com \n\n"); }));
                mainForm.rtfLegal.Invoke(new MethodInvoker(delegate { mainForm.rtfLegal.AppendText("\n\nException message: \n\n" + e.Message); }));
            }
        }


        private void Castle_Load(object sender, EventArgs e)
        {
            new Thread(() =>
            {
                label45.Invoke((MethodInvoker)(() => label45.Text = "IP: " + LordsMobileAPI.API.Server.IP));
            }).Start();
            new Thread(() =>
            {
                label1.Invoke((MethodInvoker)(() => label1.Text = "Gems: " + LordsMobileAPI.API.LocalUser.Statistic.Gems.Count));
            }).Start();
            new Thread(() =>
            {
                label2.Invoke((MethodInvoker)(() => label2.Text = "Power: " + LordsMobileAPI.API.LocalUser.Statistic.Power.Count));
            }).Start();
            new Thread(() =>
            {
                label3.Invoke((MethodInvoker)(() => label3.Text = "Energy: " + LordsMobileAPI.API.LocalUser.Statistic.Energy.Count));
            }).Start();
            new Thread(() =>
            {
                string treasurebox = LordsMobileAPI.API.LocalUser.Castle.MysteryBox.Time;
                if (treasurebox.Contains(":"))
                    iconPictureBox4.Invoke((MethodInvoker)(() => iconPictureBox4.IconChar = FontAwesome.Sharp.IconChar.Box));
                else
                    iconPictureBox4.Invoke((MethodInvoker)(() => iconPictureBox4.IconChar = FontAwesome.Sharp.IconChar.BoxOpen));
                label4.Invoke((MethodInvoker)(() => label4.Text = "Treasure box: " + treasurebox));
            }).Start();
            new Thread(() =>
            {
                label5.Invoke((MethodInvoker)(() => label5.Text = "Stamina: " + LordsMobileAPI.API.LocalUser.Statistic.Stamina.Count));
            }).Start();
            new Thread(() =>
            {
                label6.Invoke((MethodInvoker)(() => label6.Text = "IGG ID: " + LordsMobileAPI.API.LocalUser.Auth.IGG_ID));
            }).Start();
            new Thread(() =>
            {
                label7.Invoke((MethodInvoker)(() => label7.Text = "Gems: " + LordsMobileAPI.API.LocalUser.Castle.Coliseum.Gems));
            }).Start();
            /* Resourses */
            new Thread(() =>
            {
                label9.Invoke((MethodInvoker)(() => label9.Text = "Food: " + Math.Round(LordsMobileAPI.API.LocalUser.Castle.Resources.Food.Count, 0) + "/" + LordsMobileAPI.API.LocalUser.Castle.Resources.Food.Maximum));
            }).Start();
            new Thread(() =>
            {
                label12.Invoke((MethodInvoker)(() => label12.Text = "Stone: " + Math.Round(LordsMobileAPI.API.LocalUser.Castle.Resources.Stone.Count, 0) + "/" + LordsMobileAPI.API.LocalUser.Castle.Resources.Stone.Maximum));
            }).Start();
            new Thread(() =>
            {
                label13.Invoke((MethodInvoker)(() => label13.Text = "Wood: " + Math.Round(LordsMobileAPI.API.LocalUser.Castle.Resources.Wood.Count, 0) + "/" + LordsMobileAPI.API.LocalUser.Castle.Resources.Wood.Maximum));
            }).Start();
            new Thread(() =>
            {
                label8.Invoke((MethodInvoker)(() => label8.Text = "Ore: " + Math.Round(LordsMobileAPI.API.LocalUser.Castle.Resources.Ore.Count, 0) + "/" + LordsMobileAPI.API.LocalUser.Castle.Resources.Ore.Maximum));
            }).Start();
            new Thread(() =>
            {
                label11.Invoke((MethodInvoker)(() => label11.Text = "Gold: " + Math.Round(LordsMobileAPI.API.LocalUser.Castle.Resources.Gold.Count, 0) + "/" + LordsMobileAPI.API.LocalUser.Castle.Resources.Gold.Maximum));
            }).Start();
            new Thread(() =>
            {
                label10.Invoke((MethodInvoker)(() => label10.Text = "Anima: " + Math.Round(LordsMobileAPI.API.LocalUser.Castle.Resources.Anima.Count, 0) + "/" + LordsMobileAPI.API.LocalUser.Castle.Resources.Anima.Maximum));
            }).Start();
            new Thread(() =>
            {
                label17.Invoke((MethodInvoker)(() => label17.Text = "Rank: " + LordsMobileAPI.API.LocalUser.Castle.Coliseum.Rank));
            }).Start();
            new Thread(() =>
            {
                label44.Invoke((MethodInvoker)(() => label44.Text = "Version: " + LordsMobileAPI.API.Server.Version));
            }).Start();
            /* Army */
            new Thread(() =>
            {
                label20.Invoke((MethodInvoker)(() => label20.Text = "Infantry: " + LordsMobileAPI.API.LocalUser.Castle.Army.Infantry.T1.Count));
            }).Start();
            new Thread(() =>
            {
                label21.Invoke((MethodInvoker)(() => label21.Text = "Archer: " + LordsMobileAPI.API.LocalUser.Castle.Army.Archer.T1.Count));
            }).Start();
            new Thread(() =>
            {
                label22.Invoke((MethodInvoker)(() => label22.Text = "Rider: " + LordsMobileAPI.API.LocalUser.Castle.Army.Rider.T1.Count));
            }).Start();
            new Thread(() =>
            {
                label23.Invoke((MethodInvoker)(() => label23.Text = "Ballista: " + LordsMobileAPI.API.LocalUser.Castle.Army.Ballista.T1.Count));
            }).Start();
            new Thread(() =>
            {
                label24.Invoke((MethodInvoker)(() => label24.Text = "Ballista: " + LordsMobileAPI.API.LocalUser.Castle.Army.Ballista.T2.Count));
            }).Start();
            new Thread(() =>
            {
                label25.Invoke((MethodInvoker)(() => label25.Text = "Rider: " + LordsMobileAPI.API.LocalUser.Castle.Army.Rider.T2.Count));
            }).Start();
            new Thread(() =>
            {
                label26.Invoke((MethodInvoker)(() => label26.Text = "Archer: " + LordsMobileAPI.API.LocalUser.Castle.Army.Archer.T2.Count));
            }).Start();
            new Thread(() =>
            {
                label27.Invoke((MethodInvoker)(() => label27.Text = "Infantry: " + LordsMobileAPI.API.LocalUser.Castle.Army.Infantry.T2.Count));
            }).Start();
            new Thread(() =>
            {
                label32.Invoke((MethodInvoker)(() => label32.Text = "Infantry: " + LordsMobileAPI.API.LocalUser.Castle.Army.Infantry.T3.Count));
            }).Start();
            new Thread(() =>
            {
                label31.Invoke((MethodInvoker)(() => label31.Text = "Archer: " + LordsMobileAPI.API.LocalUser.Castle.Army.Archer.T3.Count));
            }).Start();
            new Thread(() =>
            {
                label30.Invoke((MethodInvoker)(() => label30.Text = "Rider: " + LordsMobileAPI.API.LocalUser.Castle.Army.Rider.T3.Count));
            }).Start();
            new Thread(() =>
            {
                label29.Invoke((MethodInvoker)(() => label29.Text = "Ballista: " + LordsMobileAPI.API.LocalUser.Castle.Army.Ballista.T3.Count));
            }).Start();
            new Thread(() =>
            {
                label47.Invoke((MethodInvoker)(() => label47.Text = "Total: " + LordsMobileAPI.API.LocalUser.Castle.Army.TotalCount));
            }).Start();
            new Thread(() =>
            {
                label46.Invoke((MethodInvoker)(() => label46.Text = "All: " + string.Join(", ", LordsMobileAPI.API.LocalUser.PromoCodes.All)));
            }).Start();
            new Thread(() =>
            {
                label49.Invoke((MethodInvoker)(() => label49.Text = "Attacks: " + LordsMobileAPI.API.LocalUser.Castle.Attack.Status.AttackCount));
            }).Start();
            new Thread(() =>
            {
                label50.Invoke((MethodInvoker)(() => label50.Text = "Scouting: " + LordsMobileAPI.API.LocalUser.Castle.Attack.Status.ScoutingCount));
            }).Start();
        }

        private void panel12_Paint(object sender, PaintEventArgs e)
        {

        }

        public static void SetItemCheckStatus(ListView listview, ListViewItem item, bool isChecked)
        {
            MethodInvoker miSetItemCheckStatus = delegate
            {
                item.Checked = isChecked;
            };

            if (listview.InvokeRequired)
            {
                listview.Invoke(miSetItemCheckStatus);
            }
            else
            {
                miSetItemCheckStatus();
            }
        }

        public static void AddItem(ListView listview, ListViewItem item)
        {
            MethodInvoker miAddItem = delegate
            {
                listview.Items.Add(item);
            };

            if (listview.InvokeRequired)
            {
                listview.Invoke(miAddItem);
            }
            else
            {
                miAddItem();
            }
        }

        public static void AddColumn(ListView listview, ColumnHeader column)
        {
            MethodInvoker miAddColumn = delegate
            {
                listview.Columns.Add(column);
            };

            if (listview.InvokeRequired)
            {
                listview.Invoke(miAddColumn);
            }
            else
            {
                miAddColumn();
            }
        }
        
        public static void InsertItem(ListView listview, int index, ListViewItem item)
        {
            MethodInvoker miInsertItem = delegate
            {
                listview.Items.Insert(index, item);
            };

            if (listview.InvokeRequired)
            {
                listview.Invoke(miInsertItem);
            }
            else
            {
                miInsertItem();
            }
        }

        public static void RemoveItem(ListView listview, ListViewItem item)
        {
            MethodInvoker miRemoveItem = delegate
            {
                listview.Items.Remove(item);
            };

            if (listview.InvokeRequired)
            {
                listview.Invoke(miRemoveItem);
            }
            else
            {
                miRemoveItem();
            }
        }

        public static void RemoveItemAt(ListView listview, int index)
        {
            MethodInvoker miRemoveItem = delegate
            {
                listview.Items.RemoveAt(index);
            };

            if (listview.InvokeRequired)
            {
                listview.Invoke(miRemoveItem);
            }
            else
            {
                miRemoveItem();
            }
        }


		// Token: 0x06002315 RID: 8981 RVA: 0x00076AE4 File Offset: 0x00074CE4
		private void method_0(MethodInvoker del, MethodInvoker extraDel = null)
		{
			lock (this.object_0)
			{
				if (base.DesignMode)
				{
					del();
				}
				else
				{
					bool enabled = this.Enabled;
					this.Enabled = false;
					this.method_3();
					del();
					if (extraDel != null)
					{
						extraDel();
					}
					this.Enabled = enabled;
				}
			}
		}

		// Token: 0x06002318 RID: 8984 RVA: 0x00076BCC File Offset: 0x00074DCC
		private void timer_0_Elapsed(object sender, EventArgs e)
		{
			this.timer_0.Enabled = false;
			if (this.control_0 == null)
			{
				this.enum77_0 = Class343.Enum77.const_0;
				return;
			}
			switch (this.enum77_0)
			{
			default:
				this.timer_0.Enabled = false;
				goto IL_E0;
			case Class343.Enum77.const_1:
				goto IL_B9;
			case Class343.Enum77.const_2:
				this.enum77_0 = Class343.Enum77.const_3;
				this.timer_0.Interval = (double)this.int_3;
				break;
			case Class343.Enum77.const_3:
				break;
			case Class343.Enum77.const_4:
				this.enum77_0 = Class343.Enum77.const_1;
				this.timer_0.Interval = (double)this.int_2;
				goto IL_B9;
			}
			if (this.method_1(this.int_7))
			{
				goto IL_E0;
			}
			if (this.bool_1)
			{
				this.Enabled = false;
				return;
			}
			this.timer_0.Interval = (double)this.int_4;
			this.enum77_0 = Class343.Enum77.const_4;
			goto IL_E0;
			IL_B9:
			if (!this.method_1(this.int_6))
			{
				this.timer_0.Interval = (double)this.int_5;
				this.enum77_0 = Class343.Enum77.const_2;
			}
			IL_E0:
			this.timer_0.Enabled = true;
		}

		// Token: 0x06002319 RID: 8985 RVA: 0x00076CC8 File Offset: 0x00074EC8
		private bool method_1(int step)
		{
			switch (this.enum100_0)
			{
			case Enum100.const_0:
				if (this.enum77_0 == Class343.Enum77.const_1)
				{
					step = -step;
				}
				return this.method_2(this.control_0.Location.X + step, this.int_1, this.int_0);
			case Enum100.const_1:
				if (this.enum77_0 == Class343.Enum77.const_3)
				{
					step = -step;
				}
				return this.method_2(this.control_0.Location.X + step, this.int_0, this.int_1);
			case Enum100.const_2:
				if (this.enum77_0 == Class343.Enum77.const_1)
				{
					step = -step;
				}
				return this.method_2(this.control_0.Location.Y + step, this.int_1, this.int_0);
			case Enum100.const_3:
				if (this.enum77_0 == Class343.Enum77.const_3)
				{
					step = -step;
				}
				return this.method_2(this.control_0.Location.Y + step, this.int_0, this.int_1);
			default:
				throw new InvalidOperationException("The SlideDirection is not supported.");
			}
		}

		// Token: 0x0600231A RID: 8986 RVA: 0x00076DD4 File Offset: 0x00074FD4
		private bool method_2(int position, int minPos, int maxPos)
		{
			Class343.Class354 @class = new Class343.Class354();
			@class.int_0 = position;
			@class.int_1 = minPos;
			@class.int_2 = maxPos;
			@class.class343_0 = this;
			return this.control_0.smethod_5(new Func<bool>(@class.method_0));
		}

		// Token: 0x0600231B RID: 8987 RVA: 0x0000EF39 File Offset: 0x0000D139
		protected override void Dispose(bool disposing)
		{
			this.Enabled = false;
			this.timer_0.Dispose();
			base.Dispose(disposing);
		}

		// Token: 0x0600231C RID: 8988 RVA: 0x00076E1C File Offset: 0x0007501C
		private void method_3()
		{
			MethodInvoker methodInvoker = null;
			MethodInvoker methodInvoker2 = null;
			if (this.control_0 != null)
			{
				switch (this.enum100_0)
				{
				case Enum100.const_0:
				case Enum100.const_1:
				{
					Control sender = this.control_0;
					if (methodInvoker2 == null)
					{
						methodInvoker2 = new MethodInvoker(this.method_8);
					}
					sender.smethod_6(methodInvoker2);
					break;
				}
				case Enum100.const_2:
				case Enum100.const_3:
				{
					Control sender2 = this.control_0;
					if (methodInvoker == null)
					{
						methodInvoker = new MethodInvoker(this.method_7);
					}
					sender2.smethod_6(methodInvoker);
					break;
				}
				}
				this.enum77_0 = Class343.Enum77.const_4;
			}
		}



		void MainFormLoad(object sender, EventArgs e)
		{
        	comport.DataSource = SerialPort.GetPortNames();
		}


		void ButtonConnectClick(object sender, EventArgs e)
		{
			com = new SerialPort(comport.SelectedItem.ToString());
        	
			if (!com.IsOpen) {
            	com.BaudRate = 9600;
            	com.Open();
            	com.DataReceived += com_DataReceived;
			}
			
			buttonConnect.Enabled = false;
		}

		void com_DataReceived(object sender, SerialDataReceivedEventArgs e)
		{
			int i;

			int dataLength = com.BytesToRead;
    		byte[] data = new byte[dataLength];
    		
    		int nbrDataRead = com.Read(data, 0, dataLength);
    		if (nbrDataRead == 0) {
        		return;
    		}
    		
    		for (i = 0; i < nbrDataRead; i++) {
    			if (data[i] != 10) {
    				comBuf.Push(data[i]);
    			}
    			else {
    				if (comBuf.Count > 1) {
    					status2 = comBuf.Pop();
    					status1 = comBuf.Pop();
    					
    					comBuf.Clear();
    				}
    			}
    		}
    		

    		switch (status1) {
				case (byte)'E':
					textStatus1.BeginInvoke((MethodInvoker)(() => 
						textStatus1.Text = "Ошибка"
					));
					panelStatus1.BeginInvoke((MethodInvoker)(() => 
						panelStatus1.BackColor = Color.LightYellow
					));
    				break;
    				
				case (byte)'U':
					textStatus1.BeginInvoke((MethodInvoker)(() => 
						textStatus1.Text = "Непонятно"
					));
					panelStatus1.BeginInvoke((MethodInvoker)(() => 
						panelStatus1.BackColor = Color.LightYellow
					));
					break;
					
				case (byte)'C':
					textStatus1.BeginInvoke((MethodInvoker)(() => 
						textStatus1.Text = "Закрываю"
					));
					panelStatus1.BeginInvoke((MethodInvoker)(() => 
						panelStatus1.BackColor = Color.LightPink
					));
					break;

				case (byte)'c':
					textStatus1.BeginInvoke((MethodInvoker)(() => 
						textStatus1.Text = "Закрыто"
					));
					panelStatus1.BeginInvoke((MethodInvoker)(() => 
						panelStatus1.BackColor = Color.Pink
					));
					break;

				case (byte)'O':
					textStatus1.BeginInvoke((MethodInvoker)(() => 
						textStatus1.Text = "Открываю"
					));
					panelStatus1.BeginInvoke((MethodInvoker)(() => 
						panelStatus1.BackColor = Color.LightGreen
					));
					break;

				case (byte)'o':
					textStatus1.BeginInvoke((MethodInvoker)(() => 
						textStatus1.Text = "Открыто"
					));
					panelStatus1.BeginInvoke((MethodInvoker)(() => 
						panelStatus1.BackColor = Color.LightGreen
					));
					break;
			}

			// TODO один мотор не будет работать, только два :(    		
			switch (status2) {
				case (byte)'E':
					textStatus2.BeginInvoke((MethodInvoker)(() => 
						textStatus2.Text = "Ошибка"
					));
					panelStatus2.BeginInvoke((MethodInvoker)(() => 
						panelStatus2.BackColor = Color.LightYellow
					));
					break;

				case (byte)'U':
					textStatus2.BeginInvoke((MethodInvoker)(() => 
						textStatus2.Text = "Непонятно"
					));
					panelStatus2.BeginInvoke((MethodInvoker)(() => 
						panelStatus2.BackColor = Color.LightYellow
					));
					break;
					
				case (byte)'C':
					textStatus2.BeginInvoke((MethodInvoker)(() => 
						textStatus2.Text = "Закрываю"
					));
					panelStatus2.BeginInvoke((MethodInvoker)(() => 
						panelStatus2.BackColor = Color.LightPink
					));
					break;

				case (byte)'c':
					textStatus2.BeginInvoke((MethodInvoker)(() => 
						textStatus2.Text = "Закрыто"
					));
					panelStatus2.BeginInvoke((MethodInvoker)(() => 
						panelStatus2.BackColor = Color.Pink
					));
					break;

				case (byte)'O':
					textStatus2.BeginInvoke((MethodInvoker)(() => 
						textStatus2.Text = "Открываю"
					));
					panelStatus2.BeginInvoke((MethodInvoker)(() => 
						panelStatus2.BackColor = Color.LightGreen
					));
					break;

				case (byte)'o':
					textStatus2.BeginInvoke((MethodInvoker)(() => 
						textStatus2.Text = "Открыто"
					));
					panelStatus2.BeginInvoke((MethodInvoker)(() => 
						panelStatus2.BackColor = Color.LightGreen
					));
					break;
			}
		}
		
		
		void ButtonOpenClick(object sender, EventArgs e)
		{
			com.Write("O");
		}
		void ButtonCloseClick(object sender, EventArgs e)
		{
			com.Write("C");
		}
		void MainFormFormClosing(object sender, FormClosingEventArgs e)
		{
			if (com != null && com.IsOpen) {
				com.DataReceived -= com_DataReceived;
				com.Close();
			}
		}

Spring.Objects.Support.MethodInvoker : Object

Fields :

public static Missing Void

Constructors :

public MethodInvoker()

Methods :

public Type get_TargetType()
public Void set_TargetType(Type value = )
public Object get_TargetObject()
public Void set_TargetObject(Object value = )
public String get_TargetMethod()
public Void set_TargetMethod(String value = )
public Object[] get_Arguments()
public Void set_Arguments(Object[] value = )
public IDictionary get_NamedArguments()
public Void set_NamedArguments(IDictionary value = )
public Void Prepare()
public Void AddNamedArgument(String argumentName = , Object argument = )
public MethodInfo GetPreparedMethod()
public Object Invoke()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods