本文整理汇总了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();
}
示例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);
}
示例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("双击恢复音乐播放器!!!");
}
}
示例4: MainMenuSound
public static void MainMenuSound(bool isOn)
{
SoundPlayer player = new SoundPlayer(@"..\..\music\02-overworld.wav");
if (isOn)
{
player.Stop();
}
else
{
player.PlayLooping();
}
}
示例5: InternalStop
private static void InternalStop(SoundPlayer sound)
{
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();
try
{
sound.Stop();
}
finally
{
CodeAccessPermission.RevertAssert();
}
}
示例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();
}
}
示例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();
}
示例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;
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
}
示例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;
}
}
}
示例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);
}
}
示例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";
}
}