Пример #1
49
 public void LaserSound()
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = "peww1.wav";
     player.Load();
     player.Play();
     player.Play();
 }
Пример #2
0
 private void playSound(string path)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = path;
     player.Load();
     player.Play();
 }
Пример #3
0
        public static void Init(Player player)
        {
            SoundPlayer = new System.Media.SoundPlayer();
            ClickSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.clickDefault);
            ClickSoundPlayer.Load();

            VolumeSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.clickVolume);
            VolumeSoundPlayer.Load();

            VolumeEndOfScaleSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.cyk);
            VolumeEndOfScaleSoundPlayer.Load();

            EndOfListSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.zium);
            EndOfListSoundPlayer.Load();

            Slides = new List<Slide>();
            SlideManager.playerForm = player;
            playerForm.FormClosed += (s, e) =>
            {
                SlideManager.Dispose();
                SoundPlayer.Dispose();
                ClickSoundPlayer.Dispose();
                VolumeSoundPlayer.Dispose();
            };
            LoadSlidesDefinitions();
        }
Пример #4
0
 public MainForm() {
     InitializeComponent();
     pa.KeyPressEvent += Pa_KeyPressEvent;
     pa.Start();
     player = new System.Media.SoundPlayer(@"Resources\1.wav");
     player.Load();
 }
 public Winner2()
 {
     InitializeComponent();
     System.Media.SoundPlayer timeclap = new System.Media.SoundPlayer();
     timeclap.Stream = Properties.Resources.Clap;
     timeclap.Load();
     timeclap.Play();
 }
Пример #6
0
 void playmusic()
 {
     if(Properties.Settings.music_on)
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer(new MemoryStream(Properties.Resources.frametraxx_Manga_Action));
         frm_options.music_playing = Properties.Settings.music_on;
         player.Load();
         player.Play();
     }
 }
Пример #7
0
 public void PlaySoundFile(string pathToFile)
 {
     if (File.Exists(pathToFile))
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer();
         player.SoundLocation = pathToFile;
         player.Load();
         player.Play();
     }
 }
Пример #8
0
        public iWav(string archivo, IPluginHost pluginHost)
        {
            InitializeComponent();
            this.pluginHost = pluginHost;
            ReadLanguage();

            FileStream fs = new FileStream(archivo, FileMode.Open);
            snd = new System.Media.SoundPlayer(fs);
            snd.Load();
            fs.Close();
            fs.Dispose();

            btnPlay.PerformClick();
        }
Пример #9
0
 private void button_skillpoint_buy_Click(object sender, EventArgs e)
 {
     if (money_int < 1500)
     {
         MessageBox.Show("你没有足够的金钱购买 =_=ll", "没钱滚蛋!:P");
     }
     else
     {
         money_int                     -= 1500;
         label_money_shop.Text          = "money:" + money_int.ToString();
         label_point.Text               = (point_int + 7).ToString();
         point_int                      = Convert.ToInt32(label_point.Text.ToString());
         label_skillpoint_num_shop.Text = "已有:" + point_int.ToString();
         System.Media.SoundPlayer sound_healthbottle_buy = new System.Media.SoundPlayer();
         sound_healthbottle_buy.SoundLocation = "buy.wav";
         sound_healthbottle_buy.Load();
         sound_healthbottle_buy.Play();
     }
 }
Пример #10
0
 private void btnG_Click(object sender, EventArgs e)
 {
     if (radioButton1.Checked)
     {
         Console.Beep(400, 500);
     }
     if (radioButton2.Checked)
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.G);
         player.Load();
         player.PlaySync();
     }
     if (radioButton3.Checked)
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.G_Drum);
         player.Load();
         player.PlaySync();
     }
 }
Пример #11
0
 public Form1()
 {
     InitializeComponent();
     block_type      = (uint)rander.Next(0, 7) + 1;
     block_type_pre  = block_type;
     block_type_next = block_type;
     for (int i = 0; i < 20; i++)
     {
         for (int j = 0; j < 10; j++)
         {
             grids[i, j]             = new Label();
             grids[i, j].Width       = 30;
             grids[i, j].Height      = 30;
             grids[i, j].BorderStyle = BorderStyle.FixedSingle;
             grids[i, j].BackColor   = Color.Black;
             grids[i, j].Left        = 30 + 30 * j;
             grids[i, j].Top         = 600 - i * 30;
             grids[i, j].Visible     = true;
             this.Controls.Add(grids[i, j]);
         }
     }
     for (int i = 0; i < 4; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             next[i, j]             = new Label();
             next[i, j].Width       = 20;
             next[i, j].Height      = 20;
             next[i, j].BorderStyle = BorderStyle.None;
             next[i, j].BackColor   = Color.White;
             next[i, j].Left        = 350 + 20 * j;
             next[i, j].Top         = 150 - i * 20;
             next[i, j].Visible     = true;
             this.Controls.Add(next[i, j]);
         }
     }
     init_game();
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = "Tetris.wav";
     player.Load();
     player.PlayLooping();
 }
Пример #12
0
        private void PlaySound()
        {
            try
            {
                if (IsClear)
                {
                    player.SoundLocation = Properties.Settings.Default.AllClearSoundFile;
                }
                else
                {
                    player.SoundLocation = Properties.Settings.Default.AlertSoundFile;
                }

                if (File.Exists(player.SoundLocation))
                {
                    player.Load();
                    player.Play();
                }
                if (!IsClear)
                {
                    //subred.publish(tbSysName.Text + " vertical=" + redV);
                    var msg = new Message();
                    msg.Redcount   = RedCount;
                    msg.SystemText = tbSystemName.Text;
                    //msg.System = TitleImage;
                    var rth = listRedTopHeight.FirstOrDefault();
                    if (rth != null)
                    {
                        msg.FirstRed = sc.CaptureRed(VRec, rth);
                    }
                    subred.publish(msg);
                }
                if (subred != null && IsClear)
                {
                    subred.publish(tbSystemName.Text + " Clear ");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " could not find sound file:" + Properties.Settings.Default.AlertSoundFile);
            }
        }
Пример #13
0
 /// <summary>
 /// Handles the Click event of the btnOK control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void btnOK_Click(object sender, EventArgs e)
 {
     using (NeoNoticeWorkEntities entity = new NeoNoticeWorkEntities())
     {
         NoticeLog model = new NoticeLog();
         model.BeginTime  = BeginTime;
         model.EndTime    = EndTime;
         model.CreateTime = DateTime.Now;
         model.Remark     = txtRemark.Text.Trim();
         model.TagID      = (int)cbTags.SelectedValue;
         model.TagName    = cbTags.Text;
         entity.NoticeLog.Add(model);
         entity.SaveChanges();
         this.Close();
         System.Media.SoundPlayer player = new System.Media.SoundPlayer();
         player.SoundLocation = Application.StartupPath + "//sound.wav";
         player.Load();
         player.Stop();
     }
 }
Пример #14
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                player.SoundLocation = label1.Text;

                player.Load();

                player.Play();
            }

            catch (InvalidOperationException ee)
            {
                MessageBox.Show(ee.Message);
            }
            catch (NullReferenceException ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Пример #15
0
        public void Initialize()
        {
            _chip8.Initalize();
            //_chip8.LoadGame(@"C:\Users\Hayden\Downloads\myChip8-bin-src\myChip8-bin-src\PONG2.c8");
            _chip8.LoadGame(@"C:\Users\Luke\Downloads\c8games\PONG2.ch8");
            //_chip8.LoadGame(@"C:\Users\Luke\Downloads\c8games\BRIX.ch8");

            _audioStream = GenerateAudio();
            _soundPlayer = new System.Media.SoundPlayer(_audioStream);
            _soundPlayer.Load();

            _bmp  = new DirectBitmap(64, 32);
            _wbmp = new WriteableBitmap(64, 32, 72, 72, System.Windows.Media.PixelFormats.Indexed8, BitmapPalettes.Halftone256);

            _renderImage.Dispatcher.Invoke(new Action(() => {
                _renderImage.Source = _wbmp;
            }));

            _emulatorThread.Start();
            Log.Information("Emulator thread started.");
        }
Пример #16
0
 private void Game_Load(object sender, EventArgs e)
 {
     cards.Add(Card1);
     cards.Add(Card2);
     cards.Add(Card3);
     cards.Add(Card4);
     cards.Add(Card5);
     cards.Add(Card6);
     cards.Add(Card7);
     cards.Add(Card8);
     cards.Add(Card9);
     cards.Add(Card10);
     cards.Add(Card11);
     cards.Add(Card12);
     cards.Add(Card13);
     cards.Add(Card14);
     cards.Add(Card15);
     cards.Add(Card16);
     player.SoundLocation = (Path.GetDirectoryName(Environment.CurrentDirectory) + @"\..\..\images\matchCheer.wav");
     player.Load();
 }
Пример #17
0
        public static void Main(string[] args)
        {
            string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly ().Location);
            try{
                player = new System.Media.SoundPlayer (System.IO.Path.Combine (dir, "sound.wav"));
                player.Load();
            }
            catch(Exception ex){player = null;}
            run = true;
            string username;
            Console.Write ("Username:");
            username = Console.ReadLine ();

            session = new LiveCodingChat.Livecoding.LivecodingSession (ReadLoginMethod(),username);
            session.PasswordRequested += Session_PasswordRequested;
            session.SessionAutenticated += Session_SessionAutenticated;
            session.EnsureAuthenticated ();
            while (run) {//TODO: wird eine gui anwendung :P
                System.Threading.Thread.Sleep (10);
            }
        }
