Exemplo n.º 1
0
    private static int OnKey(HC nCode, WM wParam, IntPtr lParam)
    {
        bool is_key = (wParam == WM.KEYDOWN || wParam == WM.SYSKEYDOWN
                        || wParam == WM.KEYUP || wParam == WM.SYSKEYUP);

        if (nCode == HC.ACTION && is_key)
        {
            // Retrieve key event data from native structure
            var data = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam,
                                                      typeof(KBDLLHOOKSTRUCT));
            bool is_injected = (data.flags & LLKHF.INJECTED) != 0;

            Log.Debug("{0}: OnKey(HC.{1}, WM.{2}, [vk:0x{3:X02} sc:0x{4:X02} flags:{5}])",
                      is_injected ? "Ignored Injected Event" : "Event",
                      nCode, wParam, (int)data.vk, (int)data.sc, data.flags);

            if (!is_injected)
            {
                if (Composer.OnKey(wParam, data.vk, data.sc, data.flags))
                {
                    // Do not process further: that key was for us.
                    return -1;
                }
            }
        }
        else
        {
            Log.Debug("Ignored Event: OnKey({0}, {1})", nCode, wParam);
        }

        return NativeMethods.CallNextHookEx(m_hook, nCode, wParam, lParam);
    }
Exemplo n.º 2
0
        private void btnVerHC_Click(object sender, EventArgs e)
        {
            HC seleccion = (HC)dgvVerHistoriasClinicas.CurrentRow.DataBoundItem;
            frmVerHistoriaClinicaEvoluciones evol = new frmVerHistoriaClinicaEvoluciones(aux, seleccion);

            evol.ShowDialog();
        }
