示例#1
0
        private int getTypedDataFromUser(PW_GetData expectedData)
        {
            bool   userAborted = false;
            string value       = string.Empty;

            ///////////////////////////////////////////////////////
            // verificacar se é mascara de dinheiro
            if (expectedData.szMascaraDeCaptura == "R$@.@@@.@@@,@@")
            {
                FormCurrencyData window = new FormCurrencyData(expectedData);
                window.ShowDialog(ref userAborted, ref value);
            }
            else
            {
                ///////////////////////////////////////////////////////
                // se não é mascara de dinheiro
                // -->> FormTypedData
                FormTypedData window = new FormTypedData(expectedData);
                window.ShowDialog(ref userAborted, ref value);
            }

            if (userAborted)
            {
                return((int)E_PWRET.PWRET_CANCEL);
            }

            int ret = 99;

            ret = Interop.PW_iAddParam(expectedData.wIdentificador, value);

            Debug.Print(string.Format("CALLED iAddParam COM ÍNDICE {0}, VALOR {1} E RETORNO {2}", ((E_PWINFO)expectedData.wIdentificador).ToString(), value, ret.ToString()));

            return(ret);
        }
        // Obtém um dado digitado do usuário
        private int GetTypedDataFromUser(PW_GetData expectedData)
        {
            bool   userAborted = false;
            string value       = string.Empty;
            int    ret;

            // Exibe a janela para captura do dado digitado
            FormTypedData window = new FormTypedData(expectedData);

            window.ShowDialog(ref userAborted, ref value);
            window.Dispose();

            // Caso o usuário tenha abortado a transação, retorna E_PWRET.PWRET_CANCEL
            if (userAborted)
            {
                return((int)E_PWRET.PWRET_CANCEL);
            }

            // Adiciona o dado capturado
            ret = Interop.PW_iAddParam(expectedData.wIdentificador, value);

            // Registra na janela de debug o resultado da adição do parâmetro
            Debug.Print(string.Format("PW_iAddParam({0},{1})={2}", ((E_PWINFO)expectedData.wIdentificador).ToString(), value, ret.ToString()));

            return(ret);
        }