Пример #18
0
        private void btnVoz_Click(object sender, RoutedEventArgs e)
        {
            //Console.WriteLine("Ripio el 2");
            reconocimiento_de_voz2.RecognizeAsyncCancel(); //Detiene la escucha
            System.Media.SoundPlayer s = new System.Media.SoundPlayer();
            string dirpath             = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "SoundEffect.wav");

            Console.WriteLine(dirpath);
            s.SoundLocation = dirpath;
            //s.SoundLocation = "C:\\Users\\mario\\source\\repos\\SAAC_BOTllenodebugs\\SAAC_BOT\\SAAC_BOT\\SoundEffect.wav";
            s.Load();
            s.Play();
            //Inicia la escucha con el dispositivo de entrada de audio predeterminado
            //Console.WriteLine("Inicio el 2");
            reconocimiento_de_voz2.SetInputToDefaultAudioDevice();       // Usaremos el microfono predeterminado del sistema
            //reconocimiento_de_voz.LoadGrammar(new DictationGrammar());
            reconocimiento_de_voz2.LoadGrammar(CreateGrammarFromFile()); //Carga la gramatica de Windows
            reconocimiento_de_voz2.SpeechRecognized += te_escucho2;      // Controlador de eventos. Se ejecutara al reconocer
            reconocimiento_de_voz2.RecognizeAsync(RecognizeMode.Single); //Iniciamos reconocimiento
            //txtConversacionVoz.Text = "Estoy Escuchando...";
            synth.SetOutputToDefaultAudioDevice();
        }