Exemplo n.º 3
0
        public IList <HC> cargarHCactivas(int idpaciente)
        {
            try
            {
                AccesoDatos conexion = new AccesoDatos();
                string      consulta = "select hc.IdHistoriaClinica, rs.RazonSocialPlan, hc.NumAfiliado, hc.FechaVtoCarnet , hc.Motivo, hc.FechaAlta, p.Apellido from HistoriaClinica as hc inner join RazonesSociales as rs on hc.IdRazonSocial=rs.IdRazonSocial inner join Personas as p on hc.IdAdmAlta=p.IdPersona where hc.IdPaciente=" + idpaciente + " and hc.IdEstado=9";
                conexion.setearConsulta(consulta);
                conexion.abrirConexion();
                conexion.ejecutarConsulta();
                while (conexion.Lector.Read())
                {
                    aux                        = new HC();
                    aux.IdHC                   = (int)conexion.Lector[0];
                    aux.RazonSocial            = conexion.Lector.GetString(1);
                    aux.NumeroAfiliado         = conexion.Lector.GetString(2);
                    aux.FechaVencimientoCarnet = (DateTime)conexion.Lector[3];
                    aux.DescripcionAccidente   = conexion.Lector.GetString(4);
                    aux.FechaHrAlta            = (DateTime)conexion.Lector[5];
                    aux.Ingresante             = conexion.Lector.GetString(6);


                    lista.Add(aux);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        private static int OnKey(HC nCode, WM wParam, IntPtr lParam)
        {
            bool is_key = (wParam == WM.KEYDOWN || wParam == WM.SYSKEYDOWN ||
                           wParam == WM.KEYUP || wParam == WM.SYSKEYUP);

            if (nCode == HC.ACTION && is_key)
            {
                // Retrieve key event data from native structure
                var data = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam,
                                                                   typeof(KBDLLHOOKSTRUCT));
                bool is_injected = (data.flags & LLKHF.INJECTED) != 0;

                Log.Debug("{0}: OnKey(HC.{1}, WM.{2}, [vk:0x{3:X02} ({6}) sc:0x{4:X02} flags:{5}])",
                          is_injected ? "Ignored Injected Event" : "Event",
                          nCode, wParam, (int)data.vk, (int)data.sc, data.flags, new Key(data.vk));

                if (!is_injected)
                {
                    if (Composer.OnKey(wParam, data.vk, data.sc, data.flags))
                    {
                        // Do not process further: that key was for us.
                        return(-1);
                    }
                }
            }
            else
            {
                Log.Debug("Ignored Event: OnKey({0}, {1})", nCode, wParam);
            }

            return(NativeMethods.CallNextHookEx(m_hook, nCode, wParam, lParam));
        }
Exemplo n.º 5
0
        public IList <HC> cargar(int paciente)
        {
            AccesoDatos conexion = null;

            try
            {
                conexion = new AccesoDatos();
                string consulta = "select h.IdHistoriaClinica,h.IdRazonSocial, h.IdPaciente, h.NumAfiliado, h.FechaVtoCarnet, h.Motivo, h.FechaAlta, h.IdAdmAlta, h.FechaModif, h.IdAdmModif, h.FechaBaja, h.IdAdmBaja, h.IdEstado, p.Apellido, (select rs.RazonSocialPlan from RazonesSociales as rs where h.IdRazonSocial=rs.IdRazonSocial) from HistoriaClinica as h inner join Personas as p on h.IdAdmAlta=p.IdPersona where IdPaciente=" + paciente + " and p.estado=1 and h.Idestado=9";
                conexion.setearConsulta(consulta);
                conexion.abrirConexion();
                conexion.ejecutarConsulta();

                while (conexion.Lector.Read())
                {
                    aux               = new HC();
                    aux.IdHC          = (int)conexion.Lector[0];
                    aux.IdRazonSocial = (int)conexion.Lector[1];
                    aux.IdPaciente    = (int)conexion.Lector[2];
                    if (!conexion.Lector.IsDBNull(3))
                    {
                        aux.NumeroAfiliado = conexion.Lector.GetString(3);
                    }
                    if (!conexion.Lector.IsDBNull(4))
                    {
                        aux.FechaVencimientoCarnet = (DateTime)conexion.Lector[4];
                    }
                    aux.DescripcionAccidente = conexion.Lector.GetString(5);
                    aux.FechaHrAlta          = (DateTime)conexion.Lector[6];
                    aux.IdAdminAlta          = (int)conexion.Lector[7];
                    aux.FechaHrModif         = (DateTime)conexion.Lector[8];
                    aux.IdAdminModif         = (int)conexion.Lector[9];
                    if (!conexion.Lector.IsDBNull(10))
                    {
                        aux.FechaHrBaja = (DateTime)conexion.Lector[10];
                    }
                    if (!conexion.Lector.IsDBNull(11))
                    {
                        aux.IdAdminBaja = (int)conexion.Lector[11];
                    }
                    aux.Estado      = (int)conexion.Lector[12];
                    aux.Ingresante  = conexion.Lector.GetString(13);
                    aux.RazonSocial = conexion.Lector.GetString(14);

                    lista.Add(aux);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conexion != null)
                {
                    conexion.cerrarConexion();
                }
            }
        }
Exemplo n.º 6
0
        private void btnEditarHC_Click(object sender, EventArgs e)
        {
            HC seleccion = (HC)dgvVerHistoriasClinicas.CurrentRow.DataBoundItem;
            frmModificarHistoriaClinica editar = new frmModificarHistoriaClinica(aux.IdPaciente, seleccion);

            editar.ShowDialog();
            cargar();
        }
Exemplo n.º 7
0
    public async Task <string> GETRequestAsync(string URL, bool useCookieContainer = false, List <NameValuePair> headers = null, bool presentUserAgent = false, string referer = null)
    {
        HttpResponseMessage response = await HC.GetAsync(new Uri(URL));

        var InputStream = await response.Content.ReadAsStreamAsync();

        using (StreamReader SR = new StreamReader(InputStream, System.Text.Encoding.UTF8))
            return(SR.ReadToEnd());
    }
Exemplo n.º 8
0
 private void btnEliminarHC_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("¿Eliminar la historia clinica seleccionada?", "Eliminar", MessageBoxButtons.YesNo).ToString() == "Yes")
     {
         HC        seleccion = (HC)dgvVerHistoriasClinicas.CurrentRow.DataBoundItem;
         HCnegocio neg       = new HCnegocio();
         neg.eliminar(seleccion.IdHC, 1);
         cargar();
     }
 }
Exemplo n.º 9
0
        protected IntPtr OnReceived(
            HC nCode,
            IntPtr wParam,
            IntPtr lParam)
        {
            if (nCode >= 0 && wParam != default && lParam != default)
            {
                ProcessRawInput((WindowMessage)wParam, lParam);
            }

            return(CallNextHookEx(hhk, nCode, wParam, lParam));
        }
