public void Move(Plataforma newDest)
 {
     if (!waiting)
     {
         path.Enqueue(newDest);
         Plataforma destino = path.Dequeue();
         if (startPlatform.isReachable(destino))
         {
             if (destino.entity == null)
             {
                 attackPlatform = path.Peek();
                 mAnimator.SetBool("walk", true);
                 agent.SetDestination(destino.transform.position + offset);
                 startPlatform.entity = null;
                 startPlatform        = destino;
                 startPlatform.entity = this.gameObject;
                 destino.moved();
             }
         }
         else
         {
             Debug.Log("no reachable");
             path    = new Queue <Plataforma>();
             waiting = true;
         }
     }
 }
예제 #2
0
        private void ArmarParametrosPlataformaEliminar(ref SqlCommand Comando, Plataforma cat)
        {
            SqlParameter SqlParametros = new SqlParameter();

            SqlParametros       = Comando.Parameters.Add("@Cod_Plataforma_P", SqlDbType.Char, 4);
            SqlParametros.Value = cat.getCodigoPlataforma();
        }
예제 #3
0
        public bool MantenerPlataforma(Plataforma plataforma)
        {
            PlataformaDa plataformaDa = new PlataformaDa();
            bool         respuesta    = false;

            try
            {
                cn.Open();
                respuesta = plataformaDa.MantenerPlataforma(plataforma, cn);
                cn.Close();
            }
            catch (Exception ex)
            {
                respuesta = false;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
            }

            return(respuesta);
        }
예제 #4
0
    // Start is called before the first frame update
    void Start()
    {
        instancia = this;

        puntaje = 0;

        Vector3 posicionSpawn = puntoInicio.position;
        int     plataformasSinObstaculosTmp = plataformasSinObstaculos;

        for (int i = 0; i < preSpawnDePlataformas; i++)
        {
            posicionSpawn -= tilePrefab.puntoInicio.localPosition;
            Plataforma plataformaSpawneada = Instantiate(tilePrefab, posicionSpawn, Quaternion.identity) as Plataforma;
            if (plataformasSinObstaculosTmp > 0)
            {
                plataformaSpawneada.DesactivarObstaculos();
                plataformasSinObstaculosTmp--;
            }
            else
            {
                plataformaSpawneada.ActivarObstaculos();
            }

            posicionSpawn = plataformaSpawneada.puntoFinal.position;
            posicionSpawn = plataformaSpawneada.puntoFinal.position;
            posicionSpawn = plataformaSpawneada.puntoFinal.position;
            plataformaSpawneada.transform.SetParent(transform);
            plataformasSpawneadas.Add(plataformaSpawneada);
        }
    }
        public SuperCanion(TGCVector3 posicion, GameLogic logica, Plataforma plataforma)
        {
            base.Init(logica, plataforma);

            #region configurarObjeto
            float factorEscalado = 20.0f;
            canion1          = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\CANIONERO-TgcScene.xml").Meshes[0];
            canion1.Scale    = new TGCVector3(factorEscalado, factorEscalado, factorEscalado);
            canion1.Position = new TGCVector3(posicion.X - 21, posicion.Y + 40, posicion.Z + 15);
            canion1.RotateX(14);
            canion1.RotateY(18);
            canion1.Effect    = efecto;
            canion1.Technique = "RenderScene";

            canion2          = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\CANIONERO-TgcScene.xml").Meshes[0];
            canion2.Scale    = new TGCVector3(factorEscalado, factorEscalado, factorEscalado);
            canion2.Position = new TGCVector3(posicion.X + 21, posicion.Y + 40, posicion.Z + 15);
            canion2.RotateX(-14);
            canion2.RotateY(48);
            canion2.Effect    = efecto;
            canion2.Technique = "RenderScene";


            tallo          = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\SuperCanion-TgcScene.xml").Meshes[0];
            tallo.Scale    = new TGCVector3(factorEscalado * 0.75f, factorEscalado * 0.75f, factorEscalado * 0.75f);
            tallo.Position = new TGCVector3(posicion.X, posicion.Y - 50, posicion.Z);
            tallo.RotateY(4);
            tallo.Effect    = efecto;
            tallo.Technique = "RenderScene";

            #endregion

            PostProcess.agregarPostProcessObject(this);
        }