Пример #19
0
        private void realTime_Tick(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = DateTime.Now.ToString("ddd, dd MMMM yyyy HH:mm:ss");



            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                DataGridViewCheckBoxCell chk = row.Cells[0] as DataGridViewCheckBoxCell;
                bool   alarmStatus           = Convert.ToBoolean(chk.Value);
                string time = row.Cells[1].Value.ToString();
                string date = row.Cells[2].Value.ToString();



                if (alarmStatus &&
                    time == DateTime.Now.ToString("HH:mm:ss") &&
                    date == DateTime.Now.ToString("dd MMMM yyyy"))
                {
                    row.Cells[0].Value = false;

                    if (File.Exists(row.Cells["soundPath"].ToString()))
                    {
                        System.Media.SoundPlayer player = new System.Media.SoundPlayer(row.Cells[4].Value.ToString());
                        player.Load();
                        player.Play();
                        DialogResult result = MessageBox.Show(this, row.Cells[3].Value.ToString(), "Будильник прокнул", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (result == DialogResult.OK)
                        {
                            player.Stop();
                        }
                    }
                    else
                    {
                        MessageBox.Show(this, row.Cells[3].Value.ToString(), "Будильник прокнул", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Пример #20
0
 public void PlaySuccessSound()
 {
     if (App.Settings.PlaySuccessSound)
     {
         try
         {
             if (successSound == null)
             {
                 string soundFile = Path.Combine(App.AppDir, "Success.wav");
                 if (File.Exists(soundFile))
                 {
                     successSound = new System.Media.SoundPlayer(soundFile);
                     successSound.Load();
                 }
             }
             successSound?.Play();
         }
         catch
         {
         }
     }
 }
Пример #21
0
 public async void PlaySound()
 {
     try
     {
         using (var player =
                    new System.Media.SoundPlayer(CurrencyExchangeKiosk.Properties.Resources.button_click_007))
         {
             await Task.Run(() =>
             {
                 player.Load();
                 player.PlaySync();
             });
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
     finally
     {
     }
 }
Пример #22
0
        public void Pop(NotificationInfo Ni)
        {
            ni = Ni;

            if (ni.Right)
            {
                NotificationHolder.Margin = new Thickness {
                    Left = 220, Top = 0, Right = 0, Bottom = 0
                };
                Left = SystemParameters.FullPrimaryScreenWidth - 200;
                StartingThickness = 200;
                EndThickness      = 0;
            }
            else
            {
                NotificationHolder.Margin = new Thickness {
                    Left = -200, Top = 0, Right = 0, Bottom = 0
                };
                Left = 0;
                StartingThickness = -200;
                EndThickness      = 0;
            }

            this.Dispatcher.Invoke(() =>
            {
                ThicknessAnimationUsingKeyFrames open = new ThicknessAnimationUsingKeyFrames();
                open.KeyFrames.Add(new SplineThicknessKeyFrame(new Thickness(EndThickness), TimeSpan.FromMilliseconds(300), new KeySpline(.5, 0, .3, 1)));
                NotificationHolder.BeginAnimation(Grid.MarginProperty, open);
                if (TCTData.Settings.NotificationSound)
                {
                    if (ni.Sound)
                    {
                        System.Media.SoundPlayer sp = new System.Media.SoundPlayer(Environment.CurrentDirectory + "\\content\\served.wav");
                        sp.Load();
                        sp.Play();
                    }
                }
            });
        }
Пример #23
0
        private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //message box asks user if they are sure they want to logout
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to logout? If you click OK you will be logged out.", "Logout", MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.OK)
            {
                this.Hide();

                System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                player.SoundLocation = @"\\Mac\Home\Desktop\GUI Rubberducks\bye.wav";
                player.Load();
                player.Play();

                EmployeeLoginForm login = new EmployeeLoginForm();
                login.Show();
            }
            if (dialogResult == DialogResult.Cancel)
            {
                //nothing -- user doesn't logout
            }
        }
Пример #24
0
		public static void Main(string[] args)
		{
			string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly ().Location);
			try{
				player = new System.Media.SoundPlayer (System.IO.Path.Combine (dir, "sound.wav"));
				player.Load();
			}
			catch(Exception ex){player = null;}
			run = true;
			string username;
			Console.Write ("Username:");
			username = Console.ReadLine ();



			session = new LiveCodingChat.Livecoding.LivecodingSession (ReadLoginMethod(),username);
			session.PasswordRequested += Session_PasswordRequested;
			session.SessionAutenticated += Session_SessionAutenticated;
			session.EnsureAuthenticated ();
			while (run) {//TODO: wird eine gui anwendung :P
				System.Threading.Thread.Sleep (10);
			}
		}
Пример #25
0
 private void ChatEnable_Click(object sender, RoutedEventArgs e)
 {
     if (ChatEnable.IsChecked == false)
     {
         userName = userNameBlock.Text;
         StartWork();
         if (music)
         {
             System.Media.SoundPlayer Audio;
             Audio = new System.Media.SoundPlayer(CSWM.Properties.Resources.connect);
             Audio.Load();
             Audio.Play();
         }
         List <string> _nameList = new List <string>();
         _nameList.Add("All");
         ListOfUsers.ItemsSource   = _nameList;
         ListOfUsers.SelectedIndex = 0;
     }
     else
     {
         Disconnect();
     }
 }
Пример #26
0
 /// <summary>
 /// Determines if there is audio to be played, and plays it through the speakers/headphones and microphone
 /// </summary>
 /// <param name="_keyId">A number 1 - 9 denoting which key was pressed</param>
 public void PlayAudio(int keyId)
 {
     if (HasAudio())
     {
         // play the audio locally, maybe using System.Media.SoundPlayer
         // pipe the audio into the microphone
         System.Media.SoundPlayer player = new System.Media.SoundPlayer();
         player.SoundLocation = audioPath;
         player.Load();
         player.Play();
         _console.WriteLine("Audio played locally");
     }
     else
     {
         _console.WriteLine("Hotkey " + keyId + " has no audio assigned.");
         assignAudio(keyId);
         // get an audio file using OpenFileDialog
         // copy audio file to AppData
         // assign new path to this.audioPath
         // add this new mapping to a config file
         // rename the appropriate label to the audio file name
     }
 }
Пример #27
0
        private void settingsOKButton_Click(object sender, EventArgs e)
        {
            this.Hide();

            alarmSound = SoundFilenameTextBox.Text;
            if (alarmSound.Length > 0)
            {
                player.SoundLocation = alarmSound;
                player.Load();
            }

            alarmMessage = MessageTextBox.Text;

            alarmEnabled = AlarmEnabledCheckBox.Checked;
            EnabledToolStripMenuItem.Checked = alarmEnabled;

            if (alarmEnabled)
            {
                alarmTime = AlarmDateTimePicker.Value;
                RolloverTime();
            }

            AlarmTimer.Enabled = alarmEnabled;
        }
Пример #28
0
        public static void Main(string[] args)
        {
            string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);

            try
            {
                player = new System.Media.SoundPlayer(System.IO.Path.Combine(dir, "sound.wav"));
                player.Load();
            }
            catch (Exception) { player = null; }
            run = true;

            ILoginMethod loginMethod = ReadLoginMethod();
            string       username    = ReadUsername();

            session = new LiveCodingChat.Livecoding.LivecodingSession(loginMethod, username);
            session.PasswordRequested   += Session_PasswordRequested;
            session.SessionAutenticated += Session_SessionAutenticated;
            session.EnsureAuthenticated();
            while (run)
            {
                System.Threading.Thread.Sleep(10);
            }
        }
Пример #29
0
        internal void ValidateSounds(IEnumerable <string> soundPaths, HashSet <string> badSounds)
        {
            UpdateStatusText(@"Validating Sounds");
            var player = new System.Media.SoundPlayer();

            foreach (var path in soundPaths)
            {
                try
                {
                    player.SoundLocation = ExternalGameDataPath + path;
                    player.Load();
                }
                catch (Exception e) //HIGH: Find out what exception invalid sound files throw and filter
                {
                    Debug.WriteLine(e);
                    badSounds.Add(ExternalGameDataPath + path);
                }
                finally
                {
                    player.Stop();
                    FileValidated();
                }
            }
        }
Пример #30
0
 public void LoseLife()
 {
     Console.WriteLine($"Oof! That was an Invincible Bird Hunter! Wait until you have a stopper.");
     System.Media.SoundPlayer sound =
         new System.Media.SoundPlayer();
     sound.SoundLocation = @"\Drofsnar\pacman_death.wav";
     sound.Load();
     sound.Play();
     _hunterCount = 0;
     _lives      -= 1;
     if (_lives == 0)
     {
         Console.WriteLine("Game Over dude");
     }
     else if (_lives == 1)
     {
         Console.WriteLine("Only 1 life left! Make it count");
     }
     else
     {
         Console.WriteLine($"{_lives} lives remaining");
     }
     Thread.Sleep(3000);
 }
Пример #31
0
        public void GetPoints(IPoints creature)
        {
            _score   += creature.Value;
            _elScore += creature.Value;

            if (creature.Name == "Bird")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine($"You have saved a {creature.Name}");
                Console.WriteLine($"+{creature.Value} points");
                System.Media.SoundPlayer sound =
                    new System.Media.SoundPlayer();
                sound.SoundLocation = @"\Drofsnar\munch_1.wav";
                sound.LoadAsync();
                sound.Play();
                Thread.Sleep(250);
                System.Media.SoundPlayer sound2 =
                    new System.Media.SoundPlayer();
                sound2.SoundLocation = @"\Drofsnar\munch_2.wav";
                sound2.LoadAsync();
                sound2.Play();
                Thread.Sleep(200);
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine($"You have saved a {creature.Name}");
                Console.WriteLine($"+{creature.Value} points");
                System.Media.SoundPlayer sound =
                    new System.Media.SoundPlayer();
                sound.SoundLocation = @"\Drofsnar\Pacman_Eating_Cherry_Sound_Effect.wav";
                sound.Load();
                sound.Play();
                Thread.Sleep(500);
            }
        }
Пример #32
0
        static void Main(string[] args)
        {
            Random random = new Random();
            byte   randomnumber;

            //makes a random table
            byte[,] minuet = new byte[29, 6];
            for (int i = 0; i < 29; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    minuet[i, j] = Convert.ToByte(random.Next(1, 176));
                }
            }

            //makes the address to the sounds
            string[] files = new string[29];
            for (int i = 0; i < files.Length; i++)
            {
                randomnumber = Convert.ToByte(random.Next(0, 6));
                files[i]     = @"C:\Mozart Sound Files\M-Files\" + minuet[i, randomnumber] + ".wav";
            }

            Console.Read();

            //plays the sounds
            System.Media.SoundPlayer sp = new System.Media.SoundPlayer();
            foreach (string musicelement in files)
            {
                sp.SoundLocation = musicelement;
                Console.WriteLine(musicelement);
                sp.Load();
                sp.PlaySync();
            }
            Console.Read();
        }
Пример #33
0
        public void notifySound()
        {
            if ((string)Config.options.GetValue("Sound", "True") != "True")
                return;

            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = Config.soundPath;
            player.Load();
            player.Play();
        }
Пример #34
0
        private void btProximo_Click(object sender, EventArgs e)//casos

        {
            timerOuvir.Start();
            contadorGeral++;//cada vez que clica adiciona 1
            var x      = contadorGeral;
            var result = Convert.ToString(x);

            btOuvir.Enabled    = true;
            btFalar.Enabled    = true;
            btEscrever.Enabled = true;
            lbPagina.Text      = result;
            timerOuvir.Enabled = true;
            lbPagina.Visible   = true;
            lblGravando.Text   = "";
            btFalar.Text       = "Falar";
            btEscrever.Text    = "Escrever";

            switch (contadorCasos)

            {
            case 0:
                num = 0;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.rice;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 1:
                num = 1;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.beam;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 2:
                num = 2;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.salad;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 3:
                num = 3;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.egg;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 4:
                num = 4;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.pork;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 5:
                num = 5;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.chickem;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 6:
                num = 6;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.sausage;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 7:
                num = 7;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.fish;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 8:
                num = 8;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.meat;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();

                break;

            case 9:
                num = 9;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.stack;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 10:
                num = 10;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.barbecue;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 11:
                num = 11;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.soup;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 12:
                num = 12;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eats_rice;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 13:
                num = 13;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_beam;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 14:
                num = 14;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_salad;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 15:
                num = 15;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_egg;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 16:
                num = 16;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_pork;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 17:
                num = 17;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_chicken;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 18:
                num = 18;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_sausage;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 19:
                num = 19;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_fish;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 20:
                num = 20;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_meat;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 21:
                num = 21;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_stack;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 22:
                num = 22;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_barbecue;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 23:
                num = 23;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.i_eat_soup;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;
            }
            int quantidadeCasos = 23;

            if (numeroVezes < 3)
            {
                if (contadorCasos <= quantidadeCasos - 1)
                {
                    contadorCasos++;
                }
                else
                {
                    contadorCasos = 0;
                    numeroVezes++;
                }
            }
            else
            {
                textBoxAluno.Visible = false;
                btOuvir.Enabled      = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                lbPagina.Enabled     = false;
                //btProximo.Enabled = false;
                pictureBox1.ClientSize = new Size(510, 382);                                  //tela inteira
                pictureBox1.Image      = Properties.Resources.congratulation;
                txtPt.Text             = "";                                                  //legenda
                txtEn.Text             = "Parabéns!!!. Agora faça os exercícios da apostila"; //legenda inglês
                System.Media.SoundPlayer Tocar = new System.Media.SoundPlayer();              //ativa o áudio
                sd = "audio//congratulations.wav";
                Tocar.SoundLocation = sd;
                Tocar.Load();
                Tocar.Play();
            }
        }
Пример #35
0
 private void soundPlay2()
 {
     try
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer();
         player.SoundLocation = @"C:\DB\Sound\Slide Closed-SoundBible.com-1521580537.wav";
         player.Load();
         player.Play();
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void computerUser()
        {
            Random r = new Random();
            int i = r.Next(1000000);
            i = i % 3;

            if (i == 1 || i == 2)
            {
                for (int j = 0; j < 9; j++)
                    if (btn[j]._opened == true)
                    {
                        makeImage();
                        btn[j]._opened = false;
                        btnArray[j].Content = image32;

                        //sound effect
                        System.Media.SoundPlayer player2 = new System.Media.SoundPlayer();
                        //player2.SoundLocation = @"C:\Users\user\Desktop\ClassVersion3.0\WpfApplication_HitRat\WpfApplication_HitRat\sound effect\player2sound.wav"; //請自行修正檔案路徑
                        player2.Stream = Properties.Resources.hotsound2;
                        try
                        {
                            if (_sound == true)
                            {
                                player2.Load();
                                player2.Play();
                            }
                        }
                        catch (System.IO.FileNotFoundException err)
                        {
                            MessageBox.Show("找不到音效檔 " + err.FileName);
                        }
                        catch (InvalidOperationException err)
                        {
                            MessageBox.Show("播放發生錯誤:" + err.Message);
                        }

                        if (btn[j].tool_start_multiple == true)
                        {
                            you.tool_multiple2 = true;
                            you.timerPenalty.Start();
                            you.effectBtn2.Content = tool_1hit2;

                            makeImage();
                            btn[j].tool_start_multiple = false;
                            btnArray[j].Content = tool_1hit2;
                        }
                        else if (btn[j].tool_start_freeze == true)
                        {
                            you.tool_freeze2 = true;
                            you.timerPenalty.Start();
                            you.effectBtn2.Content = tool_2hit2;

                            makeImage();
                            btn[j].tool_start_freeze = false;
                            btnArray[j].Content = tool_2hit2;
                        }
                        else if (btn[j].tool_start_king == true)
                        {
                            you.getKingAndShowScore2();

                            btn[j].tool_start_king = false;
                            btnArray[j].Content = tool_3hit2;
                        }
                        else if (btn[j].tool_start_sting == true)
                        {
                        }
                        else
                        {
                            you.getAndShowScore2();
                        }

                    }
            }
        }
Пример #37
0
        private void Program_Board()
        {
            dos_box.Clear();

            System.Media.SoundPlayer newplayer = new System.Media.SoundPlayer();
            string newsound = ".\\Windows Notify.wav";

            newplayer.SoundLocation = newsound;
            newplayer.Load();
            newplayer.Play();

            ProcessStartInfo psi = new ProcessStartInfo(@"cmd");

            psi.UseShellExecute        = false;
            psi.RedirectStandardOutput = true;
            psi.CreateNoWindow         = true;
            psi.RedirectStandardInput  = true;
            string text_dos = "";

            //Download del Firmware
            codice_fw_fulltmppath = DownloadFirmware(codice_fw);

            //Interrogazione interfaccia
            try
            {
                var proc = Process.Start(psi);

                // Setting "DEBUG MODE"
                proc.StandardInput.WriteLine(Properties.Settings.Default.Path_URL_Commander + @"\commander.exe adapter dbgmode OUT");

                // La riga sottostante è da verificare
                proc.StandardInput.WriteLine(Properties.Settings.Default.Path_URL_Commander + @"\commander.exe device info " + device);
                proc.StandardInput.WriteLine(Properties.Settings.Default.Path_URL_Commander + @"\commander.exe --version");
                proc.StandardInput.WriteLine("exit");

                text_dos     = proc.StandardOutput.ReadToEnd();
                dos_box.Text = text_dos;
                dos_box.Refresh();

                if (text_dos.Contains("ERROR: Cannot connect to J-Link via USB.") ||
                    text_dos.Contains("ERROR: Could not open J-Link connection."))
                {
                    MessageBox.Show("Interfaccia non collegata correttamente!");
                    dos_box.Clear();
                    dos_box.Refresh();
                    text_dos   = "";
                    Program_OK = false;
                    return;
                }

                dos_box.SelectionStart = dos_box.Text.Length;
                dos_box.ScrollToCaret();
            }
            catch (Exception ex)
            {
            }

            // Ricerca delle informazioni

            //Part Number
            if (text_dos.Contains("Part Number    :"))
            {
                for (int i = 0; i <= dos_box.Lines.Length; i++)
                {
                    if (dos_box.Lines[i].Contains("Part Number    :"))
                    {
                        string linea_PN = dos_box.Lines[i].ToString();
                        lab_PartNumber.Text = linea_PN.Substring(17);
                        break;
                    }
                }
            }

            //Unique ID
            if (text_dos.Contains("Unique ID      :"))
            {
                for (int i = 0; i <= dos_box.Lines.Length; i++)
                {
                    if (dos_box.Lines[i].Contains("Unique ID      :"))
                    {
                        string linea_ID = dos_box.Lines[i].ToString();
                        lab_IDNumber.Text = linea_ID.Substring(17, 16);
                        ser_num_read      = linea_ID.Substring(17, 16);
                        ser_num_write     = ConvertiID(ser_num_read);
                        //ser_num_write = GVar.glob_result_id[0].ToString() + GVar.glob_result_id[1].ToString() + GVar.glob_result_id[2].ToString() + GVar.glob_result_id[3].ToString() +
                        //                lab_IDNumber.Text.Substring(0, 6) + lab_IDNumber.Text.Substring(10, 6);
                        break;
                    }
                }
            }

            //Serial Number
            if (text_dos.Contains("Emulator found with SN="))
            {
                for (int i = 0; i <= dos_box.Lines.Length; i++)
                {
                    if (dos_box.Lines[i].Contains("Emulator found with SN="))
                    {
                        string linea_SN = dos_box.Lines[i].ToString();
                        lab_SN.Text = linea_SN.Substring(23, 9);
                        break;
                    }
                }
            }

            //Inserimento firmware
            try
            {
                var proc = Process.Start(psi);

                string programstring = Properties.Settings.Default.Path_URL_Commander + @"\commander.exe flash " + codice_fw_fulltmppath + " --address 0x0 " + device;
                proc.StandardInput.WriteLine(programstring);
                proc.StandardInput.WriteLine("exit");

                text_dos     = proc.StandardOutput.ReadToEnd();
                dos_box.Text = dos_box.Text + text_dos;
                dos_box.Refresh();

                if (text_dos.Contains("ERROR: Cannot connect to J-Link via USB.") ||
                    text_dos.Contains("ERROR: Could not open J-Link connection."))
                {
                    MessageBox.Show("Interfaccia non collegata correttamente!");
                    dos_box.Clear();
                    dos_box.Refresh();
                    text_dos   = "";
                    Program_OK = false;
                    return;
                }

                dos_box.SelectionStart = dos_box.Text.Length;
                dos_box.ScrollToCaret();
            }
            catch (Exception ex)
            {
            }

            //Verifica
            try
            {
                var proc = Process.Start(psi);

                string verifyprogramstring = Properties.Settings.Default.Path_URL_Commander + @"\commander.exe verify " + codice_fw_fulltmppath + " " + device;
                proc.StandardInput.WriteLine(verifyprogramstring);
                proc.StandardInput.WriteLine("exit");

                text_dos     = proc.StandardOutput.ReadToEnd();
                dos_box.Text = dos_box.Text + text_dos;
                dos_box.Refresh();

                if (text_dos.Contains("DONE"))
                {
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                    string sound = ".\\tada.wav";
                    player.SoundLocation = sound;
                    player.Load();
                    player.Play();
                }
                else
                {
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                    string sound = ".\\Yamaha.wav";
                    player.SoundLocation = sound;
                    player.Load();
                    player.Play();
                    Program_OK = false;
                }

                dos_box.SelectionStart = dos_box.Text.Length;
                dos_box.ScrollToCaret();
            }
            catch (Exception ex)
            {
            }

            //Scrittura ID
            try
            {
                string coppia_1 = ID_code.Substring(0, 2);
                string coppia_2 = ID_code.Substring(2, 2);

                var proc = Process.Start(psi);

                //string verifyprogramstring = Properties.Settings.Default.Path_URL_Commander + @"\commander.exe flash --patch 0x0fe00000:0x0068:2" + " " + device;
                string verifyprogramstring = Properties.Settings.Default.Path_URL_Commander + @"\commander.exe flash --patch 0x0fe00000:0x" + coppia_2 + coppia_1 + ":2" + " " + device;
                proc.StandardInput.WriteLine(verifyprogramstring);
                proc.StandardInput.WriteLine("exit");

                text_dos     = proc.StandardOutput.ReadToEnd();
                dos_box.Text = dos_box.Text + text_dos;

                if (text_dos.Contains("DONE"))
                {
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                    string sound = ".\\tada.wav";
                    player.SoundLocation = sound;
                    player.Load();
                    player.Play();
                }
                else
                {
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                    string sound = ".\\Yamaha.wav";
                    player.SoundLocation = sound;
                    player.Load();
                    player.Play();
                    Program_OK = false;
                }

                dos_box.SelectionStart = dos_box.Text.Length;
                dos_box.ScrollToCaret();
            }
            catch (Exception ex)
            {
            }

            but_print_again.Visible = true;

            PrintLabel();
        }
Пример #38
0
 public void SoundPlay()
 {
     if (snd == true)
     {
         if (File.Exists("Bin\\Notify.wav") == false)
             File.WriteAllBytes("Bin\\Notify.wav", MFAT.Properties.Resources.notify_wav);
         System.Media.SoundPlayer player = new System.Media.SoundPlayer();
         player.SoundLocation = Directory.GetCurrentDirectory() + "\\bin\\Notify.wav";
         player.Load();
         player.Play();
     }
 }
Пример #39
0
        private void btProximo_Click_1(object sender, EventArgs e)

        {
            timerOuvir.Start();
            contadorGeral++;//cada vez que clica adiciona 1
            var x      = contadorGeral;
            var result = Convert.ToString(x);

            btOuvir.Enabled    = true;
            btFalar.Enabled    = true;
            btEscrever.Enabled = true;
            lbPagina.Text      = result;
            timerOuvir.Enabled = true;
            lbPagina.Visible   = true;
            lblGravando.Text   = "";
            btFalar.Text       = "Falar";
            btEscrever.Text    = "Escrever";

            switch (contadorCasos)

            {
            case 0:
                num = 0;

                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.knife;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 1:
                num = 1;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.fork;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 2:
                num = 2;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.spoon;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 3:
                num = 3;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.cup;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês

                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 4:
                num = 4;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.dish;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês

                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 5:
                num = 5;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.cut;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês

                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 6:
                num = 6;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.glass;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês

                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 7:
                num = 7;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.bowl;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 8:
                num = 8;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.cup_sugar;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 9:
                num = 9;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.salt;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 10:
                num = 10;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.cup_water;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 11:
                num = 11;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.knife;
                pictureBox2.Image      = Properties.Resources.fork;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês

                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 12:
                num = 12;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.cut_tomatoes;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 13:
                num = 13;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.cup_sugar;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 14:
                num = 14;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.rice_and_bean;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 15:
                num = 15;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.glass__1_;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 16:
                num = 16;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.two;
                pictureBox2.Image      = Properties.Resources.beer;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês

                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 17:
                num = 17;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.eat_orange;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 18:
                num = 18;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.bowl_salad;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 19:
                num = 19;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.dink_iced_tea;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;
            }
            int quantidadeCasos = 19;

            if (numeroVezes < 3)
            {
                if (contadorCasos <= quantidadeCasos - 1)
                {
                    contadorCasos++;
                }
                else
                {
                    contadorCasos = 0;
                    numeroVezes++;
                }
            }
            else
            {
                textBoxAluno.Visible = false;
                btOuvir.Enabled      = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                lbPagina.Enabled     = false;
                //btProximo.Enabled = false;
                pictureBox1.ClientSize = new Size(510, 382);                                  //tela inteira
                pictureBox1.Image      = Properties.Resources.congratulation;
                txtPt.Text             = "";                                                  //legenda
                txtEn.Text             = "Parabéns!!!. Agora faça os exercícios da apostila"; //legenda inglês
                System.Media.SoundPlayer Tocar = new System.Media.SoundPlayer();              //ativa o áudio
                sd = "audio//congratulations.wav";
                Tocar.SoundLocation = sd;
                Tocar.Load();
                Tocar.Play();
            }
        }
Пример #40
0
		}//end TipText

		/// <summary>
		/// 下载完成(需要判断下载完成还是用户手动停止)
		/// </summary>
		public void Finish(object e)
		{
			//非UI线程中执行
			ParaFinish p = (ParaFinish)e;
			TaskInfo task = p.SourceTask;
			ListViewItem item = (ListViewItem)task.UIItem;
			//如果下载成功
			if (p.Successed)
			{
				this.Invoke(new MethodInvoker(() =>
				{
					item.SubItems[GetColumn("Status")].Text = task.Status.ToString();
					item.SubItems[GetColumn("Progress")].Text = @"100.00%"; //下载进度
					item.SubItems[GetColumn("Speed")].Text = ""; //下载速度
				}));

				//视频合并 - 
				if (!Tools.IsRunningOnMono &&
					chkAutoCombine.Checked &&
					task.Settings.ContainsKey("VideoCombine"))
				{
					var arr = task.Settings["VideoCombine"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
					
					if (arr.Length >= 3)
					{
						task.Settings["VideoCombineInProgress"] = "true";
						string output = arr[arr.Length - 1];
						Array.Resize<string>(ref arr, arr.Length - 1);
						var helper = new VideoCombineHelper();
						helper.Combine(arr, output, (o) =>
							{
								this.Invoke(new Action<int>((progress) =>
									{
										item.SubItems[GetColumn("Name")].Text = "正在合并: " + progress.ToString() + "%";
									}), o);
							});
						task.Settings.Remove("VideoCombineInProgress");
					}
				}

				//更新UI
				this.Invoke(new MethodInvoker(() =>
					{
						item.SubItems[GetColumn("Name")].Text = task.Title;
					}));

				//打开文件夹
				if (CoreManager.ConfigManager.Settings.OpenFolderAfterComplete && !Tools.IsRunningOnMono)
					Process.Start(CoreManager.ConfigManager.Settings.SavePath);
				//播放声音
				if (CoreManager.ConfigManager.Settings.PlaySound)
				{
					try
					{
						System.Media.SoundPlayer player = new System.Media.SoundPlayer();
						//优先播放设置文件中的声音(必须是wav格式&忽略大小写)
						if (File.Exists(CoreManager.ConfigManager.Settings.SoundFile) && CoreManager.ConfigManager.Settings.SoundFile.EndsWith(".wav", StringComparison.CurrentCultureIgnoreCase))
						{
							player.SoundLocation = CoreManager.ConfigManager.Settings.SoundFile;
						}
						else
						{
							//然后播放程序目录下的msg.wav文件
							if (File.Exists(Path.Combine(Application.StartupPath, "msg.wav")))
							{
								player.SoundLocation = Path.Combine(Application.StartupPath, "msg.wav");
							}
							else //如果都没有则播放资源文件中的声音文件
							{
								player.Stream = Resources.remind;
							}
						}
						player.Load();
						player.Play();
						player.Dispose();
					}
					catch { }
				}
			}
			else //如果用户取消下载
			{
				if (item != null)
				{
					//更新item
					this.Invoke(new MethodInvoker(() =>
						{
							item.SubItems[GetColumn("Status")].Text = task.Status.ToString();
							item.SubItems[GetColumn("Speed")].Text = ""; //下载速度
						}));
				}
			}
			//移除item
			this.Invoke(new MethodInvoker(() =>
					{
						if (lsv.Items.Contains(item))
							if (!IsMatchCurrentFilter(task))
								lsv.Items.Remove(item);
					}));
		}
Пример #41
0
        private void playSound(string file)
        {
            log.Debug("playsound("+ file +") - Begin");
            if (sound)
            {
                
                var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Res\\Sounds\\" + file + ".wav";
                log.Debug(path.ToString());
                System.Media.SoundPlayer sp = new System.Media.SoundPlayer(path);               
                try
                {
                    sp.Load();
                    sp.Play();
                }
                catch (System.IO.FileNotFoundException exp)
                {

                    log.Debug("File not found ex" + exp.ToString());
                    log.Debug(path.ToString());
                }
            }
            log.Debug("playsound() - End");
        }
Пример #42
0
        public TasksListViewModel(
            [Import] ITasksService tasksService,
            [Import] IBacklogService backlogService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator,
            [Import] IDialogService dialogService,
            [Import] IAuthorizationService authorizationService)
        {
            this.tasksService = tasksService;
                this.backlogService = backlogService;
                this.executor = backgroundExecutor;
                this.aggregator = eventAggregator;
                this.dialogs = dialogService;
                this.authorizator = authorizationService;

            tasksViewSource = new System.Windows.Data.CollectionViewSource();

            tasksViewSource.SortDescriptions.Add(new SortDescription("Task.Priority", ListSortDirection.Descending));
            tasksViewSource.SortDescriptions.Add(new SortDescription("Task.TaskType", ListSortDirection.Descending));
            tasksViewSource.SortDescriptions.Add(new SortDescription("Task.TaskNumber", ListSortDirection.Descending));

            tasksViewSource.Filter += new System.Windows.Data.FilterEventHandler(tasksViewSource_Filter);
            delayFilter = new DelayAction(500, new DelayAction.ActionDelegate(Refresh));

            backlogViewSource = new System.Windows.Data.CollectionViewSource();
            backlogViewSource.SortDescriptions.Add(new SortDescription("SprintNumber", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("OccurrenceConstraint", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("BusinessPriority", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("BacklogItemNumber", ListSortDirection.Ascending));

            clockUpdate = new DelayAction(1000, new DelayAction.ActionDelegate(UpdateClock), false);

            player = new System.Media.SoundPlayer();
            player.Stream = Properties.Resources.whistles;
            player.Load();

            ListMode = ListModes.POST_IT_MODE;

            NewTaskType = (short)TaskTypes.DEVELOPMENT_TASK;

            OnLoadCommand = new DelegateCommand(() => { if (NeedRefresh) LoadData(); });

            ShowDetailWindowCommand = new DelegateCommand<TaskViewModel>(ShowDetail);

            CreateTaskCommand = new DelegateCommand(CanCreateTask, CreateTask);
            CreateEmptyTaskCommand = new DelegateCommand(CanCreateEmptyTask, CreateTask);

            ChangeListModeCommand = new DelegateCommand(ChangeListMode);

            MoveTaskCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(MoveTask);

            ChangeTaskItemCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(ChangeTaskItem);

            ShowJoinDialogCommand = new DelegateCommand(CanJoinProject, ShowJoinDialog);

            StartStopClockCommand = new DelegateCommand(StartStopClock);

            SetNewTaskTypeCommand = new DelegateCommand<Int16>(t => { NewTaskType = t; });

            CopyTasksCommand = new DelegateCommand(CopyTasksToClipboard);
            PasteTasksCommand = new DelegateCommand(PasteTasks);
            SelectAllTasksCommand = new DelegateCommand(SelectAllTasks);

            CloseItemCommand = new DelegateCommand<BacklogItem>(CloseItem);

            AddNewTagCommand = new DelegateCommand(CanAddTags, AddNewTag);
            RemoveTagCommand = new DelegateCommand<TaskTag>(CanAddTags, RemoveTag);
            UpdateTagCommand = new DelegateCommand<TaskTag>(CanAddTags, UpdateTag);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, p => {
                Project = p;
                StopClock();
                OnPropertyChanged("CurrentSprintLabel");
            });

            aggregator.Subscribe<ICollection<MemberProfile>>(ScrumFactoryEvent.ProjectMembersChanged, OnMembersChanged);

            aggregator.Subscribe<ICollection<Role>>(ScrumFactoryEvent.ProjectRolesChanged, OnRolesChanged);
            aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskChanged, OnTaskChanged);

            aggregator.Subscribe(ScrumFactoryEvent.ApplicationWhentForeground, OnAppForeground);

            aggregator.Subscribe<BacklogItem>(ScrumFactoryEvent.ShowTasksForItem, ShowTasksForItem);

            aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, UpdateChangedItems);
            aggregator.Subscribe(ScrumFactoryEvent.SprintsShifted, AskForRefresh);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ProjectStatusChanged, SetReplanItemWhenChanged);

            aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskSelectedChanged, OnTaskSelectedChanged);
        }
Пример #43
0
 //Al hacer click en el boton, iniciamos el juego y volvemos falsos todos los botones.
 private void BotonIniciar_Click(object sender, EventArgs e)
 {
     timer1.Enabled = true;
     abajo = false;
     arriba = false;
     derecha = false;
     izquierda = false;
     BotonIniciar.Enabled = false;
     BotonInstrucciones.Enabled = false;
     BotonPuntuaciones.Enabled = false;
     clearBtn.Enabled = false;
     NombreTxt.Enabled = false;
     BtnAgregar.Enabled = false;
     timer1.Interval = 140;
     System.Media.SoundPlayer SonidoComida = new System.Media.SoundPlayer(Properties.Resources.ComidaChica);
     SonidoComida.Load();
 }
        //start player 1
        private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            Key kPressed;

            if (e.Key == Key.ImeProcessed)
                kPressed = e.ImeProcessedKey;
            else
                kPressed = e.Key;

            Key key = kPressed;
            //     MessageBox.Show(ToString() + key); // show Key
            for (int j = 0; j < 9; j++)
            {
                if ((key == keyPlayer1[j]) && (btn[j]._opened == true))
                {
                    makeImage();
                    btn[j]._opened = false;
                    //btn[j].timerTrigger.Stop();//Don't do this!!!!!!!!!!

                    btnArray[j].Content = image31;

                    //sound effect
                    System.Media.SoundPlayer player1 = new System.Media.SoundPlayer();
                    //player1.SoundLocation = @"C:\Users\user\Desktop\ClassVersion3.0\WpfApplication_HitRat\WpfApplication_HitRat\sound effect\player1sound.wav"; //請自行修正檔案路徑
                    player1.Stream = Properties.Resources.hitsound1;

                    try
                    {
                        if (_sound == true)
                        {
                            player1.Load();
                            player1.Play();
                        }
                    }
                    catch (System.IO.FileNotFoundException err)
                    {
                        MessageBox.Show("找不到音效檔 " + err.FileName);
                    }
                    catch (InvalidOperationException err)
                    {
                        MessageBox.Show("播放發生錯誤:" + err.Message);
                    }

                    if (btn[j].tool_start_multiple == true)
                    {
                        me.tool_multiple1 = true;
                        me.timerPenalty.Start();
                        me.effectBtn1.Content = tool_1hit1;

                        makeImage();
                        btn[j].tool_start_multiple = false;
                        btnArray[j].Content = tool_1hit1;
                    }
                    else if (btn[j].tool_start_freeze == true)
                    {
                        me.tool_freeze1 = true;
                        me.timerPenalty.Start();
                        me.effectBtn1.Content = tool_2hit1;

                        makeImage();
                        btn[j].tool_start_freeze = false;
                        btnArray[j].Content = tool_2hit1;
                    }
                    else if (btn[j].tool_start_king == true)
                    {
                        me.getKingAndShowScore1();

                        btn[j].tool_start_king = false;
                        btnArray[j].Content = tool_3hit1;
                    }
                    else if (btn[j].tool_start_sting == true)
                    {
                        me.loseAndShowScore1();

                        btn[j].tool_start_sting = false;
                        btnArray[j].Content = tool_4hit;

                        System.Media.SoundPlayer hahaha = new System.Media.SoundPlayer();
                        hahaha.Stream = Properties.Resources.hahaha;
                        if (_sound == true)
                        {
                            hahaha.Load();
                            hahaha.Play();
                        }
                    }
                    else
                    {
                        me.getAndShowScore1();
                    }

                }

                if ((key == keyPlayer2_1[j]) && (btn[j]._opened == true) || (key == keyPlayer2_2[j]) && (btn[j]._opened == true))
                {
                    makeImage();
                    btn[j]._opened = false;
                    btnArray[j].Content = image32;

                    //sound effect
                    System.Media.SoundPlayer player2 = new System.Media.SoundPlayer();
                    //player2.SoundLocation = @"C:\Users\user\Desktop\ClassVersion3.0\WpfApplication_HitRat\WpfApplication_HitRat\sound effect\player2sound.wav"; //請自行修正檔案路徑
                    player2.Stream = Properties.Resources.hotsound2;
                    try
                    {
                        if (_sound == true)
                        {
                            player2.Load();
                            player2.Play();
                        }
                    }
                    catch (System.IO.FileNotFoundException err)
                    {
                        MessageBox.Show("找不到音效檔 " + err.FileName);
                    }
                    catch (InvalidOperationException err)
                    {
                        MessageBox.Show("播放發生錯誤:" + err.Message);
                    }

                    if (btn[j].tool_start_multiple == true)
                    {
                        you.tool_multiple2 = true;
                        you.timerPenalty.Start();
                        you.effectBtn2.Content = tool_1hit2;

                        makeImage();
                        btn[j].tool_start_multiple = false;
                        btnArray[j].Content = tool_1hit2;
                    }
                    else if (btn[j].tool_start_freeze == true)
                    {
                        you.tool_freeze2 = true;
                        you.timerPenalty.Start();
                        you.effectBtn2.Content = tool_2hit2;

                        makeImage();
                        btn[j].tool_start_freeze = false;
                        btnArray[j].Content = tool_2hit2;
                    }
                    else if (btn[j].tool_start_king == true)
                    {
                        you.getKingAndShowScore2();

                        btn[j].tool_start_king = false;
                        btnArray[j].Content = tool_3hit2;
                    }
                    else if (btn[j].tool_start_sting == true)
                    {
                        you.loseAndShowScore2();

                        btn[j].tool_start_sting = false;
                        btnArray[j].Content = tool_4hit;

                        System.Media.SoundPlayer hahaha = new System.Media.SoundPlayer();
                        hahaha.Stream = Properties.Resources.hahaha;
                        if (_sound == true)
                        {
                            hahaha.Load();
                            hahaha.Play();
                        }
                    }
                    else
                    {
                        you.getAndShowScore2();
                    }

                }

            }
        }
        private void timerGame_Tick(object sender, EventArgs e)
        {
            timeCountUp--;
            this.timelb.Content = timeCountUp.ToString("Time:" + "000");

            if (timeCountUp < -1)
            {
                resetTimeUp();

                System.Media.SoundPlayer timeUpSiren = new System.Media.SoundPlayer();
                System.Media.SoundPlayer timeclap = new System.Media.SoundPlayer();
                //timeUpSiren.SoundLocation = @"C:\Users\user\Desktop\ClassVersion3.0\WpfApplication_HitRat\WpfApplication_HitRat\sound effect\timeup.wav"; //請自行修正檔案路徑
                timeUpSiren.Stream = Properties.Resources.timeup;
                //  timeUpSiren.Stream = Properties.Resources.Clap;

                if (_sound == true)
                {
                    timeUpSiren.Load();
                    timeUpSiren.Play();

                    if (Player1.score1 > Player2.score2)
                    {

                        MessageBox.Show("Winner is Player 1!");

                        Winner player1 = new Winner();
                        player1.Show();
               //         timeclap.Stream = Properties.Resources.Clap;
             //           timeclap.Load();
             //           timeclap.Play();
                    }
                    else if (Player1.score1 < Player2.score2)
                    {

                        MessageBox.Show("Winner is Player 2 !");
                        Winner2 player2 = new Winner2();
                        player2.Show();

                        //timeclap.Stream = Properties.Resources.Clap;
                        //timeclap.Load();
                        //timeclap.Play();
                    }
                    else
                    {
                        MessageBox.Show("Game Tie !");
                       TIE tie = new TIE();
                        tie.Show();
                        //timeclap.Stream = Properties.Resources.Clap;
                        //timeclap.Load();
                        //timeclap.Play();
                    }

                }

                WriteTextFile("champion.txt");
            }

            if (Computer == true)
                computerUser();
        }