Exemplo n.º 10
0
    void Awake()
    {
        if (m_instance == null)
        {
            m_instance = this;
        }
        else if (m_instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Exemplo n.º 11
0
        private static int OnKey(HC nCode, WM wParam, IntPtr lParam)
        {
            bool is_key = (wParam == WM.KEYDOWN || wParam == WM.SYSKEYDOWN ||
                           wParam == WM.KEYUP || wParam == WM.SYSKEYUP);

            if (m_duplicate != 0)
            {
                // Do nothing. We can only get here if a key is pressed during
                // the very short time where we have two hooks installed, i.e.
                // practically never, but it’s better to handle this properly.
            }
            else if (nCode == HC.ACTION && is_key)
            {
                // Retrieve key event data from native structure
                var data = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam,
                                                                   typeof(KBDLLHOOKSTRUCT));
                bool is_injected = (data.flags & LLKHF.INJECTED) != 0;
                bool accept      = !is_injected || (Settings.AllowInjected.Value && m_recursive == 0);

                Logger.Debug("{0}{1}: OnKey(HC.{2}, WM.{3}, [vk:0x{4:X02} ({7}) sc:0x{5:X02} flags:{6}])",
                             accept ? "" : "Ignored ", is_injected ? "Injected Event" : "Event",
                             nCode, wParam, (int)data.vk, (int)data.sc, data.flags, new Key(data.vk));

                if (accept)
                {
                    ++m_recursive;
                    bool processed = Composer.OnKey(wParam, data.vk, data.sc, data.flags);
                    --m_recursive;

                    if (processed)
                    {
                        return(-1); // Do not process further: that key was for us.
                    }
                }
            }
            else
            {
                Logger.Debug("Ignored Event: OnKey({0}, {1})", nCode, wParam);
            }

            // Call next hook but guard against re-doing our own work in case we
            // were installed twice.
            ++m_duplicate;
            int ret = NativeMethods.CallNextHookEx(m_hook, nCode, wParam, lParam);

            --m_duplicate;

            return(ret);
        }
Exemplo n.º 12
0
 private void btnAsignarTurno_Click(object sender, EventArgs e)
 {
     if (txtApellidoNombre.Text != "")
     {
         if (dgvHistoriasClinicas.CurrentRow != null)
         {
             if (txtObservaciones.Text != "")
             {
                 if (rdbSeleccionado != 0)
                 {
                     if (dgvTurnosDisponibles.CurrentRow != null)
                     {
                         turn     = (Turno)dgvTurnosDisponibles.CurrentRow.DataBoundItem;
                         histClin = (HC)dgvHistoriasClinicas.CurrentRow.DataBoundItem;
                         turnNeg.asignarTurno(pte.IdPaciente, histClin.IdHC, turn.IdTurno, txtObservaciones.Text);
                         MessageBox.Show("Se asigno correctamente el turno");
                         Close();
                     }
                     else
                     {
                         MessageBox.Show("Seleccione un turno");
                     }
                 }
                 else
                 {
                     MessageBox.Show("Seleccione un modo de busqueda, fecha y luego el turno a asignar");
                 }
             }
             else
             {
                 MessageBox.Show("Ingrese una observacion, por ej: Consulta, diagnostico, informacion importante para el profesional y/o administrativo");
             }
         }
         else
         {
             MessageBox.Show("Seleccione una Historia Clinica");
         }
     }
     else
     {
         MessageBox.Show("Ingrese un DNI válido y luego seleccione una Historia Clinica");
     }
 }
Exemplo n.º 13
0
        private void GetFilterData(string[] lines)
        {
            SC.ClearFilterValues();
            HC.ClearFilterValues();
            int startIndex = 0;
            int endIndex;

            if (GetLines(lines, ref startIndex, out endIndex, "# Section: Enchantments", "######"))
            {
                GetFilterEnchantsData(new ArraySegment <string>(lines, startIndex, endIndex - startIndex));
            }
            startIndex = 0;
            if (GetLines(lines, ref startIndex, out endIndex, "# Section: Divination Cards", "######"))
            {
                GetFilterDivinationData(new ArraySegment <string>(lines, startIndex, endIndex - startIndex));
            }
            startIndex = 0;
            if (GetLines(lines, ref startIndex, out endIndex, "# Section: Uniques", "######"))
            {
                GetFilterUniqueData(new ArraySegment <string>(lines, startIndex, endIndex - startIndex));
            }
        }
Exemplo n.º 14
0
        private static int OnKey(HC nCode, WM wParam, IntPtr lParam)
        {
            if (nCode == HC.ACTION)
            {
            // Retrieve event data from native structure
            var data = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam,
                                                      typeof(KBDLLHOOKSTRUCT));

            bool is_key = (wParam == WM.KEYDOWN || wParam == WM.SYSKEYDOWN
                            || wParam == WM.KEYUP || wParam == WM.SYSKEYUP);
            bool is_injected = (data.flags & LLKHF.INJECTED) != 0;

            if (is_key && !is_injected)
            {
                if (Composer.OnKey(wParam, data.vk, data.sc, data.flags))
                {
                    // Do not process further: that key was for us.
                    return -1;
                }
            }
            }

            return NativeMethods.CallNextHookEx(m_hook, nCode, wParam, lParam);
        }