예제 #6
0
        public List <Plataforma> GetDesarrolladres()
        {
            string query = "select * from Desarrolladores";


            conexion = new SqlConnection(UsuarioDS);
            comando  = new SqlCommand(query, conexion);
            List <Plataforma> lista = new List <Plataforma>();

            try
            {
                conexion.Open();
                lector = comando.ExecuteReader();

                while (lector.Read())
                {
                    Plataforma aux = new Plataforma();
                    aux.ID     = lector.GetInt32(0);
                    aux.Nombre = lector.GetString(1);
                    lista.Add(aux);
                }

                conexion.Close();
                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
        public IList <Jogo> GetJogoByPlataforma(Plataforma plataforma)
        {
            IList <Jogo> lista = this.GetAll().Where(jogo => jogo.Plataforma == plataforma)
                                 .ToList();

            return(lista);
        }
예제 #8
0
        public int eliminarPlataforma(Plataforma cat)
        {
            SqlCommand comando = new SqlCommand();

            ArmarParametrosPlataformaEliminar(ref comando, cat);
            return(ds.EjecutarProcedimientoAlmacenado(comando, "spEliminarPlataforma"));
        }
예제 #9
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,NomePlataforma,DescricaoPlataforma")] Plataforma plataforma)
        {
            if (id != plataforma.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(plataforma);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlataformaExists(plataforma.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(plataforma));
        }
예제 #10
0
        public HttpResponseMessage ConsultarPorId(int id)
        {
            try
            {
                PlataformaRepository rep = new PlataformaRepository();
                Plataforma           p   = rep.FindById(id);

                if (p != null)
                {
                    PlataformaConsultaViewModel model = new PlataformaConsultaViewModel();

                    model.IdPlataforma = p.IdPlataforma;
                    model.Nome         = p.Nome;
                    model.Modelo       = p.Modelo;

                    return(Request.CreateResponse(HttpStatusCode.OK, model));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "Plataforma não localizada."));
                }
            }
            catch (Exception e)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Erro de servidor: " + e.Message));
            }
        }
예제 #11
0
        public async Task Agregar(Plataforma Plataforma)
        {
            Plataforma.AgregadoEn = DateTime.Now;
            await _context.Plataformas.AddAsync(Plataforma);

            await _context.SaveChangesAsync();
        }
 // Use this for initialization
 void Start()
 {
     newPosition  = iniPosition = plat.transform.position;
     destPosition = transform.position + displacement;
     currentState = 0;
     plat         = GetComponent <Plataforma>();
 }
        //-------------------//

        public void AtualizarPlataforma(Plataforma plataforma)
        {
            Plataforma PlataformaB = ctx.Plataforma.FirstOrDefault(x => x.IdPlataforma == plataforma.IdPlataforma);
            PlataformaB.Plataforma1 = plataforma.Plataforma1;
            ctx.Plataforma.Update(PlataformaB);
            ctx.SaveChanges();
        }
예제 #14
0
        public HttpResponseMessage Atualizar(PlataformaEdicaoViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Plataforma p = new Plataforma();
                    p.IdPlataforma = model.IdPlataforma;
                    p.Nome         = model.Nome;
                    p.Modelo       = model.Modelo;

                    PlataformaRepository rep = new PlataformaRepository();
                    rep.Update(p);

                    return(Request.CreateResponse(HttpStatusCode.OK, "Plataforma atualizada com sucesso."));
                }
                catch (Exception e)
                {
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Erro de servidor: " + e.Message));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Ocorreu um ou mais erros de validação nos campos enviados."));
            }
        }