Пример #46
0
 public void playAlarm()
 {
     System.Media.SoundPlayer player =
       new System.Media.SoundPlayer();
     player.SoundLocation = @"C:\3.wav";
     player.Load();
     player.Play();
 }
Пример #47
0
 /// <summary>
 /// 播放声音
 /// </summary>
 private void playSound()
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.bilibili);
     player.Load();
     player.Play();
 }
Пример #48
0
        private void button1_Click(object sender, EventArgs e)
        {
            //var ba = File.ReadAllBytes(@"C:\Users\Catena\Source\Repos\UNITA\UNITA\bin\Debug\pitch.wav"); // as sample
            var bytes = File.ReadAllBytes(@"C:\Users\Catena\Source\Repos\UNITA\UNITA\Resources\KasaneTeto\te.wav"); // as sample

            PitchShifter.PitchShift(2f, bytes.Length, (long)1024, (long)10, 44100, in_data_l);

            //var soundData = CreateSinWave(44000, 120, TimeSpan.FromSeconds(60), 1d);

            int value = Convert.ToInt32(textBox4.Text);

            Console.WriteLine(bytes);

            using (FileStream fs = new FileStream("pitch.wav", FileMode.Create))
            {
                WaveHeaderWriter.WriteHeader(fs, bytes.Length, 1, 44100);
                fs.Write(bytes, 0, bytes.Length);
                fs.Close();
            }

            System.Media.SoundPlayer player =
                new System.Media.SoundPlayer();
            player.SoundLocation = "pitch.wav";
            player.Load();
            player.Play();
        }
