コード例 #1
0
ファイル: Principal.cs プロジェクト: 3dip0/Gerador_de_Recibos
        private void Principal_Load(object sender, EventArgs e)
        {
            using (Login Form = new Login())
            {
                Form.ShowDialog();
                // Aqui considerei que se o login for efetuado com sucesso, o DialogResult será OK

                if (Form.atv == true)
                {
                    if (UsuarioLogado.nivel == "1")
                    {
                        novoToolStripMenuItem.Visible      = false;
                        consultarToolStripMenuItem.Visible = false;
                    }
                    Comandos comandos = new Comandos();

                    this.WindowState = FormWindowState.Maximized;
                    this.Text        = "Controle de recibos - Usuário atual: " + UsuarioLogado.NomeUsuario;
                    this.Show();
                    return;
                }
                else
                {
                    Application.Exit();
                    return;
                }
            }
        }
コード例 #2
0
ファイル: Fixture.cs プロジェクト: ffafir91/RepoTestes
 public void SetUp()
 {
     driver             = Comandos.GetBrowserLocal(driver, ConfigurationManager.AppSettings["browser"]);
     wait               = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
     baseURL            = ConfigurationManager.AppSettings["url"];
     verificationErrors = new StringBuilder();
 }
コード例 #3
0
        public static string makeRequest(Comandos comando, int AulasPagasRestantes = 0)
        {
            string strResponseValue = string.Empty;

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(endereco + ((ModoDebug) ? "jsonSim/db" : comando.ToString()) + ((comando == Comandos.abrir) ? ("?command=" + AulasPagasRestantes) : String.Empty));

            request.Method = httpVerb.GET.ToString();
            try
            {
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                    if (response.StatusCode != HttpStatusCode.OK)
                    {
                        throw new ApplicationException("error code:" + response.StatusCode.ToString());
                    }
                    using (Stream responseStream = response.GetResponseStream())
                    {
                        if (responseStream != null)
                        {
                            using (StreamReader reader = new StreamReader(responseStream))
                            {
                                strResponseValue = reader.ReadToEnd();
                            }
                        }
                    }
                }
            }
            catch
            {
                strResponseValue = "falhou";
            }
            return(strResponseValue);
        }