예제 #15
0
 // Use this for initialization
 void Start()
 {
     audioSource = GetComponent <AudioSource>();
     startPlatform.calculaReachables();
     transform.position = startPlatform.transform.position + offset;
     if (attackdir == 1)
     {
         attackPlatform = startPlatform.topPlat;
         transform.LookAt(startPlatform.transform.position + Vector3.left);
     }
     if (attackdir == 2)
     {
         attackPlatform = startPlatform.rightPlat;
         transform.LookAt(startPlatform.transform.position + Vector3.forward);
     }
     if (attackdir == 3)
     {
         attackPlatform = startPlatform.bottomPlat;
         transform.LookAt(startPlatform.transform.position + Vector3.right);
     }
     if (attackdir == 4)
     {
         attackPlatform = startPlatform.leftPlat;
         transform.LookAt(startPlatform.transform.position + Vector3.back);
     }
     //transform.LookAt(attackPlatform.transform);
     startPlatform.entity = this.gameObject;
     mAnimator            = GetComponent <Animator>();
     agent = GetComponent <NavMeshAgent>();
     aura  = transform.Find("auraEnemy").gameObject;
     aura.SetActive(false);
 }
예제 #16
0
        public int AltaPlataforma(Plataforma p)
        {
            SqlCommand comando = new SqlCommand();

            ArmarParametrosPlataformas(ref comando, p);
            return(ds.EjecutarProcedimientoAlmacenado(comando, "spAltaPlataforma"));
        }
예제 #17
0
        public Plataforma ObtenerPlataforma(int plataformaId)
        {
            PlataformaDa plataformaDa = new PlataformaDa();
            Plataforma   respuesta    = null;

            try
            {
                cn.Open();
                respuesta = plataformaDa.ObtenerPlataforma(plataformaId, cn);
                cn.Close();
            }
            catch (Exception ex)
            {
                respuesta = null;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
            }

            return(respuesta);
        }
        public List <Plataforma> Plataformas()
        {
            List <Plataforma> plataformas = new List <Plataforma>();

            foreach (TgcMesh plataformaMesh in PlataformasMesh())
            {
                Plataforma plataforma;

                if (plataformaMesh.Name == "PlataformaY")
                {
                    plataforma = new PlataformaY(plataformaMesh, this);
                }
                else if (plataformaMesh.Name == "PlataformaX")
                {
                    plataforma = new PlataformaX(plataformaMesh, this);
                }
                else if (plataformaMesh.Name == "PlataformaZ")
                {
                    plataforma = new PlataformaZ(plataformaMesh, this);
                }
                else if (plataformaMesh.Name == "PlataformaRotante")
                {
                    coeficienteRotacion *= -1;
                    plataforma           = new PlataformaRotante(plataformaMesh, this, coeficienteRotacion);
                }
                else
                {
                    plataforma = new Plataforma(plataformaMesh, this);
                }

                plataformas.Add(plataforma);
            }

            return(plataformas);
        }
예제 #19
0
 public void calculaReachables()
 {
     topPlat    = null;
     leftPlat   = null;
     rightPlat  = null;
     bottomPlat = null;
     Plataforma[] allPlats = (Plataforma[])GameObject.FindObjectsOfType(typeof(Plataforma));
     for (int i = 0; i < allPlats.Length; ++i)
     {
         if (transform.position.x == allPlats[i].transform.position.x && transform.position.z == allPlats[i].transform.position.z + 5 && transform.position.y == allPlats[i].transform.position.y)
         {
             leftPlat = allPlats[i];
         }
         else if (transform.position.x == allPlats[i].transform.position.x && transform.position.z == allPlats[i].transform.position.z - 5 && transform.position.y == allPlats[i].transform.position.y)
         {
             rightPlat = allPlats[i];
         }
         if (transform.position.x == allPlats[i].transform.position.x + 5 && transform.position.z == allPlats[i].transform.position.z && transform.position.y == allPlats[i].transform.position.y)
         {
             topPlat = allPlats[i];
         }
         else if (transform.position.x == allPlats[i].transform.position.x - 5 && transform.position.z == allPlats[i].transform.position.z && transform.position.y == allPlats[i].transform.position.y)
         {
             bottomPlat = allPlats[i];
         }
     }
 }