Пример #49
0
 private void PlaySound()
 {
     try
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer(SoundSelection());
         player.Load();
         player.Play();
     }
     catch { }
 }
Пример #50
0
 private void playSound()
 {
     if (sys.IsSoundEnable)
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.bilibili);
         player.Load();
         player.Play();
     }
 }
Пример #51
0
        /// <summary>
        /// 下载完成(需要判断下载完成还是用户手动停止)
        /// </summary>
        public void Finish(object e)
        {
            //如果需要在安全的线程上下文中执行
            if (this.InvokeRequired)
            {
                this.Invoke(new AcTaskDelegate(Finish), e);
                return;
            }

            ParaFinish p = (ParaFinish)e;
            TaskInfo task = p.SourceTask;
            ListViewItem item = (ListViewItem)task.UIItem;

            //设置完成时间
            task.FinishTime = DateTime.Now;

            //如果下载成功
            if (p.Successed)
            {
                //更新item
                item.SubItems[GetColumn("Status")].Text = task.Status.ToString();
                item.SubItems[GetColumn("Name")].Text = task.Title;
                item.SubItems[GetColumn("Progress")].Text = @"100%"; //下载进度
                item.SubItems[GetColumn("Speed")].Text = ""; //下载速度
                //打开文件夹
                if (Config.setting.OpenFolderAfterComplete)
                    Process.Start(Config.setting.SavePath);
                //播放声音
                if (Config.setting.PlaySound)
                {
                    try
                    {
                        System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                        //优先播放设置文件中的声音(必须是wav格式&忽略大小写)
                        if (File.Exists(Config.setting.SoundFile) && Config.setting.SoundFile.EndsWith(".wav", StringComparison.CurrentCultureIgnoreCase))
                        {
                            player.SoundLocation = Config.setting.SoundFile;
                        }
                        else
                        {
                            //然后播放程序目录下的msg.wav文件
                            if (File.Exists(Path.Combine(Application.StartupPath, "msg.wav")))
                            {
                                player.SoundLocation = Path.Combine(Application.StartupPath, "msg.wav");
                            }
                            else //如果都没有则播放资源文件中的声音文件
                            {
                                player.Stream = Resources.remind;
                            }
                        }
                        player.Load();
                        player.Play();
                        player.Dispose();
                    }
                    catch { }
                }
            }
            else //如果用户取消下载
            {
                if (item != null)
                {
                    //更新item
                    item.SubItems[GetColumn("Status")].Text = task.Status.ToString();
                    item.SubItems[GetColumn("Speed")].Text = ""; //下载速度
                }
            }
            //移除item
            if (lsv.Items.Contains(item))
                if (!IsMatchCurrentFilter(task))
                    lsv.Items.Remove(item);

            //继续下一任务或关机
            ProcessNext();
        }