Exemplo n.º 15
0
        public void editarHC(HC historiaClinicaEditada)
        {
            AccesoDatos conexion = null;

            try
            {
                conexion = new AccesoDatos();
                string consulta = "update historiaclinica set IdRazonSocial=" + historiaClinicaEditada.IdRazonSocial + ",NumAfiliado='" + historiaClinicaEditada.NumeroAfiliado + "',FechaVtoCarnet='" + historiaClinicaEditada.FechaVencimientoCarnet.ToString("yyyy/MM/dd") + "',Motivo='" + historiaClinicaEditada.DescripcionAccidente + "',FechaModif=GETDATE(),IdAdmModif=1,IdEstado=" + historiaClinicaEditada.Estado + " where idhistoriaclinica=" + historiaClinicaEditada.IdHC;
                conexion.setearConsulta(consulta);
                conexion.abrirConexion();
                conexion.ejecutarAccion();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conexion != null)
                {
                    conexion.cerrarConexion();
                }
            }
        }
Exemplo n.º 16
0
        private static int OnKey(HC nCode, WM wParam, IntPtr lParam)
        {
            if (nCode == HC.ACTION)
            {
                // Retrieve event data from native structure
                var data = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam,
                                                                   typeof(KBDLLHOOKSTRUCT));

                bool is_key = (wParam == WM.KEYDOWN || wParam == WM.SYSKEYDOWN ||
                               wParam == WM.KEYUP || wParam == WM.SYSKEYUP);
                bool is_injected = (data.flags & LLKHF.INJECTED) != 0;

                if (is_key && !is_injected)
                {
                    if (Composer.OnKey(wParam, data.vk, data.sc, data.flags))
                    {
                        // Do not process further: that key was for us.
                        return(-1);
                    }
                }
            }

            return(NativeMethods.CallNextHookEx(m_hook, nCode, wParam, lParam));
        }
Exemplo n.º 17
0
 public static extern int CallNextHookEx(HOOK hhk, HC nCode, WM wParam,
                                          IntPtr lParam);
Exemplo n.º 18
0
        public PortraitGenerator(List <string> RL, Dictionary <string, string> N, Dictionary <string, byte[]> FD)
        {
            InitializeComponent();

            Emotion_Spec = new Control[] { LBL_Emotions, CB_Emotion, CHK_Blush, CHK_SweatDrop };
            Corrin_Spec  = new Control[] { LBL_CharType, CB_Corrin, LBL_Eyes, CB_Eyes, LBL_HairStyle, CB_HairStyle, LBL_FacialFeature, CB_FacialFeature, LBL_Accessory, CB_Accessory };

            ResourceList = RL;
            Names        = N;
            FaceData     = FD;

            DefaultHairs = new Dictionary <string, int>();
            string[] HCs = Resources.HCs.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string HC in HCs)
            {
                var H = HC.Split(new[] { '\t' });
                DefaultHairs[H[0]] = int.Parse(H[1], NumberStyles.AllowHexSpecifier);
            }
            CB_HairColor.Items.Add("Custom");
            CB_HairColor.Items.AddRange(DefaultHairs.Keys.Select(s => s).ToArray());

            CB_PortraitStyle.Items.AddRange(new[] { "Standard", "Closeup", "Critical" });

            for (int i = 0; i < Characters.Length; i++)
            {
                Characters[i] = new List <cbItem>();
                foreach (string Resource in ResourceList)
                {
                    if (Resource.Contains("_" + Prefixes[i] + "_"))
                    {
                        string Character = Resource.Substring(0, Resource.IndexOf("_" + Prefixes[i] + "_"));
                        cbItem ncbi      = new cbItem
                        {
                            Value = Character,
                            Text  = Names.ContainsKey(Character) ? Names[Character] : Character
                        };
                        if (!ncbi.Text.Contains("マイユニ") && ncbi.Text != "Kana")
                        {
                            if (Characters[i].All(cbi => cbi.Text != ncbi.Text) && Characters[i].All(cbi => cbi.Value != ncbi.Value))
                            {
                                Characters[i].Add(ncbi);
                            }
                        }
                    }
                }
                Characters[i].Add(new cbItem {
                    Text = "Corrin", Value = "username"
                });
                Characters[i].Add(new cbItem {
                    Text = "Kana (M)", Value = "カンナ男"
                });
                Characters[i].Add(new cbItem {
                    Text = "Kana (F)", Value = "カンナ女"
                });
                Characters[i] = Characters[i].OrderBy(cbi => cbi.Text).ToList();
            }
            CB_Character.DisplayMember = "Text";
            CB_Character.ValueMember   = "Value";

            CB_Corrin.Items.AddRange(new[] { "Male 1", "Male 2", "Female 1", "Female 2" });
            CB_Eyes.Items.AddRange(new[] { "Style A", "Style B", "Style C", "Style D", "Style E", "Style F", "Style G" });
            CB_HairStyle.Items.AddRange(Enumerable.Range(0, 12).Select(i => i.ToString("00")).ToArray());
            CB_FacialFeature.Items.AddRange(new[] { "None", "Scratches", "Vertical Scratches", "Horizontal Scratches", "Tattoo 1", "Tattoo 2", "Tattoo 3", "Eye Mole", "Mouth Mole", "Plaster 1", "Plaster 2", "White Eyepatch", "Black Eyepatch" });
            CB_Accessory.Items.AddRange(new[] { "None", "Silver Piece", "Butterfly", "Black Ribbon", "White Ribbon", "White Rose" });

            CB_PortraitStyle.SelectedIndex = 2;

            CB_Character.SelectedIndex = CB_HairColor.SelectedIndex = CB_Corrin.SelectedIndex = CB_Eyes.SelectedIndex = CB_HairStyle.SelectedIndex = CB_FacialFeature.SelectedIndex = CB_Accessory.SelectedIndex = 0;
            CB_Accessory.Enabled       = LBL_Accessory.Enabled = CB_Corrin.SelectedIndex > 1;

            loaded = true;
            UpdateImage();
        }
