Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (wavePlayer != null && wavePlayer.PlaybackState == PlaybackState.Playing)
            {
                return;
            }

            Ezani ezani = Ezani.Podne;

            Enum.TryParse <Ezani>(comboBoxTest.SelectedValue.ToString(), out ezani);


            string ezanProperti = "ezan" + ezani.ToString();
            string ezanFajla    = Properties.Settings.Default[ezanProperti].ToString();



            try
            {
                Debug.Assert(wavePlayer == null);
                wavePlayer                  = CreateWavePlayer();
                audioFileReader             = new AudioFileReader(ezanFajla);
                audioFileReader.Volume      = TesterPojacivac.Volume;
                wavePlayer.PlaybackStopped += WavePlayer_PlaybackStopped;
                wavePlayer.Init(audioFileReader);
                wavePlayer.Play();
            }
            catch (Exception ex)
            {
                stopPlayer();
                this.labelLastEvent.Text = "Greška kod testiranja ezana:" + ex.Message;
                MessageBox.Show("Nisam uspijeo testirati sa greškom \n" + ex.Message);
            }
        }
Exemplo n.º 2
0
        private void Ukuisi(Ezani ezan)
        {
            if (ukujisem)
            {
                return;
            }
            if (wavePlayer != null && wavePlayer.PlaybackState == PlaybackState.Playing)
            {
                return;
            }
            var cehcBox = (CheckBox)this.Controls.Find("ezani" + ezan.ToString(), true).FirstOrDefault();

            if (!cehcBox.Checked)
            {
                return;
            }

            string ezanProperti = "ezan" + ezan.ToString();
            string ezanFajla    = Properties.Settings.Default[ezanProperti].ToString();

            string sslider = "volumeSlider" + ezan.ToString();

            var slider = (NAudio.Gui.VolumeSlider) this.Controls.Find(sslider, false).FirstOrDefault();


            try
            {
                Debug.Assert(wavePlayer == null);
                wavePlayer                  = CreateWavePlayer();
                audioFileReader             = new AudioFileReader(ezanFajla);
                audioFileReader.Volume      = slider.Volume;
                wavePlayer.PlaybackStopped += WavePlayer_PlaybackStopped;
                wavePlayer.Init(audioFileReader);
                wavePlayer.Play();
                ukujisem = true;
                this.labelLastEvent.Text = "Ukujišem ezan za  namaz: " + ezan.ToString();
            }
            catch (Exception ex)
            {
                stopPlayer();
                this.labelLastEvent.Text = "Nisam upiejo ezaniti " + ezan.ToString() + " sa ex" + ex.Message;
            }
        }