Пример #52
0
 private void Reiniciar()
 {
     //Mandamos a llamar el sonido
     System.Media.SoundPlayer SonidoComida = new System.Media.SoundPlayer(Properties.Resources.Perder);
     SonidoComida.Load();
     SonidoComida.Play();
     //Cuando tocas haces colision, el timer pasa a false y mostramos el msj
     timer1.Enabled = false;
     MessageBox.Show("Perdiste. \nTu Puntuacion es " + puntuacion);
     //Agregamos la puntuacion
     /*Puntuacion.Add(puntuacion);*/
     player.Puntos = puntuacion;
     //Volvemos a cero las puntuaciones
     BarraPuntuacionSerpiente.Text = "0";
     puntuacion = 0;
     //Volvemos a cero los niveles
     BarraDeNivel.Text = "0";
     //Reiniciamos el timer de la velocidad
     timer1.Interval = 140;
     //Modificamos los botones, cuadros de texto y labels, para que se presentar como uno quiere
     BotonIniciar.Enabled = false;
     BotonInstrucciones.Enabled = true;
     BotonPuntuaciones.Enabled = true;
     clearBtn.Enabled = true;
     NombreTxt.Visible = true;
     BtnAgregar.Visible = true;
     LblIngresa.Visible = true;
     NombreTxt.Enabled = true;
     BtnAgregar.Enabled = true;
     //Iniciamos el nuevo juego
     serpiente = new Serpiente();
 }