コード例 #4
0
        public void gravar()
        {
            if (DBManager.conectado())
            {
                try
                {
                    string _sql = " INSERT INTO MODELO_ANO (CODIGO_ANO,CODIGO_MODELO,ANO, SINCRONIZAR) VALUES (@codigo_ano,@codigo_modelo,@ano,1) ";

                    cmd             = new SQLiteCommand();
                    cmd.Connection  = DBManager._mainConnection;
                    cmd.CommandText = _sql;

                    string ultCodigo = Comandos.busca_campo("SELECT MAX(CODIGO_ANO)+1 FROM MODELO_ANO");
                    if (ultCodigo.Length == 0)
                    {
                        ultCodigo = "1";
                    }

                    cmd.Parameters.Add(new SQLiteParameter("@codigo_ano", ultCodigo));
                    cmd.Parameters.Add(new SQLiteParameter("@codigo_modelo", this.codigo_modelo));
                    cmd.Parameters.Add(new SQLiteParameter("@ano", this.ano));

                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Logs.Log(ex.Message);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Ejecuta una consulta
        /// </summary>
        /// <param name="Consulta">Consulta a ejecutar</param>
        /// <returns></returns>
        public QueryResult Ejecutar(QueryBuilder Consulta)
        {
            QueryResult Ejecucion = Comandos.Ejecutar(Consulta);

            Ejecucion.Consulta = Consulta;
            return(Ejecucion);
        }
コード例 #6
0
        /// <summary>
        /// Constructor por defecto
        /// </summary>
        public ActivitiesManagerProvider()
        {
            this.ListaExcepciones = new List <Exception>();

            try
            {
                Byte Pasos = 0;
                // Inicializa una conexion:
                if (this.Conexion == null)
                {
                    this.Conexion = BasesDeDatos.Connect("ActivitiesManagerDataBase");
                    Pasos        += 1;
                }

                // Iniciliza una transaccion:
                if (this.Transaccion == null && this.Conexion != null)
                {
                    this.Transaccion = Conexion.BeginTransaction();
                    Pasos           += 2;
                }

                if (Pasos == 3)
                {
                    Comandos = new Comandos(Transaccion);
                }
            }
            catch (Exception ex)
            {
                ListaExcepciones.Add(ex);
                throw new Exception("No se logró establecer la conexión con la base de datos.", ex);
            }
        }
コード例 #7
0
        public void select()


        {
            using (var connection = new SQLiteConnection("Data Source=recibo"))
            {
                var command = connection.CreateCommand();

                try
                {
                    connection.Open();
                    Comandos comando = new Comandos();

                    command.CommandText = comando.selectSimples;
                    command.ExecuteNonQuery();
                    System.Data.DataTable dt        = new System.Data.DataTable();
                    string            selectCommand = string.Format(comando.selectSimples);
                    SQLiteDataAdapter adapter       = new SQLiteDataAdapter(command.CommandText, connection);
                    dt = new System.Data.DataTable("recibo");
                    //Preenche a DataTable com os dados do adaptar
                    adapter.Fill(dt);
                    lista.DataSource = dt;
                    lista.Columns["valor_atual"].DefaultCellStyle.Format     = "c2";
                    lista.Columns["Mes_referencia"].DefaultCellStyle.Format  = "00/0000";
                    lista.Columns["Data_Vencimento"].DefaultCellStyle.Format = "00/0000";
                }
                finally
                {
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                }
            }
        }
コード例 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            Comandos comandos = new Comandos();

            try
            {
                string          local     = "bd/Administradores.accdb";
                string          Stringcon = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + local + ";Persist Security Info=False;";
                OleDbConnection conn      = new OleDbConnection(Stringcon);
                conn.Open();
                comandos.conectado = true;
                comandos.Logar(tbLogin.Text, tbSenha.Text, conn);
                conn.Close();
                while (comandos.logado == true)
                {
                    Admin adm = new Admin(this); adm.Show(); this.Hide(); if (adm.Visible == false)
                    {
                        this.Show();
                    }
                    break;
                }
            }
            catch (Exception erro)
            {
                comandos.conectado = false;
                MessageBox.Show(erro.Message);
            }
        }
コード例 #9
0
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Comandos.Clear();
                var items = await App.Database.GetItemsAsync();

                foreach (var item in items)
                {
                    Comandos.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,NomeComponente,Ligado,Desligado,Status,Status_Enum")] Comandos comandos)
        {
            if (id != comandos.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comandos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComandosExists(comandos.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(comandos));
        }
コード例 #11
0
 public void SetUp()
 {
     driver = Comandos.GetBrowserRemote(driver, "chrome", "http://192.168.0.106:5556/wd/hub");
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
     wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
     js   = (IJavaScriptExecutor)driver;
     vars = new Dictionary <string, object>();
 }
コード例 #12
0
 public void SelecionarDeLaLista(Comandos c)
 {
     txtAccion.Text            = c.Accion;
     txtComando.Text           = c.Comando;
     txtRespuesta.Text         = c.Respuesta;
     txtId.Text                = c.Id.ToString();
     txtRespuestaPregunta.Text = c.RespuestaPregunta;
 }
コード例 #13
0
 public void SetUp()
 {
     driver = Comandos.GetBrowserLocal(driver, "chrome");
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
     wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
     js   = (IJavaScriptExecutor)driver;
     vars = new Dictionary <string, object>();
 }
コード例 #14
0
        public void Seed()
        {
            if (
                _context.Comandos.Any()
                ||
                _context.SensorTemperaturaUmidade.Any()
                )
            {
                return; //DB has been seeded.
            }


            Comandos com1 = new Comandos
            {
                Id             = 1,
                NomeComponente = "LED Branco",
                Ligado         = 1,
                Desligado      = 2,
                Status         = 2
            };

            Comandos com2 = new Comandos
            {
                Id             = 2,
                NomeComponente = "LED Amarelo",
                Ligado         = 3,
                Desligado      = 4,
                Status         = 4
            };

            Comandos com3 = new Comandos
            {
                Id             = 3,
                NomeComponente = "LED Vermelho",
                Ligado         = 5,
                Desligado      = 6,
                Status         = 6
            };

            Comandos com4 = new Comandos
            {
                Id             = 4,
                NomeComponente = "Ventoinha",
                Ligado         = 7,
                Desligado      = 8,
                Status         = 8
            };

            Configuracoes conf = new Configuracoes()
            {
                Id = 1,
                temperaturaIniciar = 25,
                umidadeIniciar     = 10
            };

            _context.AddRange(com1, com2, com3, com4, conf);
            _context.SaveChanges();
        }
コード例 #15
0
        private void UdpService_Invertido()
        {
            Comandos.Clear();

            foreach (var item in UdpService.Responses)
            {
                Comandos.Add(item);
            }
        }
 public void SetupTest()
 {
     //aqui passamos a chamada do navegador onde se fro GetBrowserLocal, nao precisamos informar a URi"http://10.0.75.1:5555/wd/hub"
     //driver = Comandos.GetBrowserRemote(driver, ConfigurationManager.AppSettings["browser"], "http://10.0.75.1:5555/wd/hub");
     //aqui um exemplo usando a chamada Local
     driver             = Comandos.GetBrowserLocal(driver, ConfigurationManager.AppSettings["browser"]);
     baseURL            = "https://livros.inoveteste.com.br/";
     verificationErrors = new StringBuilder();
 }
コード例 #17
0
 public MessageSender AddCommand(string command)
 {
     _command = command;
     Code     = Comandos.GetCode(command);
     if (_command == Comandos.Add)
     {
         AddDeviceInfo(_dispositivo.Imei, _dispositivo.TipoDispositivo.Fabricante);
     }
     return(this);
 }
コード例 #18
0
        public static Comandos InsertarComando(Comandos cm)
        {
            MySqlConnection con = Conexion.ObtenerConecction();
            MySqlCommand    cmd = new MySqlCommand(string.Format("INSERT INTO Comandos(comandos, accion, respuesta, respuestaPregunta) " +
                                                                 "Values ('{0}', '{1}', '{2}', '{3}');", cm.Comando, cm.Accion, cm.Respuesta, cm.RespuestaPregunta), con);

            cmd.ExecuteNonQuery();
            con.Close();
            return(cm);
        }
コード例 #19
0
        public string BuildMessage(Comandos command, List <string> data)
        {
            string datas = string.Join("|", data);
            string cmd   = ((int)command).ToString();

            datas = NormaliseString(datas);
            int length = Header.Length + 5 + cmd.Length + datas.Length + 4 + 1;

            return(Header + length.ToString().PadLeft(5, '0') + cmd + datas + Checksum(Header + length.ToString().PadLeft(5, '0') + cmd + datas) + "@");
        }
コード例 #20
0
        private void btnEnviar_Click(object sender, EventArgs e)
        {
            Comandos cd = new Comandos();
            string   at = txtAtv.Text;
            decimal  g  = decimal.Parse(txtGn.Text);
            decimal  l  = decimal.Parse(txtLoss.Text);
            DateTime dt = DateTime.Parse(txtDt.Text);

            cd = new  Comandos(at, g, dt, l);
            MessageBox.Show(cd.msg);
        }
コード例 #21
0
 public void SetupTest()
 {
     //aqui passamos a chamada do navegador onde se for GetBrowserLocal, nao precisamos informar a URi"http://10.0.75.1:5555/wd/hub"
     //driver = Comandos.GetBrowserRemote(driver, ConfigurationManager.AppSettings["browser"], "http://10.0.75.1:5555/wd/hub");
     //aqui um exemplo usando a chamada Local
     driver             = Comandos.GetBrowserLocal(driver, ConfigurationManager.AppSettings["browser"]);
     baseURL            = "https://livros.inoveteste.com.br/";
     wait               = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
     verificationErrors = new StringBuilder();
     ct01               = new CT01ValidarLayoutTela();
 }
コード例 #22
0
        public static Comandos UpdateComando(Comandos comandos)
        {
            MySqlConnection con = Conexion.ObtenerConecction();
            MySqlCommand    cmd = new MySqlCommand(string.Format("UPDATE comandos set comandos = '" + comandos.Comando + "', accion = '"
                                                                 + comandos.Accion + "', respuesta = '" + comandos.Respuesta + "', respuestaPregunta = '"
                                                                 + comandos.RespuestaPregunta + "' WHERE idComandos = '" + comandos.Id + "'"), con);

            cmd.ExecuteNonQuery();
            con.Close();
            return(comandos);
        }
コード例 #23
0
        public async Task <IActionResult> Create([Bind("Id,NomeComponente,Ligado,Desligado,Status,Status_Enum")] Comandos comandos)
        {
            if (ModelState.IsValid)
            {
                _context.Add(comandos);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(comandos));
        }
コード例 #24
0
 public void SetupTest()
 {
     //aqui passamos a chamada do navegador onde se for GetBrowserLocal, nao precisamos informar a URi"http://10.0.75.1:5555/wd/hub"
     //driver = Comandos.GetBrowserRemote(driver, ConfigurationManager.AppSettings["browser"], "http://10.0.75.1:5555/wd/hub");
     //aqui um exemplo usando a chamada Local
     driver = Comandos.GetBrowserLocal(driver, ConfigurationManager.AppSettings["browser"]);
     //espera implicita, aloca o tempo definido apra todas as ações do projeto
     //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
     //espera Explicita, ira esperar por um elemento em especifico o tempo determinado.
     //para isso ai precisa ser declarada a variavel e depois chamado o metodo
     wait               = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
     baseURL            = "https://livros.inoveteste.com.br/";
     verificationErrors = new StringBuilder();
 }
コード例 #25
0
ファイル: Login.cs プロジェクト: 3dip0/Gerador_de_Recibos
        public void logar()
        {
            using (var connection = new SQLiteConnection("Data Source=recibo"))
            {
                var      command  = connection.CreateCommand();
                Comandos comandos = new Comandos();

                SQLiteCommand query = new SQLiteCommand("select count(*)" + $"from usuario where usuario = '{usuario.Text}' and senha = '{senha.Text}' and nivel >=0", connection);

                SQLiteCommand query2 = new SQLiteCommand("select *" + $"from usuario where usuario = '{usuario.Text}' and senha = '{senha.Text}' and nivel >=0", connection);
                UsuarioLogado.NomeUsuario = usuario.Text;
                connection.Open();
                DataTable         dataTable  = new DataTable();
                SQLiteDataAdapter da         = new SQLiteDataAdapter(query);
                DataTable         dataTable2 = new DataTable();
                SQLiteDataAdapter da2        = new SQLiteDataAdapter(query2);
                da.Fill(dataTable);
                da2.Fill(dataTable2);
                Principal principal = new Principal();

                foreach (DataRow list in dataTable.Rows)
                {
                    if (Convert.ToInt64(list.ItemArray[0]) > 0)
                    {
                        UsuarioLogado.nivel = dataTable2.Rows[0]["nivel"].ToString();
                        if (UsuarioLogado.nivel == "0")
                        {
                            principal.nivel = dataTable2.Rows[0]["nivel"].ToString();
                            atv             = true;
                            connection.Close();
                            this.Close();
                        }
                        else
                        {
                            principal.novoToolStripMenuItem.Visible = false;
                            principal.nivel = dataTable2.Rows[0]["nivel"].ToString();
                            atv             = true;
                            connection.Close();
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Usuário Inválido", "Validação", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        atv = false;
                    }
                }
            }
        }
コード例 #26
0
        /// <summary>
        /// Função para validar busca de Valores de Campo
        /// </summary>
        /// <param name="txtCampo"> TextBox do Código</param>
        /// <param name="txtDescricao"> TextBox da Descricao</param>
        /// <param name="_sql">query a buscar</param>
        /// <param name="msg"> Mensagem de retorno negativo</param>
        public static void validarCampoExiste(TextBox txtCampo, TextBox txtDescricao, string _sql, string msg)
        {
            if (txtCampo.Text.Length > 0)
            {
                txtDescricao.Text = Comandos.busca_campo(_sql);

                if (txtDescricao.Text.Length == 0)
                {
                    txtCampo.Clear();
                    Mensagens.Informacao(msg);
                    txtCampo.Focus();
                    return;
                }
            }
        }
コード例 #27
0
        public void update()

        {
            int    ano = DateTime.Now.Year;  // Ano
            int    mes = DateTime.Now.Month; // Mês
            string a   = ano.ToString();
            string m   = mes.ToString();

            int mesAnt = mes - 1;

            if (mesAnt == 0)
            {
                mesAnt = 12;
            }
            string ma      = mesAnt.ToString();
            string data    = m + "/" + a;
            string dataAnt = mesAnt + "/" + a;

            using (var connection = new SQLiteConnection("Data Source=recibo"))
            {
                var command = connection.CreateCommand();

                try
                {
                    connection.Open();
                    Comandos comando = new Comandos();

                    command.CommandText = comando.selectSimples;
                    command.ExecuteNonQuery();
                    System.Data.DataTable dt        = new System.Data.DataTable();
                    string            selectCommand = string.Format(comando.selectSimples);
                    SQLiteDataAdapter adapter       = new SQLiteDataAdapter($"UPDATE cliente SET Mes_referencia = '{dataAnt}', Data_Vencimento = '{data}'", connection);
                    dt = new System.Data.DataTable("recibo");
                    //Preenche a DataTable com os dados do adaptar
                    adapter.Fill(dt);
                    adapter.Fill(dt);
                    lista.DataSource = dt;
                }
                finally
                {
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                }
            }
        }
コード例 #28
0
ファイル: Recibo.cs プロジェクト: 3dip0/Gerador_de_Recibos
        public Recibo(string teste)
        {
            InitializeComponent();


            Cliente cliente = new Cliente();

            using (var connection = new SQLiteConnection("Data Source=recibo"))
            {
                try
                {
                    Comandos comandos = new Comandos();

                    connection.Open();
                    SQLiteCommand     cmd;
                    SQLiteDataAdapter da;
                    string            inserir = "SELECT * FROM cliente where ";

                    cmd = new SQLiteCommand(inserir + teste, connection);
                    da  = new SQLiteDataAdapter(cmd);
                    da.Fill(cliente, cliente.Tables[0].TableName);


                    DataTable dt = new DataTable();

                    ReportDataSource rds = new ReportDataSource("Clientes", cliente.Tables[0]);

                    this.reportViewer1.LocalReport.DataSources.Clear();
                    this.reportViewer1.LocalReport.DataSources.Add(rds);
                    this.reportViewer1.LocalReport.Refresh();
                    this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                    var setup = reportViewer1.GetPageSettings();
                    setup.Margins = new System.Drawing.Printing.Margins(2, 2, 2, 2);
                    reportViewer1.SetPageSettings(setup);
                }
                catch (Exception erro)
                {
                    MessageBox.Show(erro.Message);
                }
                finally
                {
                    connection.Close();
                }
                this.reportViewer1.RefreshReport();
            }
        }
コード例 #29
0
        public void resetar()
        {
            if (DBManager.conectado())
            {
                try
                {
                    //// preciso saber o codigo do ano
                    string codigo_ano = Comandos.busca_campo("select codigo_ano from modelo_ano where codigo_modelo = " + codigo_modelo + " and ano = " + ano);
                    //Comandos.busca_campo("delete from modelo_ano where codigo_modelo = " + codigo_modelo + " and ano = " + ano);

                    string _sql = " INSERT INTO MODELO_ANO (CODIGO_ANO,CODIGO_MODELO,ANO, SINCRONIZAR) VALUES (@codigo_ano,@codigo_modelo,@ano,1) ";

                    cmd             = new SQLiteCommand();
                    cmd.Connection  = DBManager._mainConnection;
                    cmd.CommandText = _sql;

                    string ultCodigo = Comandos.busca_campo("SELECT MAX(CODIGO_ANO)+1 FROM MODELO_ANO");
                    if (ultCodigo.Length == 0)
                    {
                        ultCodigo = "1";
                    }

                    cmd.Parameters.Add(new SQLiteParameter("@codigo_ano", ultCodigo));
                    cmd.Parameters.Add(new SQLiteParameter("@codigo_modelo", this.codigo_modelo));
                    cmd.Parameters.Add(new SQLiteParameter("@ano", this.ano));

                    cmd.ExecuteNonQuery();

                    //if (codigo_ano.Length > 0)
                    //{
                    //    int existeDesenho = Convert.ToInt32(Comandos.busca_campo("select count(*) as qtd from desenhos where veiculo = " + codigo_ano, DBManager._modelDbname));

                    //    if (existeDesenho > 0)
                    //    {
                    //        Comandos.busca_campo("update desenhos set veiculo = " + ultCodigo + " where veiculo = " + codigo_ano, DBManager._modelDbname);
                    //    }
                    //}
                }
                catch (Exception ex)
                {
                    Logs.Log(ex.Message);
                }
            }
        }
コード例 #30
0
 public void InsertarComando()
 {
     try
     {
         Comandos   cm   = new Comandos();
         Respuestas resp = new Respuestas();
         if (count == 1)
         {
             cm.Accion            = txtAccion.Text;
             cm.Comando           = txtComando.Text;
             cm.Respuesta         = txtRespuesta.Text;
             cm.RespuestaPregunta = txtRespuestaPregunta.Text;
             Negocio.CNegocio.Instancia.InsertarComando(cm);
             resp.Respuesta = txtRespuestaPregunta.Text;
             Negocio.CNegocio.Instancia.InsertarRespuestas(resp);
             if (txtRespuestaPregunta.Text == "")
             {
                 MessageBox.Show("Comando Insertado");
             }
             else
             {
                 MessageBox.Show("Comando y Respuesta Insertados");
             }
         }
         else
         {
             cm.Accion            = txtAccion.Text;
             cm.Comando           = txtComando.Text;
             cm.Respuesta         = txtRespuesta.Text;
             cm.Id                = Int32.Parse(txtId.Text);
             cm.RespuestaPregunta = txtRespuestaPregunta.Text;
             Negocio.CNegocio.Instancia.UpdateComando(cm);
             resp.Respuesta  = txtRespuestaPregunta.Text;
             resp.IdComandos = Int32.Parse(txtId.Text);
             Negocio.CNegocio.Instancia.UpdateRespuestas(resp);
             MessageBox.Show("Comando Actualizado");
         }
     }
     catch (Exception exe)
     {
         MessageBox.Show("Error Metodo InsertarComando: ->" + exe.Message);
     }
 }
コード例 #31
0
ファイル: AntenaTracker.cs プロジェクト: rajeper/ikarus-osd
 public USBXpress.ReturnCodes Write(Comandos cmd, int id, int offset, byte[] buff)
 {
     return Write((int)cmd, id, offset, buff);
 }
コード例 #32
0
ファイル: FlightPlanUSB.cs プロジェクト: rajeper/ikarus-osd
 public byte[] Read(Comandos cmd, byte id, int offset, int len)
 {
     return Read((int)cmd, id, offset, len);
 }
コード例 #33
0
ファイル: FlightPlanUSB.cs プロジェクト: rajeper/ikarus-osd
 public void Write(Comandos cmd, int id, int offset, byte[] buff)
 {
     Write((int)cmd, id, offset, buff);
 }
コード例 #34
0
ファイル: MainForm.cs プロジェクト: tiemikn/ES770
        private bool Send( Comandos Cmd, ulong Address, int offset, byte[] Dados )
        {
            if( this.UsbStatus == false )
                return false;

            Buffer = 0xFF;

            HidWriteBuff[1] = STX;
            HidWriteBuff[2] = (byte)Cmd;
            HidWriteBuff[3] = (byte)( Address >> 8 );
            HidWriteBuff[4] = (byte)( Address & 0xFF );

            if(Dados != null )
            {
                for (int i = 5; i < (5+Dados.Length); i++)
                {
                    HidWriteBuff[i+offset] = Dados[i-5];
                }
            }

            try
            {
                PortaUSB.SpecifiedDevice.SendData( HidWriteBuff );
            }
            catch
            {
                MessageBox.Show( "Houve uma falha ao enviar os dados" );
                return false;
            }

            Buffer = 0xFF;
            return true;
        }
コード例 #35
0
ファイル: cliente.cs プロジェクト: kill4n/Kuro_ACM
 public clientEventArgs(string ms, Comandos cmd)
 {
     mensaje = ms;
     comand = cmd;
 }
コード例 #36
0
ファイル: Message.cs プロジェクト: kill4n/Kuro_ACM
 public Message(Comandos comando)
 {
     CMD = comando;
     Msg = new List<byte>();
 }