Beispiel #1
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     for (int i = 0; i < Personas.GetPersonas().Count; i++)
     {
         texto.Text += Personas.buscarPersonaPorIndex(i);
     }
 }
Beispiel #2
0
        public void buscarPersonaPorNombre(String nombre)
        {
            SoundPlayer My_JukeBox  = new SoundPlayer(@"Sounds/nope.wav");
            SoundPlayer My_JukeBox2 = new SoundPlayer(@"Sounds/item.wav");

            if (nombre == "")
            {
                try
                {
                    My_JukeBox.Play();
                }
                catch (FileNotFoundException ex)
                {
                    Console.WriteLine(ex);
                }
                MessageBox.Show("Introduce un nombre");
            }
            else
            {
                texto.Text = "";
                for (int i = Personas.GetPersonas().Count - 1; i >= 0; i--)
                {
                    if (Personas.GetPersonas()[i].Nombre == nombre)
                    {
                        texto.Text += Personas.buscarPersonaPorIndex(i);
                        Personas.removePersona(Personas.GetPersonas()[i]);
                        try
                        {
                            My_JukeBox2.Play();
                        }
                        catch (FileNotFoundException ex) { Console.WriteLine(ex); }
                    }
                }
                if (texto.Text == "")
                {
                    texto.Text = "No se ha encontrado a nadie con ese nombre";
                    try
                    {
                        My_JukeBox.Play();
                    }
                    catch (FileNotFoundException ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
            }
        }
Beispiel #3
0
        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            int opcion = Combobox1.SelectedIndex;



            switch (opcion)
            {
            case 0:

                SoundPlayer My_JukeBox = new SoundPlayer(@"Sounds/call.wav");
                try
                {
                    My_JukeBox.Play();
                }
                catch (FileNotFoundException ex)
                {
                    // Write error.
                    Console.WriteLine(ex);
                }

                Window1 window = new Window1();

                window.ShowDialog();
                break;

            case 1:

                SoundPlayer My_JukeBox2 = new SoundPlayer(@"Sounds/alerted.wav");
                try
                {
                    My_JukeBox2.Play();
                }
                catch (FileNotFoundException ex)
                {
                    Console.WriteLine(ex);
                }

                texto.Text = String.Empty;
                for (int i = 0; i < Personas.GetPersonas().Count; i++)
                {
                    texto.Text += Personas.buscarPersonaPorIndex(i);
                }

                break;

            case 2:
                SoundPlayer My_JukeBox3 = new SoundPlayer(@"Sounds/itemselect.wav");
                try
                {
                    My_JukeBox3.Play();
                }
                catch (FileNotFoundException ex)
                {
                    // Write error.
                    Console.WriteLine(ex);
                }
                Window2 window2 = new Window2();
                window2.ShowDialog();
                break;

            case 3:
                SoundPlayer My_JukeBox4 = new SoundPlayer(@"Sounds/item2.wav");
                try
                {
                    My_JukeBox4.Play();
                }
                catch (FileNotFoundException ex)
                {
                    Console.WriteLine(ex);
                }
                MessageBox.Show(Personas.buscarPersonadeMenosPeso());
                break;

            case 4:
                SoundPlayer My_JukeBox5 = new SoundPlayer(@"Sounds/item2.wav");
                try
                {
                    My_JukeBox5.Play();
                }
                catch (FileNotFoundException ex)
                {
                    Console.WriteLine(ex);
                }
                MessageBox.Show(Personas.buscarPersonadeMasAltura());
                break;

            case 5:
                SoundPlayer My_JukeBox6 = new SoundPlayer(@"Sounds/item2.wav");
                try
                {
                    My_JukeBox6.Play();
                }
                catch (FileNotFoundException ex)
                {
                    Console.WriteLine(ex);
                }
                Window3 window3 = new Window3();

                window3.ShowDialog();
                break;

            case 6:
                SoundPlayer My_JukeBox7 = new SoundPlayer(@"Sounds/dead.wav");
                try
                {
                    My_JukeBox7.Play();
                }
                catch (FileNotFoundException ex)
                {
                    Console.WriteLine(ex);
                }
                Task.Delay(7500).Wait();
                this.Close();

                break;
            }
        }