Exemplo n.º 19
0
 public frmVerHistoriaClinicaEvoluciones(Paciente paciente, HC HistoriaClinica)
 {
     InitializeComponent();
     HistClin = HistoriaClinica;
     aux      = paciente;
 }
Exemplo n.º 20
0
        /**
         * Constructor for portrait generation of dialogue characters.
         * @param RL Resource list.
         * @param N Names of the characters in dialogue.
         * @param FD Face data of the characters in dialogue.
         */
        public PortraitGenerator(List <string> RL, Dictionary <string, string> N, Dictionary <string, byte[]> FD)
        {
            InitializeComponent();

            // list of all character emotion assets
            Emotion_Spec = new Control[] { LBL_Emotions, CB_Emotion, CHK_Blush, CHK_SweatDrop };
            Corrin_Spec  = new Control[] { LBL_CharType, CB_Corrin, LBL_Eyes, CB_Eyes, LBL_HairStyle, CB_HairStyle, LBL_FacialFeature, CB_FacialFeature, LBL_Accessory, CB_Accessory };

            // set local variables
            ResourceList = RL;
            Names        = N;
            FaceData     = FD;

            // gets all possible hair colours of characters
            DefaultHairs = new Dictionary <string, int>();
            string[] HCs = Resources.HCs.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string HC in HCs)
            {
                var H = HC.Split(new[] { '\t' });
                DefaultHairs[H[0]] = int.Parse(H[1], NumberStyles.AllowHexSpecifier);
            }
            CB_HairColor.Items.Add("Custom");   // adds custom hair colour option
            CB_HairColor.Items.AddRange(DefaultHairs.Keys.Select(s => s).ToArray());

            CB_PortraitStyle.Items.AddRange(new[] { "Standard", "Closeup", "Critical" });   // adds various portrait range options

            // sets the character that is currently in dialogue
            for (int i = 0; i < Characters.Length; i++) // for each character in the dialogue
            {
                Characters[i] = new List <cbItem>();    // initialize the character as a new cbItem
                foreach (string Resource in ResourceList)
                {
                    if (Resource.Contains("_" + Prefixes[i] + "_"))                                          // finds character name for the current character
                    {
                        string Character = Resource.Substring(0, Resource.IndexOf("_" + Prefixes[i] + "_")); // gets the character name
                        cbItem ncbi      = new cbItem                                                        // create a new cbItem containing the character name
                        {
                            Value = Character,
                            Text  = Names.ContainsKey(Character) ? Names[Character] : Character
                        };
                        // if the character name is not "マイユニ" or "Kana"
                        if (!ncbi.Text.Contains("マイユニ") && ncbi.Text != "Kana")
                        {
                            // and if the character name found does not exist in the character list already, add it to the list
                            if (Characters[i].All(cbi => cbi.Text != ncbi.Text) && Characters[i].All(cbi => cbi.Value != ncbi.Value))
                            {
                                Characters[i].Add(ncbi);
                            }
                        }
                    }
                }
                Characters[i].Add(new cbItem {
                    Text = "Corrin", Value = "username"
                });                                                                         // add "Corrin" to the list
                Characters[i].Add(new cbItem {
                    Text = "Kana (M)", Value = "カンナ男"
                });                                                                     // add "Kana (M)" to the list
                Characters[i].Add(new cbItem {
                    Text = "Kana (F)", Value = "カンナ女"
                });                                                                     // add "Kana (F)" to the list
                Characters[i] = Characters[i].OrderBy(cbi => cbi.Text).ToList();
            }
            // set member values of the character
            CB_Character.DisplayMember = "Text";
            CB_Character.ValueMember   = "Value";

            // add options for the character's appearance
            CB_Corrin.Items.AddRange(new[] { "Male 1", "Male 2", "Female 1", "Female 2" });                                                                                                                                                           // add options for character gender
            CB_Eyes.Items.AddRange(new[] { "Style A", "Style B", "Style C", "Style D", "Style E", "Style F", "Style G" });                                                                                                                            // add options for eyes
            CB_HairStyle.Items.AddRange(Enumerable.Range(0, 12).Select(i => i.ToString("00")).ToArray());                                                                                                                                             // add options for hairstyles
            CB_FacialFeature.Items.AddRange(new[] { "None", "Scratches", "Vertical Scratches", "Horizontal Scratches", "Tattoo 1", "Tattoo 2", "Tattoo 3", "Eye Mole", "Mouth Mole", "Plaster 1", "Plaster 2", "White Eyepatch", "Black Eyepatch" }); // add options for facial features
            CB_Accessory.Items.AddRange(new[] { "None", "Silver Piece", "Butterfly", "Black Ribbon", "White Ribbon", "White Rose" });                                                                                                                 // add options for accessories

            CB_PortraitStyle.SelectedIndex = 2;                                                                                                                                                                                                       // set default portrait style to style 2

            CB_Character.SelectedIndex = CB_HairColor.SelectedIndex = CB_Corrin.SelectedIndex = CB_Eyes.SelectedIndex = CB_HairStyle.SelectedIndex = CB_FacialFeature.SelectedIndex = CB_Accessory.SelectedIndex = 0;                                 // set default indices of all character appearance options to 0
            CB_Accessory.Enabled       = LBL_Accessory.Enabled = CB_Corrin.SelectedIndex > 1;                                                                                                                                                         // enable accessories if the gender is female

            loaded = true;                                                                                                                                                                                                                            // set indicator that portrait generation is completed
            UpdateImage();                                                                                                                                                                                                                            // refresh image with portraits on screen
        }
    //obtenemos todo el input necesairo
    void InputControl(HC c) 
    {
        switch (c.ControlType) 
        {
            //KeyBoard Control
            case CT.Keyboard:
                // W AND S FOR THROTTLE, A & D FOR YAW , ARROWS FOR PITCH(up, down) and ROLL(right,left) 
                //throttle 
                if (Input.GetKey(KeyCode.W))
                    c.Throttle += Settings.ThrotleSpeed * Time.deltaTime;
                else if(Input.GetKey(KeyCode.S))
                    c.Throttle -= Settings.ThrotleSpeed * Time.deltaTime;
                //pitch roll yaw control
                //YAW
                if (Input.GetKey(KeyCode.D) )
                    c.Yaw += 1 * Time.deltaTime;
                else if (Input.GetKey(KeyCode.A))
                    c.Yaw -= 1 * Time.deltaTime;
                else
                    c.Yaw = Mathf.Lerp(c.Yaw, 0, c.ReturnSpeed*Time.deltaTime);
                //Pitch
                if (Input.GetKey(KeyCode.UpArrow))
                    c.Pitch += 1 * Time.deltaTime;
                    else if (Input.GetKey(KeyCode.DownArrow))
                    c.Pitch -= 1 * Time.deltaTime;
                else 
                    c.Pitch = Mathf.Lerp(c.Pitch, 0, c.ReturnSpeed*Time.deltaTime);
                //Roll
                if (Input.GetKey(KeyCode.RightArrow))
                    c.Roll += 1 * Time.deltaTime; 
                else if (Input.GetKey(KeyCode.LeftArrow))
                    c.Roll -= 1 * Time.deltaTime;
                else 
                    c.Roll = Mathf.Lerp(c.Roll, 0, c.ReturnSpeed * Time.deltaTime);

                if (c.ClampValues) 
                {
                    c.Roll = Mathf.Clamp(c.Roll, -1, 1);
                    c.Pitch = Mathf.Clamp(c.Pitch, -1, 1);
                    c.Yaw = Mathf.Clamp(c.Yaw, -1, 1);
                }
            break;
            
            //JoyStickControl pitch (vertical joystick axe), roll (horizontal axe),  buttons 4 and 5 for yaw, LOGITECH ATTACK 3
            case CT.JoyStick:

                //Axes
            c.Pitch = Input.GetAxis("Vertical");
            c.Roll = Input.GetAxis("Horizontal");
            
                

                //Buttons
                //trhottle
            if (Input.GetKey(KeyCode.Joystick1Button2))
                c.Throttle += Settings.ThrotleSpeed * Time.deltaTime;
            else if (Input.GetKey(KeyCode.Joystick1Button1))
                c.Throttle -= Settings.ThrotleSpeed * Time.deltaTime;
            

            //YAW
            if (Input.GetKey(KeyCode.Joystick1Button4))
                c.Yaw += 1 * Time.deltaTime;
            else if (Input.GetKey(KeyCode.Joystick1Button3))
                c.Yaw -= 1 * Time.deltaTime;
            else
                c.Yaw = Mathf.Lerp(c.Yaw, 0, c.ReturnSpeed * Time.deltaTime);

            if (c.ClampValues)
                c.Yaw = Mathf.Clamp(c.Yaw, -1, 1);
            break;


            //Mouse and key board (no default case)
            case CT.KeyBoardAndMouse:
                //coming son...



            break;
               
            default:
            Debug.LogError("Wtf n***a??? (no control selected)");
            break;

        }
        //Generals
        c.Throttle = Mathf.Clamp(c.Throttle, 0, 10);
    
    }
