public AboutBox() { InitializeComponent(); loc = label1.Location; label1.Text = ""; try { var rm = new System.Resources.ResourceManager("BizHawk.Client.EmuHawk.Properties.Resources", GetType().Assembly); sfx = new SoundPlayer(rm.GetStream("nothawk")); sfx.Play(); } catch { } //panel1.Size = new System.Drawing.Size(1000, 1000); //pictureBox5.GetType().GetMethod("SetStyle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod).Invoke(pictureBox5, new object[] { ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true }); pictureBox5.BackColor = Color.Transparent; pictureBox5.SendToBack(); pictureBox3.BringToFront(); pictureBox2.BringToFront(); pictureBox1.BringToFront(); pictureBox5.Visible = false; }
private void move(TableLayoutPanelCellPosition newPos) { TableLayoutPanelCellPosition temp = tableLayoutPanel1.GetPositionFromControl(snake[0]); if (newPos == tableLayoutPanel1.GetPositionFromControl(panelF)) { med.SoundPlayer sp = new med.SoundPlayer("add.WAV"); sp.Play(); panelF.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); snake.Add(panelF); putFood(); tableLayoutPanel1.SetCellPosition(snake[0], newPos); movePos(temp); sp.Dispose(); } else if (tableLayoutPanel1.GetControlFromPosition(newPos.Column, newPos.Row) == null) { tableLayoutPanel1.SetCellPosition(snake[0], newPos); movePos(temp); label2.Text = "Started"; } else if (newPos == tableLayoutPanel1.GetPositionFromControl(snake[1])) { GameOver = false; label2.Text = "Paused"; } else { GameOver = true; } labelLen.Text = CountLen(); }
private void button1_Click(object sender, EventArgs e) { ClickSound = new SoundPlayer(spath + label5.Text + "Resources" + label5.Text + "Sound" + label5.Text + "clickSound.wav"); ClickSound.Play(); if (comboBox2.SelectedItem != null) { directoryLabel.Text = sqpath + label5.Text + "Resources" + label5.Text + "logico01.txt"; TextWriter tw = new StreamWriter(directoryLabel.Text); int x = int.Parse(comboBox2.SelectedItem.ToString()); // проверка дали въведения отговор е верен if (x == 11) { tw.WriteLine("3"); // записване в текстовия файл } else { if (x == 20) tw.WriteLine("2"); else if (x == 9) tw.WriteLine("1"); else tw.WriteLine("0"); } MessageBox.Show("Благодаря за вашия отговор."); tw.Close(); Close(); } }
public SE() { p = new SoundPlayer[2]; p[0] = new SoundPlayer("Content/BGM/SE9.wav"); p[1] = new SoundPlayer("Content/BGM/SE13.wav"); }
public certo() { InitializeComponent(); SoundPlayer tocarSom = new SoundPlayer(@"C:\Users\Willian\Desktop\jogo\jogo\imagem\cuco.wav"); tocarSom.Play(); }
public static void Lose() { int rand = World.Rand (0, 1); var file = new FileStream ("lose"+rand+".wav", FileMode.Open, FileAccess.Read, FileShare.Read); player = new SoundPlayer(file); player.Play(); }
// We want to control how depth data gets converted into false-color data // for more intuitive visualization, so we keep 32-bit color frame buffer versions of // these, to be updated whenever we receive and process a 16-bit frame. /*const int RED_IDX = 2; const int GREEN_IDX = 1; const int BLUE_IDX = 0; byte[] depthFrame32 = new byte[320 * 240 * 4];*/ public ExerciseView(Exercise ex) { InitializeComponent(); this.ex = ex; statusText.Text = ex.statusMessage; passSound = new SoundPlayer("Sounds/ExercisePass.wav"); passSound.LoadAsync(); failSound = new SoundPlayer("Sounds/ExerciseFail.wav"); failSound.LoadAsync(); #if DEBUG lastTime = DateTime.Now; fpsLabel = new Label(); fpsLabel.Content = "FPS:"; fpsLabel.FontSize = (double)Application.Current.Resources["SmallButtonFont"]; fpsLabel.HorizontalContentAlignment = HorizontalAlignment.Center; fpsLabel.HorizontalAlignment = HorizontalAlignment.Left; bottomPanel.Children.Insert(0, fpsLabel); #endif #if AUDIOUI SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Stop, selectedResponse); #endif //SharedContent.Nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiDepthFrameReady); SharedContent.Nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nuiSkeletonFrameReady); SharedContent.Nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiColorFrameReady); }
public static void PlayAlarm() { if (player == null) player = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("ReliakTimer.Sounds.ring.wav")); player.Play(); }
public void MissSound() { var myPlayer = new System.Media.SoundPlayer(); myPlayer.SoundLocation = @"..\..\SoundEffects\Wave_Crashing.wav"; myPlayer.Play(); }
public void HitSound() { var myPlayer = new System.Media.SoundPlayer(); myPlayer.SoundLocation = @"..\..\SoundEffects\Hit_Explosion.wav"; myPlayer.Play(); }
public void AircraftCarrier() { var myPlayer = new System.Media.SoundPlayer(); myPlayer.SoundLocation = @"..\..\SoundEffects\Aircraft_Carrier.wav"; myPlayer.Play(); }
public void WinnerSound() { var myPlayer = new System.Media.SoundPlayer(); myPlayer.SoundLocation = @"..\..\SoundEffects\Winner.wav"; myPlayer.Play(); }
public void Resume(int prid) { WinAPI.ResumeProcess(prid); IsSuspend = false; System.Media.SoundPlayer sp2 = new System.Media.SoundPlayer(@"../../stop.wav"); sp2.Play(); }
public void Suspend(int prid) { WinAPI.SuspendProcess(prid); IsSuspend = true; System.Media.SoundPlayer sp2 = new System.Media.SoundPlayer(@"../../start.wav"); sp2.Play(); }
public Form1() { InitializeComponent(); System.Media.SoundPlayer sp = new System.Media.SoundPlayer(); System.Drawing.Text.PrivateFontCollection f = new System.Drawing.Text.PrivateFontCollection(); f.AddFontFile("660_pricedown_rus.ttf"); f.AddFontFile("662_old_english.ttf"); button1.Font = new Font(f.Families[1], 35); button2.Font = new Font(f.Families[1], 35); button3.Font = new Font(f.Families[1], 35); button4.Font = new Font(f.Families[1], 35); button5.Font = new Font(f.Families[1], 35); button6.Font = new Font(f.Families[1], 35); label1.Font = new Font(f.Families[0], 35); if (Desktop.a == true) { sp = new SoundPlayer("sound.wav"); sp.Play(); panel1.Visible = true; progressBar1.Visible = true; timer1.Interval = 350; timer1.Enabled = true; timer1.Tick += timer1_Tick; } }
static void Main(string[] args) { string varURL = ""; SoundPlayer quote = new SoundPlayer(); Random randNum = new Random(); int selectedQuote = (randNum.Next(1, 3)); switch (selectedQuote) { case 1: varURL = "http://www.wavsource.com/snds_2015-09-20_4380281261564803/tv/simpsons/apu/bastard.wav"; break; case 2: varURL = "http://www.wavsource.com/snds_2015-09-20_4380281261564803/tv/simpsons/apu/do_not_listen.wav"; break; case 3: varURL = "http://www.wavsource.com/snds_2015-09-20_4380281261564803/tv/simpsons/apu/hell.wav"; break; default: break; } quote.SoundLocation = varURL; try { quote.Play(); } catch (Exception e) { Console.WriteLine(@"i'm sorry, you are not connected to the internet. please reconnect and try again."); } Console.ReadLine(); }
public static void BeepBeep(int Amplitude, int Frequency, int Duration) { double A = ((Amplitude * (System.Math.Pow(2, 15))) / 1000) - 1; double DeltaFT = 2 * Math.PI * Frequency / 44100.0; int Samples = 441 * Duration / 10; int Bytes = Samples * 4; int[] Hdr = { 0X46464952, 36 + Bytes, 0X45564157, 0X20746D66, 16, 0X20001, 44100, 176400, 0X100004, 0X61746164, Bytes }; using (MemoryStream MS = new MemoryStream(44 + Bytes)) { using (BinaryWriter BW = new BinaryWriter(MS)) { for (int I = 0; I < Hdr.Length; I++) { BW.Write(Hdr[I]); } for (int T = 0; T < Samples; T++) { short Sample = System.Convert.ToInt16(A * Math.Sin(DeltaFT * T)); BW.Write(Sample); BW.Write(Sample); } BW.Flush(); MS.Seek(0, SeekOrigin.Begin); using (SoundPlayer SP = new SoundPlayer(MS)) { SP.PlaySync(); } } } }
/// <summary> /// Plays the main alarm sound: reads in the .wav file and plays it /// </summary> private void Play() { string soundfile = @"C:\Users\benja\Desktop\PA05 (1)\PA05\PA05\Alien_AlarmDrum-KevanGC-893953959.wav"; var sound = new System.Media.SoundPlayer(soundfile); sound.Play(); }
private void finalizado() { if (BWAutodestruccion.CancellationPending == false) { //Se crea una instancia de la clase SoundPlayer //que le pasa como parametro al constructo la ruta del archivo //con la propiedad FileName del OpenFileDialog SoundPlayer player = new SoundPlayer("./explosion-01.wav"); //Llama el metodo Play del SoundPlayer para reproducir el audio,musica,etc player.Play(); BWAutodestruccion.CancelAsync(); try { Process.Start("notepad.exe", "./ficheroMensaje.txt"); } catch (Exception e) { } Thread.Sleep(6500); Application.Exit(); } else { this.Close(); } }
/// <summary> /// Plays the reminder sound: reads in the .wav file and plays it /// </summary> private void Play2() { string soundfile = @"C:\Users\benja\Desktop\PA05 (1)\PA05\PA05\chord.wav"; var sound = new System.Media.SoundPlayer(soundfile); sound.Play(); }
public static void PlayBattleSound() { try { using (SoundPlayer battleSound = new SoundPlayer("..\\..\\Sound\\SoundFiles\\TheBattle.wav")) { battleSound.PlayLooping(); } } catch (FileNotFoundException) { throw new FileNotFoundException(); } catch (DirectoryNotFoundException) { throw new DirectoryNotFoundException("The path to the file is incorrect!"); } catch (IOException) { throw new IOException("Cannot read from file!"); } catch (InvalidOperationException) { throw new InvalidOperationException(); } }
public void Fire(Point startLocation, double direction, float maxDistance, PhotonTimeManager photoTimeManager) { _photonTimeManager = photoTimeManager; if (!EnoughTimeHasPassed()) { return; } _maxDistance = maxDistance; _distanceTraveled = 0; _bulletSprite = new Sprite(); SoundPlayer player = new SoundPlayer(); System.IO.Stream str = Properties.Resources.mySoundFile; System.Media.SoundPlayer snd = new System.Media.SoundPlayer(@"C:\Users\keife\Downloads\Backup-20200818T045439Z-001\Backup\GameObjects\380gunshotsinglemikekoenig.wav"); snd.Play(); _bulletSprite.Polygon = new[] { new Point(startLocation.X, startLocation.Y), new Point(startLocation.X + 1, startLocation.Y + 1), new Point(startLocation.X, startLocation.Y) }; _bulletSprite.Speed = Constants.BulletSpeed; _bulletSprite.TravelDirectionInDegrees = direction; _location = startLocation; _photonTimeManager.SetFired(); }
static void Main(string[] args) { string varURL = ""; SoundPlayer quote = new SoundPlayer(); Random randNum = new Random(); int selectedQuote = (randNum.Next(1, 3)); switch (selectedQuote) { case 1: varURL = "http://www.wavsource.com/snds_2015-08-16_6897529750891327/tv/sharknado/sharknado_afraid.wav"; break; case 2: varURL = "http://www.wavsource.com/snds_2015-08-16_6897529750891327/movies/misc/silence_lambs_dinner.wav"; break; case 3: varURL = "http://www.wavsource.com/snds_2015-08-16_6897529750891327/movies/aladdin/aladdin_cant_believe.wav"; break; default: break; } quote.SoundLocation = varURL; if (quote == null) { } try { quote.Play(); } catch (Exception e) { Console.WriteLine(@"I'm sorry, you are not connected to the internet. Please reconnect and try again."); } Console.ReadLine(); }
public void timer_tick(object sender, EventArgs e) { if (mm >= 0) { if (ss == 0) { ss = 60; mm--; } if (mm == 0 && ss == 1) { SoundPlayer player = new System.Media.SoundPlayer(@"C:\Users\mike5171\source\repos\H2\StopWatch\StopWatch\alarm.wav"); player.Play(); dispatcherTimer.Stop(); } ss--; TimeMinute.Text = mm.ToString(); TimeSecond.Text = ss.ToString(); } else { dispatcherTimer.Stop(); } }
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); }
/// <summary> /// Initializes game, draws cards /// </summary> public void InitiateGame() { pbTrump.Image = Image.FromFile(CardBox.GetImagePathFromCard(durakGame.TrumpCard)); //Load card image pbDeck.Load(CardBox.GetImagePathFromCard()); Refresh(); //Initialize card deck count amount lblDeckCount.Text = durakGame.deck.Count.ToString(); //Play super cool sound //source : https://freesound.org/people/mickmon/sounds/176862/ SoundPlayer dealSound = new System.Media.SoundPlayer(RESOURCES_PATH + "deal.wav"); dealSound.Play(); //Deal cards gameStats.cardsDrawn = gameStats.cardsDrawn + DurakGame.STARTING_CARD_COUNT; for (int i = 0; i < DurakGame.STARTING_CARD_COUNT; i++) { DealCardToPanel(this.pnlPlayerBottom, durakGame.Players[0].Cards[i]); DealCardToPanel(this.pnlPlayerTop, durakGame.Players[1].Cards[i]); Wait(50); } this.txtMessages.Update(); durakGame.TurnAttack(); }
public static void Play(SoundType type) { if (Environment.OSVersion.Platform == PlatformID.Unix) return; if (type != SoundType.None) { Stream sound; switch (type) { case SoundType.Click: sound = Sounds.scificlick; break; case SoundType.Servo: sound = Sounds.panel_move; break; case SoundType.BigClick: sound = Sounds.button_click; break; default: sound = null; break; } if (sound != null) { var sp = new SoundPlayer(sound); sp.Play(); } } }
public void onePing() { System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = Application.StartupPath + "\\tictac.wav"; player.Load(); player.Play(); }
/// <summary> /// Handle a request. /// </summary> /// <param name="pDisplay">The display which called this function.</param> /// <param name="pSurface">The surface which this display is hosted on.</param> /// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param> /// <returns>True if the request was processed sucessfully. False if there was an error.</returns> public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments) { // Check we have a sound file. var sSound = dArguments.GetValueOrDefault("file", ""); if (sSound == null || sSound == "") { Log.Write("Cannot play sound. Are you missing a 'file' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning); return false; } // Attempt to play it. try { SoundPlayer pSound = new SoundPlayer(sSound); pSound.Play(); return true; } // Log warnings. catch (Exception e) { Log.Write("Cannot play sound. " + e.Message, pDisplay.ToString(), Log.Type.DisplayWarning); return false; } }
private void Btn_shoot_Click(object sender, EventArgs e) { //Calling Shoot function from Game class btn_load.Enabled = false; btn_spin.Enabled = false; btn_shoot.Enabled = true; btn_shootaway.Enabled = true; shoot = shoot + 1; if (shoot == sound) { System.Media.SoundPlayer snd = new System.Media.SoundPlayer(Russian_roulette.Properties.Resources.shootsd); snd.Play(); shoot = 0; sound = instace_Bullet.generateFire(); Count_Shoot = Count_Shoot + 1; if (Count_Shoot == 1) { MessageBox.Show("Now this is your 2nd chance to fire again "); } if (Count_Shoot == 2) { MessageBox.Show("Your Both chances are over"); btn_shoot.Enabled = false; } } if (shoot == 6 || shoot == 12) { MessageBox.Show("Your chances are over try again"); } }
private void BT_jogar_Click_1(object sender, EventArgs e) { Form7 objform7 = new Form7(); objform7.Show(); SoundPlayer IniciarPlayer = new SoundPlayer(Properties.Resources.DingDong); IniciarPlayer.Play(); }
private void Button_Click(object sender, RoutedEventArgs e) { System.IO.Stream file_coin = Properties.Resources.coin; System.Media.SoundPlayer ching = new System.Media.SoundPlayer(file_coin); ching.Play(); roll(); }
public FinalWindow() { InitializeComponent(); this.ShowInTaskbar = true; Thread oThread = new Thread(new ThreadStart(this.listen)); oThread.Start(); while (oThread.IsAlive) { Thread.Sleep(50); Application.DoEvents(); } SoundPlayer simpleSound = new SoundPlayer(@"data\sounds\ding.wav"); simpleSound.Play(); string[] fileArray = Directory.GetFiles(@"data\graphs", "*.svg"); foreach (String f in fileArray) { string filenameWithoutPath = Path.GetFileName(f); comboBox1.Items.Add(filenameWithoutPath); } comboBox1.SelectedIndex = 0; }
private void timer_count_Tick(object sender, EventArgs e) { System.Media.SoundPlayer player_1 = new System.Media.SoundPlayer(@"C:\Users\M0015\Desktop\pic\sound\1792.wav"); System.Media.SoundPlayer player_2 = new System.Media.SoundPlayer(@"C:\Users\M0015\Desktop\pic\sound\786.wav"); String str = ts_count_tmp.Hours + ":" + ts_count_tmp.Minutes + ":" + ts_count_tmp.Seconds; label1.Text = str; //label1用来显示剩余的时间 ts_count_tmp = ts_count_tmp.Subtract(new TimeSpan(0, 0, 1)); //每隔一秒减去一秒 if (ts_count_tmp.TotalSeconds < 3.0) //当倒计时剩余3s时 { player_1.Play(); } if (ts_count_tmp.TotalSeconds < 0.0)//当倒计时完毕 { timer1.Enabled = false; player_1.Stop(); player_2.Play(); MessageBox.Show("时间到!");//提示时间到 } }
private void BT_jogar_Click_1(object sender, EventArgs e) { Form7 objform7 = new Form7(); objform7.Show(); SoundPlayer IniciarPlayer = new SoundPlayer(@"G:\Arquivos de música.wav\DingDong.wav"); IniciarPlayer.Play(); }
/// <summary> /// Выполнить команду /// </summary> /// <param name="text">Текст команды</param> public void Execute(string text) { //Получаем коллекцию строк, которые разделены пробелом var strs = text.Split(_separator, _paramsCount + 1, StringSplitOptions.RemoveEmptyEntries); //Проверяем, что для выполнения команды было передано нужно число параметров (не считая имени самой команды) if (strs.Length != _paramsCount + 1) { System.Media.SoundPlayer player = new System.Media.SoundPlayer(@".. \..\Жирик.wav"); player.Play(); WriteError(string.Format("Для выполнения команды требуется {0} параметров", _paramsCount)); return; } var commandName = strs[0]; if (strs.Length > 1) { //Если параметров команды больше одного (т.е. имени команды) //то передаем оставшиеся аргументы ExecuteByParams(strs.Skip(1).ToArray()); } else { //Если передано только название команды, то вызываем его ExecuteByParams(null); } }
internal MainWindow(Archive a) { InitializeComponent(); archive = a; if(!string.IsNullOrWhiteSpace(archive.settings.sound.backgroundSoundLoc)) { main = new SoundPlayer(); main.SoundLocation = archive.settings.sound.backgroundSoundLoc.RelativeTo(Program.ArchivePath(archive)); main.PlayLooping(); } if(!string.IsNullOrWhiteSpace(archive.settings.sound.correctSoundLoc)) { yes = new SoundPlayer(); yes.SoundLocation = archive.settings.sound.correctSoundLoc.RelativeTo(Program.ArchivePath(archive)); yes.LoadAsync(); } if(!string.IsNullOrWhiteSpace(archive.settings.sound.wrongSoundLoc)) { no = new SoundPlayer(); no.SoundLocation = archive.settings.sound.wrongSoundLoc.RelativeTo(Program.ArchivePath(archive)); no.LoadAsync(); } Text = a.name; BackColor = archive.settings.backgroundColor; if(!string.IsNullOrWhiteSpace(archive.settings.backgroundLoc)) { BackgroundImage = archive.settings.background ?? Extensions.LoadImage(Program.ArchivePath(archive), archive.settings.backgroundLoc); } Current = new ModeSelect(); }
private void btnImage16_Click(object sender, RoutedEventArgs e) { image16.Source = (new ImageSourceConverter()).ConvertFromString("pack://application:,,,/imagini/pasare8.png") as ImageSource; if (GetValueFlippedImage1 == null) { GetValueFlippedImage1 = image16; } else if (GetValueFlippedImage1 != null && GetValueFlippedImage2 == null) { GetValueFlippedImage2 = image16; } if (GetValueFlippedImage1 != null && GetValueFlippedImage2 != null) { if (GetValueFlippedImage1.Uid == GetValueFlippedImage2.Uid) { System.IO.Stream str = Properties.Resources.succes; System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str); snd.Play(); btnImage8.IsEnabled = false; btnImage16.IsEnabled = false; GetValueFlippedImage1 = null; GetValueFlippedImage2 = null; } else { flipTime.Start(); } } }
private void Init() { soundplayer = new SoundPlayer { SoundLocation = filename }; soundplayer.Load(); }
/// <summary> /// Constructor /// </summary> public MainWindow() { InitializeComponent(); DataContext = this; BrickNo = 0; YPos1 = "0"; YPos2 = "0"; YPos3 = "0"; Message = ""; brickStateMachine = new BrickStateMachine(0, BrickStateMachine.ProcessState.StateOne06); logWindow = new LogWindow(); Transition = logWindow.Transition; // Load the music and sounds SplayerLoop = new System.Media.SoundPlayer(Properties.Resources.BACKGROUND_LOOP); SplayerGameOver = new System.Media.SoundPlayer(Properties.Resources.GAME_OVER); SplayerJump = new System.Media.SoundPlayer(Properties.Resources.JUMP); // Init dispatcher dispatcherRunningTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherRunningTimer.Tick += new EventHandler(DispatcherTimer); dispatcherRunningTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); }
private void Form1_Load(object sender, EventArgs e) { SoundPlayer alersound = new SoundPlayer(@"D:\University\Anul2\Sem2\IDE\FormAps\LOGINApp\LOGINApp\Stranger.wav"); //Play Sound On Click alersound.PlayLooping(); }
static void Main(string[] args) { SetTimer(); string urlString = @"C:\Users\micha\source\repos\porównywanie\porównywanie\url.txt"; string pageString = @"C: \Users\micha\source\repos\porównywanie\porównywanie\page.txt"; if (File.Exists(@"C:\Users\micha\source\repos\porównywanie\porównywanie\page.txt")) { string urlPath = File.ReadAllText(@"C:\Users\micha\source\repos\porównywanie\porównywanie\url.txt", Encoding.UTF8); string pagePath = File.ReadAllText(@"C:\Users\micha\source\repos\porównywanie\porównywanie\page.txt", Encoding.UTF8); if (urlPath == pagePath) { } else { System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = @"C:\Users\micha\source\repos\porównywanie\porównywanie\x.wav"; player.Play(); } } else { string pathString2 = @"C: \Users\micha\source\repos\porównywanie\porównywanie"; string fileName = "page.txt"; pathString2 = System.IO.Path.Combine(pathString2, fileName); System.IO.File.Create(pathString2); File.Copy(urlString, pageString); } Console.ReadLine(); }
public TimesUp(String sMaMay, String sInfo, String sTimesIn, String sTimesUp, bool bRing) { InitializeComponent(); lbMay.Text = "Máy " + sMaMay; lbInfo.Text = sInfo; lbTimesIn.Text = "Giờ chơi: " + sTimesIn; lbTimesUp.Text = "Giờ nghỉ: " + sTimesUp; setSound(); if (bRing) { try { RingTone = new SoundPlayer(Sound); RingTone.PlayLooping(); } catch { // } timerRing.Enabled = true; } }
private static void OnTimedEvent(Object source, ElapsedEventArgs e) { Console.WriteLine("Ponowne sprawdzanie", e.SignalTime); string urlString = @"C:\Users\micha\source\repos\porównywanie\porównywanie\url.txt"; string pageString = @"C: \Users\micha\source\repos\porównywanie\porównywanie\page.txt"; if (File.Exists(@"C:\Users\micha\source\repos\porównywanie\porównywanie\page.txt")) { string urlPath = File.ReadAllText(@"C:\Users\micha\source\repos\porównywanie\porównywanie\url.txt", Encoding.UTF8); string pagePath = File.ReadAllText(@"C:\Users\micha\source\repos\porównywanie\porównywanie\page.txt", Encoding.UTF8); if (urlPath == pagePath) { } else { System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = @"C:\Users\micha\source\repos\porównywanie\porównywanie\x.wav"; player.Play(); } } else { File.Copy(urlString, pageString); } Console.ReadLine(); }
public static void Play() { int rand = World.Rand (0, 5); var file = new FileStream (rand + ".wav", FileMode.Open, FileAccess.Read, FileShare.Read); player = new SoundPlayer(file); player.PlayLooping(); }
public void Confirma() { if (CandidatoSelecionado.Id != ObjectId.Empty) { if (CargoIndex == AppViewModel.EleicaoAtual.Cargos.Count()) { AppViewModel.EleicaoAtual.Votos.Add(new Voto { Candidato = CandidatoSelecionado, Usuario = AppViewModel.Instance.UsuarioAtual }); EleicaoDb.Update(AppViewModel.EleicaoAtual); AppViewModel.Finalizado = Visibility.Visible; NumeroCandidato.Clear(); CandidatoSelecionado = new Candidato(); SoundPlayer player = new System.Media.SoundPlayer(@"Resources\confirma.wav"); player.Play(); } else { AppViewModel.EleicaoAtual.Votos.Add(new Voto { Candidato = CandidatoSelecionado, Usuario = AppViewModel.Instance.UsuarioAtual }); NumeroCandidato.Clear(); CandidatoSelecionado = new Candidato(); CargoSelecionado = AppViewModel.EleicaoAtual.Cargos[CargoIndex]; CargoIndex++; } } }
/// <summary> /// Plays a stream Asychronously using the System.Media.SoundPlayer Object. /// </summary> /// <param name="S">Any stream, ex: a wav sound resource.</param> public void QuickPlay(System.IO.Stream S) { SoundPlayer wavPlayer = new SoundPlayer(); wavPlayer.Stream = S; wavPlayer.LoadCompleted += new AsyncCompletedEventHandler(wavPlayer_LoadCompleted); wavPlayer.LoadAsync(); }
/// <summary> /// display the welcome screen /// </summary> public void DisplayWelcomeScreen() { StringBuilder sb = new StringBuilder(); ConsoleUtil.DisplayReset(); ConsoleUtil.DisplayMessage("********************************************"); ConsoleUtil.DisplayMessage("* BACK TO THE FUTURE GAME *"); ConsoleUtil.DisplayMessage("* *"); ConsoleUtil.DisplayMessage("********************************************"); ConsoleUtil.DisplayMessage(""); Console.WriteLine(); sb.Clear(); ConsoleUtil.DisplayMessage(""); sb.AppendFormat("- You have just realized that the Flux Capacitor really does work! -"); ConsoleUtil.DisplayMessage(""); sb.AppendFormat("- You now can drive or fly the DeLorean throughout time. -"); ConsoleUtil.DisplayMessage(""); sb.AppendFormat("- Visit a destination year and see where the Future takes you -"); ConsoleUtil.DisplayMessage(""); sb.AppendFormat("- There are items and treasures to grab but be careful, because there are some bullies that affect your health. -"); ConsoleUtil.DisplayMessage(""); ConsoleUtil.DisplayMessage(sb.ToString()); Console.WriteLine(); DisplayContinuePrompt(); var myplayer = new System.Media.SoundPlayer(); myplayer.SoundLocation = @"C:\Users\Jennifer\Documents\Visual Studio 2015\Projects\Back To The Future Game [sprint 3]\Project_TARDIS.S2_Starter\sound\intothefuture2.wav"; myplayer.Play(); }
/// <summary>Plays a .wav sound file.</summary> /// <param name="playMode">AudioPlayMode Enumeration mode for playing the sound. By default, AudioPlayMode.Background.</param> /// <param name="location">A String containing the name of the sound file </param> /// <PermissionSet><IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlThread" /><IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /></PermissionSet> public static void Play(string location, AudioPlayMode playMode) { ValidateAudioPlayModeEnum(playMode, "playMode"); string text1 = ValidateFilename(location); SoundPlayer player1 = new SoundPlayer(text1); Play(player1, playMode); }
private void btgunshootaway_Click(object sender, EventArgs e) { videoplayer.Image = WindowsFormsApp1.Properties.Resources._2; System.IO.Stream str = WindowsFormsApp1.Properties.Resources.shoot; System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str); snd.Play(); objRussianRoullete.WinningGame = objRussianRoullete.shootbullet(); if (objRussianRoullete.WinningGame == true && objRussianRoullete.totalshottofire <= 2) { MessageBox.Show("you won the game and score = $100"); btgunshootaway.Enabled = false; Btshoot.Enabled = false; } else if (objRussianRoullete.WinningGame == false && objRussianRoullete.totalshottofire >= 2) { MessageBox.Show("Sorry! you loose the game"); btgunshootaway.Enabled = false; Btshoot.Enabled = false; } else { MessageBox.Show("Shot missed"); objRussianRoullete.totalshottofire++; } }
} //Hook events public Form1() { InitializeComponent(); //Misc images game_images[0] = Image.FromFile("images/selected.png"); game_images[1] = Image.FromFile("images/checkglow.png"); game_images[2] = Image.FromFile("images/selectglow.png"); //White images peice_images[0, 0] = Image.FromFile("images/king_w.png"); peice_images[0, 1] = Image.FromFile("images/queen_w.png"); peice_images[0, 2] = Image.FromFile("images/rook_w.png"); peice_images[0, 3] = Image.FromFile("images/bishop_w.png"); peice_images[0, 4] = Image.FromFile("images/knight_w.png"); peice_images[0, 5] = Image.FromFile("images/pawn_w.png"); //Black images peice_images[1, 0] = Image.FromFile("images/king_b.png"); peice_images[1, 1] = Image.FromFile("images/queen_b.png"); peice_images[1, 2] = Image.FromFile("images/rook_b.png"); peice_images[1, 3] = Image.FromFile("images/bishop_b.png"); peice_images[1, 4] = Image.FromFile("images/knight_b.png"); peice_images[1, 5] = Image.FromFile("images/pawn_b.png"); //Sounds game_sounds[0] = new SoundPlayer() { SoundLocation = "sounds/move.wav" }; game_sounds[1] = new SoundPlayer() { SoundLocation = "sounds/transform.wav" }; game_sounds[2] = new SoundPlayer() { SoundLocation = "sounds/endgame.wav" }; game_sounds[3] = new SoundPlayer() { SoundLocation = "sounds/take.wav" }; } //Load assets
private void frmMain_Load(object sender, EventArgs e) { System.Media.SoundPlayer mainSong = new System.Media.SoundPlayer(); mainSong.SoundLocation = "pizzapie.wav"; mainSong.Play(); }
public Login() { InitializeComponent(); SoundPlayer player = new SoundPlayer(@"\\Mac\Home\Documents\Schule\BSD REL ORG\DWR\DWR\Resources\song.wav"); player.Play(); }
private void button5_Click(object sender, EventArgs e) { System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = @"D:\l\Hero.wav"; player.Load(); player.Play(); }
public FormNotify() { InitializeComponent(); myNotify.Visible = true; NotifyList = new List<LoggedNotifyMessage>(); NotifySoundPlayer = new SoundPlayer("Resource/msg.wav"); }
static void Main(string[] args) { SoundPlayer myPlayer = new System.Media.SoundPlayer(); myPlayer.SoundLocation = @"C:\1118.wav"; myPlayer.PlaySync(); }
public Beeper(Metronome metronome, String soundFileName) : base(metronome) { this.soundFileName = soundFileName; soundPlayer = new SoundPlayer(); soundPlayer.SoundLocation = soundFileName; }
private void Shooterbtn_Click(object sender, EventArgs e) { Assembly myasses = Assembly.GetExecutingAssembly(); Stream myst = myasses.GetManifestResourceStream("russain roullete assiment.properties.resources.shoot"); imagebox.Image = (russain_roullete_assiment.Properties.Resources.shoot); System.Media.SoundPlayer player = new System.Media.SoundPlayer(russain_roullete_assiment.Properties.Resources._3); player.Play(); if (maker.total > 0 && maker.loader == 1) { MessageBox.Show("Shoot"); MessageBox.Show("You Loose"); Shooterbtn.Enabled = false; Missbtn.Enabled = false; spinnerbtn.Enabled = false; Loaderbtn.Enabled = false; } else if (maker.total > 0 && maker.loader != 1) { maker.total = maker.total - 1; maker.loader = loderchanger(maker.loader); MessageBox.Show("Saved"); } }
public DeleteSound() { Uri audioUri = new Uri(Source, UriKind.Relative); StreamResourceInfo info = App.GetContentStream(audioUri); Stream audioStream = info.Stream; _player = new SoundPlayer(audioStream); }
private void Btn_Shoot_Click(object sender, EventArgs e) { G1.Shoot(); //Calling Shoot function from Game Class if (G1.lose == 1) { System.Media.SoundPlayer player = new System.Media.SoundPlayer(SimpleGame.Properties.Resources.shoot); player.Play(); // This sound will play on the click of shoot button Assembly mygame = Assembly.GetExecutingAssembly(); Stream myst = mygame.GetManifestResourceStream("SimpleGame.Resources.shoot.atself.jpg"); // This image will show on the click of shoot button Img_Box.Image = SimpleGame.Properties.Resources.shoot_atself; MessageBox.Show("you loose the game"); // This message will pop up after loosing the game Btn_load.Enabled = false; Btn_Spin.Enabled = false; Btn_Shoot.Enabled = false; Btn_ShootAway.Enabled = false; } else { System.Media.SoundPlayer player = new System.Media.SoundPlayer(SimpleGame.Properties.Resources.shoot); player.Play(); // This sound will play on the click of shoot button Assembly mygame = Assembly.GetExecutingAssembly(); Stream myst = mygame.GetManifestResourceStream("SimpleGame.Resources.shoot.atself.jpg"); // Image will show on shoot button Img_Box.Image = SimpleGame.Properties.Resources.shoot_atself; Btn_load.Enabled = false; Btn_Spin.Enabled = false; Btn_Shoot.Enabled = true; // Enabling shoot button Btn_ShootAway.Enabled = true; //Enabling shoot away button } }