当前位置: 首页>>代码示例>>C#>>正文


C# SoundPlayer.Stop方法代码示例

本文整理汇总了C#中System.Media.SoundPlayer.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# SoundPlayer.Stop方法的具体用法?C# SoundPlayer.Stop怎么用?C# SoundPlayer.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Media.SoundPlayer的用法示例。


在下文中一共展示了SoundPlayer.Stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: button1_Click

 // Yoverion Kun's YouTube
 private void button1_Click(object sender, EventArgs e)
 {
     SoundPlayer backgroundSound = new SoundPlayer(Program.ResourcesFolder + "background.mp3");
     backgroundSound.Stop();
     Yov yov = new Yov();
     yov.Show();
 }
开发者ID:Mesagoppinmypants,项目名称:testapplication,代码行数:8,代码来源:MainPage.cs

示例2: Game

        public Game(string mapPath)
        {
            totalPoints = 0;

            totalRounds = 9; //TU ILE MAP MA GRA TRZEBA WPISAC

            typewriter = Constants.getSoundPlayerInstance();
            typewriter.Stop();
            typewriter.SoundLocation = "step.wav";

            isNewLevel = true;

            currentPositionInPauseMenu = 0;

            timerPauseMenu = new Timer(500);
            timerPauseMenu.AutoReset = true;
            timerPauseMenu.Elapsed += (s, e) => pasueMenuTick(e);
            timerPauseMenu.Start();

            heroObject = new Hero();
            boxObject = new Box();
            pointObject = new Point();
            floorObject = new Floor();
            wallObject = new Wall();

            mapNumber = 1;
            writelock = new object();
            initMap(mapPath, true);
        }
开发者ID:zaba37,项目名称:Skokoban_KCK,代码行数:29,代码来源:Game.cs

示例3: button2_Click

 private void button2_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("是否退出?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)==DialogResult.Yes)
     {
         this.panel1.Enabled=false;
         SoundPlayer sp = new SoundPlayer("music.wav");  //播放音乐
         sp.Stop();
         MessageBox.Show("双击恢复音乐播放器!!!");
     }
 }
开发者ID:diceryas,项目名称:csharp,代码行数:10,代码来源:Form1.cs

示例4: MainMenuSound

 public static void MainMenuSound(bool isOn)
 {
     SoundPlayer player = new SoundPlayer(@"..\..\music\02-overworld.wav");
     if (isOn)
     {
         player.Stop();
     }
     else
     {
         player.PlayLooping();
     }
 }
开发者ID:hrturlakov,项目名称:Froggy,代码行数:12,代码来源:Sounds.cs

示例5: InternalStop

 private static void InternalStop(SoundPlayer sound)
 {
     new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();
     try
     {
         sound.Stop();
     }
     finally
     {
         CodeAccessPermission.RevertAssert();
     }
 }
开发者ID:lamp525,项目名称:DotNet,代码行数:12,代码来源:AudioHelper.cs

示例6: GameSound

 public static void GameSound(bool isOn)
 {
     SoundPlayer player = new SoundPlayer(@"../../Sounds/Background Music - DJ Sona Ethereal.wav");
     if (!isOn)
     {
         player.Stop();
     }
     else
     {
         player.PlayLooping();
     }
 }
开发者ID:Roshov,项目名称:Telerik-Software-Academy-,代码行数:12,代码来源:Helper.cs

示例7: Button2_Click

        protected void Button2_Click(object sender, EventArgs e)
        {
            //strängen style tilldelas länk till vald layout
            string style = "<LINK href=\"/1dv406/th222fa/Content/Style.css\" type=\"text/css\" rel=\"stylesheet\">";

            //stylesheetlänken i min masterpage sätts till vald layout
            Literal1.Text = style;
            Page.SetTempData("Layout", Literal1.Text);
            //SoundPlayer sound = new SoundPlayer(@"Content\Crazy.wav");
            string audioFile;
            audioFile = System.IO.Path.Combine(AppDomain.CurrentDomain.GetData("APPBASE").ToString(), @"Content\Crazy.wav");
            SoundPlayer sound = new SoundPlayer(audioFile);
            sound.Stop();
        }
开发者ID:Guepen,项目名称:vt14-3-1-individuellt-arbete,代码行数:14,代码来源:Site.Master.cs

示例8: PlayMusicIntro

        /// <summary>
        /// PlayMusicIntro method that takes boolean if mute option is enabled,
        /// and plays music file if it is not.
        /// </summary>
        /// <param name="playing">boolean true/false</param>
        /// <returns>boolean true/false just for unit testing</returns>        
        public bool PlayMusicIntro(bool playing)
        {
            SoundPlayer sound = new SoundPlayer(Resources.music_intro);

            if (playing == true)
            {
                sound.PlayLooping();
                return true;
            }
            else
            {
                sound.Stop();
                return false;
            }
        }
开发者ID:UgotAlan,项目名称:SET,代码行数:21,代码来源:Sounds.cs

示例9: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            string play_file = power_APP.Properties.Settings.Default.clock_user;

            if (play_file.Contains(".mp3"))
            {
                Form1.wplayer.controls.stop();               
            }
            else
            {
                SoundPlayer myMusic = new SoundPlayer(play_file);
                myMusic.Stop();
            }
            this.Close();
        }
开发者ID:twtrubiks,项目名称:Power-Auto-Shutdown,代码行数:15,代码来源:Timeup.cs

