Example #1
0
        private void BarraProgresso()
        {
            Control.CheckForIllegalCrossThreadCalls = false;
            Progresso++;
            meuDelegate Atualiza = new meuDelegate(this.AtualizaProgresso);

            this.Invoke((Atualiza), Progresso, progressBar1);
        }
Example #2
0
        public static void calcula(int numA, int numB, int posV)
        {
            vetDelegates    = new meuDelegate[6];
            vetDelegates[1] = new meuDelegate(Calculadora.soma);
            vetDelegates[2] = new meuDelegate(Calculadora.subtracao);
            vetDelegates[3] = new meuDelegate(Calculadora.multiplicacao);
            vetDelegates[4] = new meuDelegate(Calculadora.divisao);
            vetDelegates[5] = new meuDelegate(Calculadora.modulo);

            while (true)
            {
                try {
                    System.Console.WriteLine("Resultado: " + (vetDelegates[posV] (numA, numB).ToString("F1")));
                    break;
                } catch (DivideByZeroException) {
                    System.Console.Write("Erro! Tentativa de divisão por zero.");
                } catch (FormatException) {
                    System.Console.WriteLine("O número digitado não é valido.");
                }
            }
        }