예제 #20
0
        public static List <Datos.Plataforma> listaPlataformas()
        {
            List <Datos.Plataforma> lista            = new List <Plataforma>();
            List <object[]>         lista_codificada = null;

            lista_codificada = verPlataforma();
            if (lista_codificada != null)
            {
                try
                {
                    foreach (var row in lista_codificada)
                    {
                        Datos.Plataforma plataforma = new Plataforma
                        {
                            Id_plataforma = int.Parse(row[0].ToString()),
                            Titulo        = (string)row[1],
                            Descripcion   = (string)row[2]
                        };
                        lista.Add(plataforma);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error: " + ex.Message);
                }
            }


            return(lista);
        }
예제 #21
0
        public Plataforma ObtenerPlataformaPorIdentificador(string identificador)
        {
            PlataformaDa plataformaDa = new PlataformaDa();
            Plataforma   respuesta    = null;

            try
            {
                cn.Open();
                respuesta = plataformaDa.ObtenerPlataformaPorIdentificador(identificador, cn);
                cn.Close();
            }
            catch (Exception ex)
            {
                respuesta = null;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
            }

            return(respuesta);
        }
예제 #22
0
        public async Task <IActionResult> Edit(int id, [Bind("idPlataforma,descripcion,numeroMaximoUsuarios,precio,idEstado")] Plataforma plataforma)
        {
            if (id != plataforma.idPlataforma)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(plataforma);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlataformaExists(plataforma.idPlataforma))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(plataforma));
        }
예제 #23
0
    public void GenerarPlataformas()
    {
        Plataforma aux1, aux2 = null;

        switch (Random.Range(0, 5))
        {
        case 0:
            aux1 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[0], Quaternion.identity);
            aux1.CambiarSprite(FormaPlataforma.abiertaPorLaIzquierda);
            break;

        case 1:
            aux1 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[1], Quaternion.identity);
            aux1.CambiarSprite(FormaPlataforma.cerradaPorAmbosLados);
            break;

        case 2:
            aux1 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[2], Quaternion.identity);
            aux1.CambiarSprite(FormaPlataforma.abiertaPorLaDerecha);
            break;

        case 3:
            aux1 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[0], Quaternion.identity);
            aux2 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[1], Quaternion.identity);
            aux1.CambiarSprite(FormaPlataforma.abiertaPorAmbosLados);
            aux2.CambiarSprite(FormaPlataforma.abiertaPorLaIzquierda);
            break;

        case 4:
            aux1 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[0], Quaternion.identity);
            aux2 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[2], Quaternion.identity);
            aux1.CambiarSprite(FormaPlataforma.abiertaPorLaIzquierda);
            aux2.CambiarSprite(FormaPlataforma.abiertaPorLaDerecha);
            break;

        default:
            aux1 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[1], Quaternion.identity);
            aux2 = Instantiate(Random.Range(0f, 1f) < probabilidadNube ? nube : suelo, posiciones[2], Quaternion.identity);
            aux1.CambiarSprite(FormaPlataforma.abiertaPorLaDerecha);
            aux2.CambiarSprite(FormaPlataforma.abiertaPorAmbosLados);
            break;
        }
        todasLasPlataformas.Add(aux1);

        if (aux2 != null)
        {
            todasLasPlataformas.Add(aux2);
        }
        tiempo = tiempoMinimo + (tiempoDeCreacionInicial - tiempoMinimo) * Mathf.Exp(Mathf.Log(1f - porcentajeHastaAlcanzarElNumeroDeInvoaciones) / numeroDeInvocacionesHastaAlcanzarElPorcentaje * numeroInvocaciones);
        float velocidad = distanciaEntrePlataformas / tiempo;

        foreach (Plataforma item in todasLasPlataformas)
        {
            item.cambiarVelocidad(velocidad);
        }

        Invoke("GenerarPlataformas", tiempo);
        numeroInvocaciones++;
    }
예제 #24
0
 void Awake()
 {
     if (!inicializado)
     {
         plataforma_estatica = plataforma;
         inicializado        = true;
     }
 }
    void Start()
    {
        plat    = GetComponent <Plataforma>();
        ocupada = ocupadaPreviament = false;
        Renderer rend = GetComponent <Renderer>();

        rend.material.SetColor("_Color", Color.blue);
    }
예제 #26
0
 // Use this for initialization
 void Start()
 {
     rb2D              = GetComponent <Rigidbody2D>();
     plataforma        = FindObjectOfType <Plataforma>();
     audioSource       = GetComponent <AudioSource>();
     plataformaBolaDis = transform.position -
                         plataforma.transform.position;
 }