示例10: cb_music_CheckedChanged

 private void cb_music_CheckedChanged(object sender, EventArgs e)
 {
     SoundPlayer backgroundmusic = new SoundPlayer(Properties.Resources.frametraxx_Manga_Action);
     Boolean music_playing = false;
     Properties.Settings.Default.music_on = cb_music.Checked;
     if(Properties.Settings.Default.music_on)
     {
         music_playing = true;
         backgroundmusic.Play();
     }
     else
     {
         music_playing = false;
         backgroundmusic.Stop();
     }
 }
开发者ID:makroground,项目名称:BattleFood,代码行数:16,代码来源:frm_options.cs

示例11: ClickOnCar

 private void ClickOnCar(object sender, EventArgs e)
 {
     pbxVoiture.Location = new Point(iX+=10,300);
     Stream str = Properties.Resources._2jzCarSound;
     SoundPlayer snd = new SoundPlayer(str);
     if(iX >=570)
     {
         snd.Stop();
         MessageBox.Show("eucalyptus");
         pbxVoiture.Enabled = false;
     }
     if(iX==11)
     {
         snd.Play();
     }
 }
开发者ID:RomainCapo,项目名称:enigmos,代码行数:16,代码来源:NfsEnigmaPanel.cs

示例12: checkReminder

 public void checkReminder()
 {
     String date = DateTime.Now.Date.ToShortDateString();
     String time = DateTime.Now.ToShortTimeString();
     for (int i = 0; i < reminderlistarray.Length; i++)
     {
         if (reminderlistarray[i][1].ToString() == date && reminderlistarray[i][2].ToString()==time)
         {
             SoundPlayer simpleSound = new SoundPlayer("laughcute.wav");
             simpleSound.Play();
             if (Convert.ToBoolean(MessageBox.Show("Check out your reminders :D", "Reminder", MessageBoxButton.YesNo)))
             {
                 simpleSound.Stop();
             }
         }
     }
 }
开发者ID:Developer-MN,项目名称:Reminder-plus,代码行数:17,代码来源:MainWindow.xaml.cs

示例13: Ball_Movement_Timer_Tick

        private void Ball_Movement_Timer_Tick(object sender, EventArgs e)
        {
            rtn_Barra.Location = pcb_Paddle.Location;
            if (P1.MovimentoEGestione(ref rtn_Barra, ref Brick, ref Rect, ref VittoriaCont, ref punteggio) == true)
            {
                Ball_Movement_Timer.Stop();
                Ball_Movement_Timer.Enabled = false;
                MessageBox.Show("Hai perso una vita Idiota");
                vite--;
                lbl_Vite.Text = vite.ToString();
                CheckVite();

                pcb_Ball.Location = new Point(160, 360);

                punteggio /= 2;
                MessageBox.Show("Clicca sulla palla per continuare (Non premere 'e'") ;
            }
            else
            { lbl_Point.Text = punteggio.ToString(); }
            if (VittoriaCont == 35)
            {
                Ball_Movement_Timer.Stop();
                if (EE1_1 == true)
                    //EE1.Stop();

                if (!Serial)
                {
                    MessageBox.Show("Vuoi vincere? Compra il DLC presso steam");
                }
                else
                {
                    Stream S1 = Properties.Resources.WinTheme;
                    SoundPlayer SP1 = new SoundPlayer(S1);
                    SP1.Play();
                    MessageBox.Show("Complimenti, hai vinto la partita");
                    SP1.Stop();
                    Ogg.AttivaNewGame(ref Brick, ref pcb_Ball, ref VittoriaCont, ref pnl_Home, ref pcb_Start, ref punteggio, ref lbl_Point, ref pcb_Paddle);
                    pcb_Start.Enabled = true;
                }
            }
        }
开发者ID:TheLegion96,项目名称:SubDimensionalArcanoid,代码行数:41,代码来源:Form1.cs

示例14: GameMusicHandler

        /// <summary>
        /// Method for handleing the music in the game.
        /// </summary>
        /// <param name="ct">Token to cancel the process.</param>
        public void GameMusicHandler()
        {
            Action<Func<bool, bool, bool>, Stream> StartMusic = (func, stream) =>
            {
                sound = new SoundPlayer(stream);
                sound.PlayLooping();

                while (func.Invoke(gamePanelLeft.IsGameOver, gamePanelRight.IsGameOver))
                {
                    Thread.Sleep(100);
                }

                sound.Stop();
            };

            while (!Dispatcher.HasShutdownStarted)
            {
                StartMusic((x, y) => x && y, Properties.Resources.robotic);
                StartMusic((x, y) => !x || !y, Properties.Resources.searching);
            }
        }
开发者ID:Megnus,项目名称:C-Sharp-III_Moment_4,代码行数:25,代码来源:MainWindow.xaml.cs

示例15: Play

        public static void Play(Button sender, string path)
        {
            var button = sender;

            if (!_playing)
            {
                _sp = new SoundPlayer();
                _sp.Stop();
                _sp.SoundLocation = path;
                _sp.LoadAsync();
                _sp.Play();
                _playing = true;
                button.Content = "Stop";
            }
            else
            {
                _sp.Stop();
                _playing = false;
                button.Content = "Play";
            }
        }
开发者ID:KH8,项目名称:AmpIdent,代码行数:21,代码来源:Player.cs


注:本文中的System.Media.SoundPlayer.Stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。