Exemplo n.º 22
0
 public frmModificarHistoriaClinica(int idPaciente, HC historiaClinica)
 {
     InitializeComponent();
     pte = idPaciente;
     aux = historiaClinica;
 }
Exemplo n.º 23
0
        private void startBtn_Click(object sender, EventArgs e)
        {
            double a         = Convert.ToDouble(aBox.Text);
            double b         = Convert.ToDouble(bBox.Text);
            double d         = Convert.ToDouble(dBox.Text);
            int    T         = Convert.ToInt32(Tbox.Text);
            Random generator = new Random();
            int    round     = 0;
            int    l         = (int)Math.Ceiling(Math.Log(((b - a) * (1 / d)) + 1, 2));

            double pom = d;

            while (pom < 1)
            {
                round++;
                pom *= 10;
            }
            List <Individual>         individuals  = new List <Individual>();
            List <List <Individual> > ListofListVc = new List <List <Individual> >();
            List <Individual>         ListVcBest   = new List <Individual>();
            Individual        Vc;
            Individual        VBest = null;
            Individual        Vn;
            List <Individual> listVc;

            for (int i = 0; i < T; i++)
            {
                listVc = new List <Individual>();
                Vc     = HC.MakeFirstInd(a, b, d, l, generator);
                listVc.Add(Vc.Clone());
                if (i == 0)
                {
                    VBest = Vc.Clone();
                }
                while (true)
                {
                    Vn = HC.MakeVn(Vc, a, b, l, round);
                    if (Vn.Fx > Vc.Fx)
                    {
                        Vc = Vn.Clone();
                        listVc.Add(Vc.Clone());
                    }
                    else
                    {
                        break;
                    }
                }
                ListofListVc.Add(listVc);
                if (VBest.Fx < Vc.Fx)
                {
                    VBest = Vc.Clone();
                }
                ListVcBest.Add(VBest.Clone());
                if (VBest.Xreal == 10.999)
                {
                    break;
                }
            }
            individuals.Add(VBest);
            var bindingList = new BindingList <Individual>(individuals);
            var source      = new BindingSource(bindingList, null);

            table.DataSource = source;
            ToTxt.WriteToFile(ListofListVc, T, d);
            MakeChart(ListofListVc, ListVcBest);
        }