Пример #53
0
 public void alarm()
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.mtl);
     player.Load();
     player.PlayLooping();
 }
Пример #54
0
        private void btProximo_Click_1(object sender, EventArgs e)

        {
            c = 0;
            timerOuvir.Start();
            contadorGeral++;//cada vez que clica adiciona 1
            var x      = contadorGeral;
            var result = Convert.ToString(x);

            btOuvir.Enabled      = true;
            btFalar.Enabled      = true;
            btEscrever.Enabled   = true;
            lbPagina.Text        = result;
            timerOuvir.Enabled   = true;
            lbPagina.Visible     = true;
            lblGravando.Text     = "";
            btFalar.Text         = "Falar";
            btEscrever.Text      = "Escrever";
            textBoxAluno.Text    = "";
            textBoxAluno.Visible = false;



            switch (contadorCasos)

            {
            case 0:
                num = 0;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.january;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();

                break;


            case 1:
                num = 1;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.february;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 2:
                num = 2;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.march;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 3:
                num = 3;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.april;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 4:
                num = 4;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.may;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 5:
                num = 5;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.june;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;



            case 6:
                num = 6;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.july;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 7:
                num = 7;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.august;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 8:
                num = 8;
                textBoxAluno.Text    = "";
                textBoxAluno.Visible = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                btProximo.Enabled    = false;
                pictureBox1.Image    = Properties.Resources.september;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 9:
                num = 9;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.october;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 10:
                num = 10;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.november;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();

                break;

            case 11:
                num = 11;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox1.ClientSize = new Size(510, 382); //tela inteira
                pictureBox1.Image      = Properties.Resources.december;
                sd         = listaAudio[num];                //audio
                txtPt.Text = listaPortugues[num];            //legenda
                txtEn.Text = listaIngles[num];               //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 12:
                num = 12;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.january;
                pictureBox2.Image      = Properties.Resources.happy_new_year;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();

                break;

            case 13:
                num = 13;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.february;
                pictureBox2.Image      = Properties.Resources.carnaval;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;


            case 14:
                num = 14;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.april;
                pictureBox2.Image      = Properties.Resources.happy_easter;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();

                break;

            case 15:
                num = 15;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.june;
                pictureBox2.Image      = Properties.Resources.valentines_day;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();

                break;

            case 16:
                num = 16;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.december;
                pictureBox2.Image      = Properties.Resources.natal;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 17:
                num = 17;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.july;
                pictureBox2.Image      = Properties.Resources.independence_day;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;

            case 18:
                num = 18;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.october;
                pictureBox2.Image      = Properties.Resources.halowen;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();

                break;

            case 19:
                num = 19;
                textBoxAluno.Text      = "";
                textBoxAluno.Visible   = false;
                btEscrever.Enabled     = false;
                btFalar.Enabled        = false;
                btProximo.Enabled      = false;
                pictureBox2.Visible    = true;
                pictureBox1.ClientSize = new Size(255, 382);    //metade da tela
                pictureBox1.Image      = Properties.Resources.november;
                pictureBox2.Image      = Properties.Resources.thanksgiving;
                sd         = listaAudio[num];     //audio
                txtPt.Text = listaPortugues[num]; //legenda
                txtEn.Text = listaIngles[num];    //legenda inglês
                timerFalar.Stop();
                timerEscrever.Stop();
                textBoxAluno.Focus();
                break;
            }
            int quantidadeCasos = 19;

            if (numeroVezes < 3)
            {
                if (contadorCasos <= quantidadeCasos - 1)
                {
                    contadorCasos++;
                }
                else
                {
                    contadorCasos = 0;
                    numeroVezes++;
                }
            }
            else
            {
                textBoxAluno.Visible = false;
                btOuvir.Enabled      = false;
                btEscrever.Enabled   = false;
                btFalar.Enabled      = false;
                lbPagina.Enabled     = false;
                //btProximo.Enabled = false;
                pictureBox1.ClientSize = new Size(510, 382);                                  //tela inteira
                pictureBox1.Image      = Properties.Resources.congratulation;
                txtPt.Text             = "";                                                  //legenda
                txtEn.Text             = "Parabéns!!!. Agora faça os exercícios da apostila"; //legenda inglês
                System.Media.SoundPlayer Tocar = new System.Media.SoundPlayer();              //ativa o áudio
                sd = "audio//congratulations.wav";
                Tocar.SoundLocation = sd;
                Tocar.Load();
                Tocar.Play();
            }
        }