예제 #27
0
        public ActionResult DeleteConfirmed(int id)
        {
            Plataforma plataforma = db.Plataformas.Find(id);

            db.Plataformas.Remove(plataforma);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void Cadastrar(Plataforma plataforma)
 {
     using (OpFlixContext ctx = new OpFlixContext())
     {
         ctx.Plataforma.Add(plataforma);
         ctx.SaveChanges();
     }
 }
예제 #29
0
        private void ArmarParametrosPlataformas(ref SqlCommand Comando, Plataforma p)
        {
            SqlParameter SqlParametros = new SqlParameter();

            SqlParametros       = Comando.Parameters.Add("@Cod_Plataforma_p", SqlDbType.Char, 4);
            SqlParametros.Value = p.getCodigoPlataforma();
            SqlParametros       = Comando.Parameters.Add("@Nombre_Plataforma_p", SqlDbType.NVarChar, 60);
            SqlParametros.Value = p.getNombrePlataforma();
        }
 // Use this for initialization
 void Start()
 {
     agent                  = GetComponent <NavMeshAgent>();
     playerAnimator         = GetComponent <Animator>();
     audioSource            = GetComponent <AudioSource>();
     currentPlatform        = startPlatform;
     transform.position     = startPlatform.transform.position + offset;
     currentPlatform.entity = gameObject;
 }
        public SeleccionJuegosController( Plataforma plataforma )
        {
            this.PlataformaSeleccionada = plataforma;
            this.PlataformaSeleccionada.FinalizoPrograma += PlataformaSeleccionada_FinalizoPrograma;
            this.PlataformaSeleccionada.CargarListaDeJuegos();
            this.juegos = this.PlataformaSeleccionada.Juegos;

            this.IndiceJuegoSeleccionado = this.juegos.FindIndex( x => x.NombreArchivo.Equals( this.PlataformaSeleccionada.UltimoJuegoEjecutado, StringComparison.InvariantCultureIgnoreCase ) );
            if( this.IndiceJuegoSeleccionado == -1 )
                this.IndiceJuegoSeleccionado = 0;

            this.IniciarControladores( Contexto.Instancia.Controladores );
        }
예제 #32
0
        public SeleccionJuegos( Plataforma plataforma )
        {
            InitializeComponent();
            this.CrearFormController( plataforma );

            this.ImagenPlataforma.ImageLocation = Path.Combine( Contexto.Instancia.RutaAplicacion, this.controller.PlataformaSeleccionada.RutaImagen );

            this.InicializarCaracteres();
            this.LlenarListasDeLabels();
            this.RefrescarVista();

            if ( Screen.PrimaryScreen.Bounds.Width == 800 && Screen.PrimaryScreen.Bounds.Height == 600 )
                this.Bounds = Screen.PrimaryScreen.Bounds;
        }
        public Incidente()
        {
            _atenciones = new BindingList<Atencion>();
            _solicitudCambio = new SolicitudCambio();
            _tipoIncidente = new TipoIncidente();
            _elemento = new Elemento();
            _impacto = new Impacto();
            _plataforma = new Plataforma();
            _prioridad = new Prioridad();
            _solicitudCambio = new SolicitudCambio();

            _categoria = new Categoria();
            _subCategoria = new SubCategoria();

            _usuarioDeriva = new Usuario();
            _usuarioAsigna = new Usuario();
            _asesor = new Usuario();

            _area = new Area();
            _sede = new Sede();

            _usuarioContacto = new Usuario();
        }
        public void Dispose()
        {
            _solicitudCambio = null;
            _tipoIncidente = null;
            _elemento = null;
            _impacto = null;
            _plataforma = null;
            _prioridad = null;
            _solicitudCambio = null;

            _categoria = null;
            _subCategoria = null;

            _usuarioDeriva = null;
            _usuarioAsigna = null;
            _asesor = null;

            _area = null;
            _sede = null;

            _usuarioContacto = null;

            _atenciones = null;
        }
예제 #35
0
    //----------------------------------
    //-- Leer un evento en Chronopic
    //----------------------------------
    public Respuesta Read_event(out double timestamp, 
                               out Plataforma plataforma)
    {
        double t;
         int estado;
         int error;
         Respuesta resp;

         //-- Leer trama
         error=read(this.serial_fd,out t, out estado);

         //-- Convertir el error al tipo Respuesta
         switch(error) {
           case 0:
         resp = Respuesta.Timeout;
         plataforma = Plataforma.UNKNOW;
         timestamp = 0.0;
         break;
           case 1:
         resp = Respuesta.Ok;
         timestamp = t;
         if (estado==0)
           plataforma = Plataforma.OFF;
         else
           plataforma = Plataforma.ON;
         break;
           default:
         resp = Respuesta.Error;
         timestamp = 0.0;
         plataforma = Plataforma.UNKNOW;
         break;
         }

         return resp;
    }
예제 #36
0
    //----------------------------------------
    //-- Obtener el estado de la plataforma
    //----------------------------------------
    public bool Read_platform(out Plataforma plataforma)
    {
        //-- Crear la trama
        byte[] trama = {(byte)Trama.Estado};
        byte[] respuesta = new byte[2];
        int n;
        int count;
        bool status;

        if (sp != null)
            if (sp.IsOpen)
                sp.Close();

        try {
            sp.Open();
        } catch {
            status=false;
            plataforma = Plataforma.UNKNOW;
            this.error=ErrorType.Timeout;
            return status;
        }

        //-- Enviar la trama por el puerto serie
        sp.Write(trama,0,1);

        //-- Esperar a que llegue la respuesta
        //-- Se espera hasta que en el buffer se tengan el numero de bytes
        //-- esperados para la trama. (para esta trama 2). Si hay un
        //-- timeout se aborta
        count=0;
        do {
            n = sp.Read(respuesta,count,2-count);
            count+=n;
        } while (count<2 && n!=-1);

        //-- Comprobar la respuesta recibida
        switch(count) {
            case 2 : //-- Datos listos
                if (respuesta[0]==(byte)Trama.REstado) {
                    switch (respuesta[1]) {
                        case 0:
                            plataforma = Plataforma.OFF;
                            this.error=ErrorType.Ok;
                            status=true;
                            break;
                        case 1:
                            plataforma = Plataforma.ON;
                            this.error=ErrorType.Ok;
                            status=true;
                            break;
                        default:
                            plataforma = Plataforma.UNKNOW;
                            this.error=ErrorType.Invalid;
                            status=false;
                            break;
                    }
                }
                else {  //-- Recibida respuesta invalida
                    plataforma = Plataforma.UNKNOW;
                    this.error=ErrorType.Invalid;
                    status=false;

                    //-- Esperar un tiempo y vaciar buffer
                    Thread.Sleep(ErrorTimeout);
                    this.flush();
                }
                break;
            default : //-- Timeout (u otro error desconocido)
                status=false;
                plataforma = Plataforma.UNKNOW;
                this.error=ErrorType.Timeout;
                break;
        }

        return status;
    }
예제 #37
0
    //***************************************
    //  METODOS PUBLICOS
    //***************************************
    //--------------------------------------------------
    //-- Leer un evento en Chronopic
    //-- Devuelve:
    //--   * timestamp : Marca de tiempo
    //--   * plataforma: Nuevo estado de la plataforma
    //--------------------------------------------------
    public bool Read_event(out double timestamp, 
			out Plataforma plataforma)
    {
        double t;

        //-- Trama de Evento
        byte[] trama = new byte[5];
        bool ok;

        //-- Esperar a que llegue la trama o que se
        //-- produzca un timeout
        ok = Read_cambio(trama);

        LogB.Warning("after Read_cambio =");
        LogB.Warning(ok.ToString());

        //-- Si hay timeout o errores
        if (ok==false) {
            plataforma = Plataforma.UNKNOW;
            timestamp = 0.0;

            return false;
        }

        //-- Comprobar que el estado transmitido en la trama es correcto
        //-- El estado de la plataforma solo puede tener los valores 0,1
        if (trama[1]!=0 && trama[1]!=1) {
            //-- Trama erronea
            plataforma = Plataforma.UNKNOW;
            timestamp = 0.0;
            return false;
        }

        //-- Actualizar el estado
        if (trama[1]==0)
            plataforma = Plataforma.OFF;
        else
            plataforma = Plataforma.ON;

        //-- Obtener el tiempo
        t = (double)((trama[2]*65536 + trama[3]*256 + trama[4])*8)/1000;

        timestamp = t;

        return true;
    }
예제 #38
0
    //----------------------------------------
    //-- Obtener el estado de la plataforma
    //----------------------------------------
    public Respuesta Read_platform(out Plataforma plataforma)
    {
        int error;
         int estado;
         Respuesta resp;

         //-- Enviar trama de estado
         error=Chronopic.estado(this.serial_fd, out estado);

         //-- Convertir el error al tipo Respueta
         switch(error) {
           case 0:
         resp = Respuesta.Timeout;
         plataforma = Plataforma.UNKNOW;
         break;
           case 1:
         resp = Respuesta.Ok;
         if (estado==0)
           plataforma = Plataforma.OFF;
         else
           plataforma = Plataforma.ON;
         break;
           default:
         resp = Respuesta.Error;
         plataforma = Plataforma.UNKNOW;
         break;
         }

         //-- Devolver Respuesta
         return resp;
    }
예제 #39
0
 private void CrearFormController( Plataforma plataforma )
 {
     this.controller = new SeleccionJuegosController( plataforma );
     this.controller.Refrescar += controller_Refrescar;
     this.controller.ActivarBusqueda += controller_ActivarBusqueda;
     this.controller.Escape += controller_Escape;
     this.controller.BuscadorSiguiente += controller_BuscadorSiguiente;
     this.controller.BuscadorAnterior += controller_BuscadorAnterior;
     this.controller.BuscarYAvanzar += controller_BuscarYAvanzar;
     this.controller.BuscadorBorrar += controller_BuscadorBorrar;
 }
 public void SeleccionarPlataforma( Plataforma plataforma )
 {
     if ( this.Owner.InvokeRequired )
     {
         ParametrosPlataformaCallback callback = new ParametrosPlataformaCallback( SeleccionarPlataforma );
         this.Owner.Invoke( callback, plataforma );
     }
     else
     {
         this.DetenerControladores( Contexto.Instancia.Controladores );
         SeleccionJuegos formJuegos = new SeleccionJuegos( plataforma );
         formJuegos.Show( this.Owner );
         formJuegos.FormClosed += formJuegos_FormClosed;
     }
 }
예제 #41
0
        /// <summary>
        /// Permite gestionar las excepciones producidas a nivel de la aplicación (C#).        
        /// </summary>
        /// <remarks>Método estático.</remarks>
        /// <param name="excepcion">Permite pasar las excepciones generadas en ///C#.</param>
        public static void Gestionar(Exception excepcion, Plataforma plataforma)
        {
            //string saltoLinea = "\n";
            string saltoLinea = "";

            if (plataforma == Plataforma.Windows)
                saltoLinea = "\n";

            if (plataforma == Plataforma.Web)
                saltoLinea = "<br>";

            //Mensajes para desplegar al usuario.
            string problema = "EL PROBLEMA GENERADO PUEDE DEBERSE A LOS SIGUIENTES FACTORES:";
            string solucion = "POR FAVOR, PRUEBE LA SIGUIENTE SOLUCIÓN: ";
            string mensajeFinal = "NOTA: En caso de persistir el problema, llame a Soporte Técnico," +
                                  saltoLinea +
                                  "o consulte con el Administrador del Sistema.";

            string mensaje = null;

            //Obtener la excepción producida y convertirlar a un "string", puesto //que
            //el "switch" solo acepta datos de tipo: "entero, caracteres, cadenas //y enumeraciones"
            //y el método "GetType" regresa un dato de tipo diferente a los //anteriores.
            string tipoExcepcion = excepcion.GetType().ToString();

            //Verificar el número de error generado en el cliente(c#)
            //y personalizarlos.
            switch (tipoExcepcion)
            {
                //Errores personalizados.
                case "System.ArgumentException":

                    mensaje = problema +
                              saltoLinea +
                              "1.- El argumento especificado no es válido." +
                              saltoLinea +
                              saltoLinea +
                              solucion +
                              saltoLinea +
                              "1.- Verifique que el argumento sea correcto." +
                              saltoLinea +
                              saltoLinea +
                              mensajeFinal;
                    break;

                //Errores desconocidos.
                default:
                    mensaje = "ERROR DESCONOCIDO:" +
                              saltoLinea +
                              saltoLinea +
                              "MENSAJE: " + excepcion.Message +
                              saltoLinea +
                              "TIPO: " + excepcion.GetType() +
                              saltoLinea +
                              "FUENTE: " + excepcion.Source +
                              saltoLinea +
                              "LÍNEA: " + excepcion.StackTrace;
                    break;
            }

            //Retornar el mensaje de error personalizado en
            //el campo privado "_mensajePersonalizado" de la clase.
            //Para que quien utilice la clase, decida como
            //expone el mensaje de error el formulario.
            //Podría por ejemplo usar la  clase "MessageBox" para hacerlo,
            //talvez un "ErrorProvider", un "ToolTip" o cualquier otra técnica.
            _mensajePersonalizado = mensaje;
        }
예제 #42
0
        /// <summary>
        /// Permite gestionar las excepciones producidas a nivel de la base de   ///datos.
        /// </summary>
        /// <remarks>Solo permite trabajar  con SQL Server.</remarks>
        /// <param name="excepcion">Permite pasar las excepciones generadas en ///SQL Server.</param>
        public static void Gestionar(SqlException excepcion, Plataforma plataforma)
        {
            //---------------------------------------------------
            //Capturar las excepciones generadas en la BD
            //y personalizar los mensajes de error al usuario
            //---------------------------------------------------

            //Permite realizar un salto de linea, para poder
            //mostrar los mensajes de error en varias líneas al
            //usuario de una forma más presentable.

            // string saltoLinea = "\n";

            string saltoLinea = "";

            if (plataforma == Plataforma.Windows)
                saltoLinea = "\n";

            if (plataforma == Plataforma.Web)
                saltoLinea = "<br>";

            //Mensajes para desplegar al usuario.
            //Si cambia el mensaje, unicamente modificamos estas variables
            //de forma sencilla, haciendo el código más facil de mantener.
            string problema = "EL PROBLEMA GENERADO PUEDE DEBERSE A LOS SIGUIENTES FACTORES:";
            string solucion = "POR FAVOR, PRUEBE LA SIGUIENTE SOLUCIÓN: ";
            string mensajeFinal = "NOTA: En caso de persistir el problema, llame a Soporte Técnico," +
                                  saltoLinea +
                                  "o consulte con el Administrador del Sistema.";

            //Contiene la cadena con el mensaje de error a desplegar
            //al usuario.
            string mensaje = null;

            //Verificar el número de error generado en la BD
            //y personalizarlos.
            switch (excepcion.Number)
            {
                //Errores personalizados.
                //case 4060:
                //    break;

                case 18456:

                    mensaje = problema +
                              saltoLinea +
                              "1.- El nombre de usuario o la contraseña ingresados no son válidos." +
                              saltoLinea +
                              saltoLinea +
                              solucion +
                              saltoLinea +
                             "1.- Verifique que el nombre de usuario y/o contraseña sean correctos." +
                              saltoLinea +
                              saltoLinea +
                              mensajeFinal;
                    break;

                //Errores desconocidos.
                default:
                    mensaje = "ERROR DESCONOCIDO:" +
                              saltoLinea +
                              saltoLinea +
                              "MENSAJE: " + excepcion.Message +
                              saltoLinea +
                              "NÚMERO: " + excepcion.Number +
                              saltoLinea +
                              "FUENTE: " + excepcion.Source +
                              saltoLinea +
                              "SERVIDOR: " + excepcion.Server +
                              saltoLinea +
                              "LÍNEA: " + excepcion.StackTrace;
                    break;
            }

            //Retornar el mensaje de error personalizado en
            //el campo privado "_mensajePersonalizado" de la clase.
            //Para que quien utilice la clase, decida como
            //expone el mensaje de error el formulario.
            //Podría por ejemplo usar la  clase "MessageBox" para hacerlo,
            //talvez un "ErrorProvider", un "ToolTip" o cualquier otra técnica.
            _mensajePersonalizado = mensaje;
        }