Exemplo n.º 24
0
        private void startTestBtn_Click(object sender, EventArgs e)
        {
            double a         = Convert.ToDouble(aBox.Text);
            double b         = Convert.ToDouble(bBox.Text);
            double d         = Convert.ToDouble(dBox.Text);
            Random generator = new Random();
            int    round     = 0;
            int    l         = (int)Math.Ceiling(Math.Log(((b - a) * (1 / d)) + 1, 2));

            double pom = d;

            while (pom < 1)
            {
                round++;
                pom *= 10;
            }
            List <List <Individual> > ListofListVc = new List <List <Individual> >();
            List <Individual>         ListVcBest   = new List <Individual>();
            Individual        Vc;
            Individual        VBest = null;
            Individual        Vn;
            List <Individual> listVc;
            List <Generation> listGen = new List <Generation>();

            for (int i = 0; i < 3000; i++)
            {
                Generation generation = new Generation
                {
                    Iteration = i + 1
                };
                listGen.Add(generation);
            }
            for (int j = 0; j < 10000; j++)
            {
                for (int i = 0; i < 3000; i++)
                {
                    listVc = new List <Individual>();
                    Vc     = HC.MakeFirstInd(a, b, d, l, generator);
                    listVc.Add(Vc.Clone());
                    if (i == 0)
                    {
                        VBest = Vc.Clone();
                    }
                    while (true)
                    {
                        Vn = HC.MakeVn(Vc, a, b, l, round);
                        if (Vn.Fx > Vc.Fx)
                        {
                            Vc = Vn.Clone();
                            listVc.Add(Vc.Clone());
                        }
                        else
                        {
                            break;
                        }
                    }
                    ListofListVc.Add(listVc);
                    if (VBest.Fx < Vc.Fx)
                    {
                        VBest = Vc.Clone();
                    }
                    ListVcBest.Add(VBest.Clone());
                    if (VBest.Xreal == 10.999)
                    {
                        listGen[i].SolveCount += 1;
                        break;
                    }
                }
            }

            for (int i = 1; i < listGen.Count; i++)
            {
                listGen[i].Cumulation += listGen[i - 1].SolveCount + listGen[i - 1].Cumulation;
            }

            MakeTestChart(listGen);
            var bindingList = new BindingList <Generation>(listGen);
            var source      = new BindingSource(bindingList, null);

            testTable.DataSource = source;
        }
 internal static extern IntPtr CallNextHookEx(
     SetWindowsHookExSafeHandle hhk,
     HC nCode,
     IntPtr wParam,
     IntPtr lParam);