Пример #55
0
        private void button1_Click(object sender, EventArgs e)
        {
            //       this.axWindowsMediaPlayer1.URL = this.Text;

            player = new System.Media.SoundPlayer();
            player.SoundLocation = this.Text;
            player.Load();
            player.Play();

            capturebuffer.Start(true);
            if (File.Exists(Path.GetDirectoryName(file) + "//" + Path.GetFileNameWithoutExtension(file) + ".lrc"))
            {
                th = new Thread(new ThreadStart(DisplayLyrics));
                th.Start();
            }

            th2 = new Thread(new ThreadStart(SleepT));
            th2.Start();
             //       LyricTimer();
        }
Пример #56
0
        private void soundPlay()
        {
            try
            {
                System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                player.SoundLocation = @"C:\DB\Sound\sounds-1060-demonstrative.wav";
                player.Load();
                player.Play();
            }
            catch
            {

            }
        }
Пример #57
0
 /// <summary>
 /// 声音
 /// </summary>
 /// <param name="path">声音文件路径</param>
 public static void playSound(string path)
 {
     try
     {
         System.Media.SoundPlayer player = new System.Media.SoundPlayer();
         player.SoundLocation = path;
         player.Load();
         player.Play();
     }
     catch { }
 }
Пример #58
0
 private void btn_confirma_Click(object sender, EventArgs e)
 {
     if(contadorTela == 0)
     {
         votos voto = new votos()
         {
             data_voto = DateTime.Now.Date,
             codigo_candidato = int.Parse(label_numcandDF.Text)
         };
         (new VotarRepositorio()).inserir(voto);
     }
     else if(contadorTela == 1)
     {
         votos voto = new votos()
         {
             data_voto = DateTime.Now.Date,
             codigo_candidato = int.Parse(label_numcandDE.Text)
         };
         (new VotarRepositorio()).inserir(voto);
     }
     else if(contadorTela == 2)
     {
         votos voto = new votos()
         {
             data_voto = DateTime.Now.Date,
             codigo_candidato = int.Parse(label_numcandSE.Text)
         };
         (new VotarRepositorio()).inserir(voto);
     }
     else if(contadorTela == 3)
     {
         votos voto = new votos()
         {
             data_voto = DateTime.Now.Date,
             codigo_candidato = int.Parse(label_numcandSE2.Text)
         };
         (new VotarRepositorio()).inserir(voto);
     }
     else if(contadorTela == 4)
     {
         votos voto = new votos()
         {
             data_voto = DateTime.Now.Date,
             codigo_candidato = int.Parse(label_numcandGO.Text)
         };
         (new VotarRepositorio()).inserir(voto);
     }
     else if(contadorTela == 5)
     {
         votos voto = new votos()
         {
             data_voto = DateTime.Now.Date,
             codigo_candidato = int.Parse(label_numcandPR.Text)
         };
         (new VotarRepositorio()).inserir(voto);
     }
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = "C:/Users/Renat/Documents/Documentos-Renato/Banco de Dados II/Aula12/P_urna_2/confirma.wav";
     player.Load();
     player.Play();
     if(contadorTela < listaPanel.Count - 1)
     {
         listaPanel[++contadorTela].BringToFront();
         if (contadorTela == 1)
         {
             Txt1_de.Focus();
         }
         else if (contadorTela == 2)
         {
             Txt1_se.Focus();
         }
         else if (contadorTela == 3)
         {
             Txt1_se2.Focus();
         }
         else if (contadorTela == 4)
         {
             Txt1_go.Focus();
         }
         else if (contadorTela == 5)
         {
             Txt1_pr.Focus();
         }
         else if(contadorTela == 6)
         {
             player.Play();
         }
     }
     else
     {
         Txt1_df.Text = "";
         Txt2_df.Text = "";
         Txt3_df.Text = "";
         Txt4_df.Text = "";
         Txt1_de.Text = "";
         Txt2_de.Text = "";
         Txt3_de.Text = "";
         Txt4_de.Text = "";
         Txt5_de.Text = "";
         Txt1_se.Text = "";
         Txt2_se.Text = "";
         Txt3_se.Text = "";
         Txt1_se2.Text = "";
         Txt2_se2.Text = "";
         Txt3_se2.Text = "";
         Txt1_go.Text = "";
         Txt2_go.Text = "";
         Txt1_pr.Text = "";
         Txt2_pr.Text = "";
         nome_df.Visible = false;
         nome_de.Visible = false;
         nome_se.Visible = false;
         nome_se2.Visible = false;
         nome_go.Visible = false;
         nome_pr.Visible = false;
         contadorTela = 0;
         listaPanel[contadorTela].BringToFront();
     }
 }
Пример #59
0
        static private bool updatePic(string message, DateTime lastMessage)
        {
            int pos = message.LastIndexOf("!pokedex ") + 9;

            if (pos == 8)
            {
                //Console.Clear();
                Console.WriteLine("Pokemon: " + message + " was not found");
                return(false);
            }
            string newStr = "";

            for (int i = pos; i < message.Length; i++)
            {
                newStr += message[i];
            }

            //DEBUG CONSOLE WRITES//
            //Console.WriteLine(message);
            //Console.WriteLine(newStr);

            string pokdir = newStr.ToUpper();
            //Console.WriteLine(pokdir + "\n\n");
            string sourcePath = Directory.GetCurrentDirectory() + @"\pokemonDir";
            string targetFile = Directory.GetCurrentDirectory() + @"\Pokemon.png";

            //Console.WriteLine(sourceFile);
            int  n;
            bool isInt = int.TryParse(pokdir, out n);

            string[] dc = Directory.GetFiles(sourcePath, $"{pokdir}???.png");

            int    pokP = 0;
            string pokS = "";

            if (isInt == true)
            {
                pokdir = n.ToString("D3");
                string[] dc2 = Directory.GetFiles(sourcePath, $"*{pokdir}.png");
                //Console.WriteLine(pokdir);
                for (int i = 0; i < dc2.Length; ++i)
                {
                    pokdir = dc2[i];
                }
            }

            for (int i = 0; i < dc.Length; ++i)
            {
                pokdir = @dc[i];
            }


            string sourceFile = System.IO.Path.Combine(sourcePath, pokdir);


            if (!System.IO.File.Exists(sourceFile))
            {
                return(false);
            }

            if (!System.IO.File.Exists(targetFile))
            {
                System.IO.File.Create(targetFile);
            }

            System.IO.File.Copy(sourceFile, targetFile, true);
            //Console.Clear();
            //Console.WriteLine("Pok" + '\u00E9' + "dex updated");



            //For .wav files
            pokP = pokdir.IndexOf(".png") - 3;
            for (int i = pokP; i < pokP + 3; i++)
            {
                pokS += pokdir[i];
            }

            //Console.WriteLine(pokS); //Used for debug purposes

            while ((DateTime.Now - lastMessage > TimeSpan.FromSeconds(2)))
            {
            }

            string soundLoc = Directory.GetCurrentDirectory() + @"\pokCry\" + pokS + ".wav";

            if (System.IO.File.Exists(soundLoc))
            {
                System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                player.SoundLocation = soundLoc;
                player.Load();
                player.Play();
                player.Dispose();
            }

            GC.Collect();
            return(true);
        }
Пример #60
0
        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            var station = this.listBox1.Text;

              var stop = this.listBox2.Text;

              BusinessTier.Business bt = new BusinessTier.Business();

              var data = bt.GetSingleStop(stop);

              if (data != null)
              {
            var line = bt.GetLineFromStop(data);
            updateBackgroundColor(line.color);
            if (data.ADA)
            {
              Handicap.ImageLocation = @"Handicap-Light.png";
            }
            else
            {
              Handicap.ImageLocation = @"Handicap-Dark.png";
            }

            updateDirection(data.direction);

            Longitude.Text = Convert.ToString(data.longitude);
            Lattidude.Text = Convert.ToString(data.latitude);
            System.Media.SoundPlayer player =
            new System.Media.SoundPlayer();
            player.SoundLocation = @"Ding.wav";
            player.Load();
            player.Play();
              }
        }