Exemplo n.º 26
0
 public static extern int CallNextHookEx(HOOK hhk, HC nCode, WM wParam,
                                         IntPtr lParam);
Exemplo n.º 27
0
    //obtenemos todo el input necesairo
    void InputControl(HC c)
    {
        switch (c.ControlType)
        {
        //KeyBoard Control
        case CT.Keyboard:
            // W AND S FOR THROTTLE, A & D FOR YAW , ARROWS FOR PITCH(up, down) and ROLL(right,left)
            //throttle
            if (Input.GetKey(KeyCode.W))
            {
                c.Throttle += Settings.ThrotleSpeed * Time.deltaTime;
            }
            else if (Input.GetKey(KeyCode.S))
            {
                c.Throttle -= Settings.ThrotleSpeed * Time.deltaTime;
            }
            //pitch roll yaw control
            //YAW
            if (Input.GetKey(KeyCode.D))
            {
                c.Yaw += 1 * Time.deltaTime;
            }
            else if (Input.GetKey(KeyCode.A))
            {
                c.Yaw -= 1 * Time.deltaTime;
            }
            else
            {
                c.Yaw = Mathf.Lerp(c.Yaw, 0, c.ReturnSpeed * Time.deltaTime);
            }
            //Pitch
            if (Input.GetKey(KeyCode.UpArrow))
            {
                c.Pitch += 1 * Time.deltaTime;
            }
            else if (Input.GetKey(KeyCode.DownArrow))
            {
                c.Pitch -= 1 * Time.deltaTime;
            }
            else
            {
                c.Pitch = Mathf.Lerp(c.Pitch, 0, c.ReturnSpeed * Time.deltaTime);
            }
            //Roll
            if (Input.GetKey(KeyCode.RightArrow))
            {
                c.Roll += 1 * Time.deltaTime;
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {
                c.Roll -= 1 * Time.deltaTime;
            }
            else
            {
                c.Roll = Mathf.Lerp(c.Roll, 0, c.ReturnSpeed * Time.deltaTime);
            }

            if (c.ClampValues)
            {
                c.Roll  = Mathf.Clamp(c.Roll, -1, 1);
                c.Pitch = Mathf.Clamp(c.Pitch, -1, 1);
                c.Yaw   = Mathf.Clamp(c.Yaw, -1, 1);
            }
            break;

        //JoyStickControl pitch (vertical joystick axe), roll (horizontal axe),  buttons 4 and 5 for yaw, LOGITECH ATTACK 3
        case CT.JoyStick:

            //Axes
            c.Pitch = Input.GetAxis("Vertical");
            c.Roll  = Input.GetAxis("Horizontal");



            //Buttons
            //trhottle
            if (Input.GetKey(KeyCode.Joystick1Button2))
            {
                c.Throttle += Settings.ThrotleSpeed * Time.deltaTime;
            }
            else if (Input.GetKey(KeyCode.Joystick1Button1))
            {
                c.Throttle -= Settings.ThrotleSpeed * Time.deltaTime;
            }


            //YAW
            if (Input.GetKey(KeyCode.Joystick1Button4))
            {
                c.Yaw += 1 * Time.deltaTime;
            }
            else if (Input.GetKey(KeyCode.Joystick1Button3))
            {
                c.Yaw -= 1 * Time.deltaTime;
            }
            else
            {
                c.Yaw = Mathf.Lerp(c.Yaw, 0, c.ReturnSpeed * Time.deltaTime);
            }

            if (c.ClampValues)
            {
                c.Yaw = Mathf.Clamp(c.Yaw, -1, 1);
            }
            break;


        //Mouse and key board (no default case)
        case CT.KeyBoardAndMouse:
            //coming son...



            break;

        default:
            Debug.LogError("Wtf n***a??? (no control selected)");
            break;
        }
        //Generals
        c.Throttle = Mathf.Clamp(c.Throttle, 0, 10);
    }