public override void ViewDidLoad() { base.ViewDidLoad (); // Generate the NSUrl to the sound file var url = NSUrl.FromFilename ("Sounds/tap.aif"); // Generate the SystemSound instance with the NSUrl SystemSound newSound = new SystemSound (url); // This handles the playSystemButton being pressed playSystemButton.TouchUpInside += (object sender, EventArgs e) => { // Plays the sound newSound.PlaySystemSound(); }; // This handles the playAlertButton being pressed playAlertButton.TouchUpInside += (object sender, EventArgs e) => { // PlayAlertSound Plays the sound as well as vibrates newSound.PlayAlertSound(); }; // This handles the VibrateButton being pressed VibrateButton.TouchUpInside += (object sender, EventArgs e) => { // Just vibrates the device SystemSound.Vibrate.PlaySystemSound (); }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Generate the NSUrl to the sound file var url = NSUrl.FromFilename("Sounds/tap.aif"); // Generate the SystemSound instance with the NSUrl SystemSound newSound = new SystemSound(url); // This handles the playSystemButton being pressed playSystemButton.TouchUpInside += (object sender, EventArgs e) => { // Plays the sound newSound.PlaySystemSound(); }; // This handles the playAlertButton being pressed playAlertButton.TouchUpInside += (object sender, EventArgs e) => { // PlayAlertSound Plays the sound as well as vibrates newSound.PlayAlertSound(); }; // This handles the VibrateButton being pressed VibrateButton.TouchUpInside += (object sender, EventArgs e) => { // Just vibrates the device SystemSound.Vibrate.PlaySystemSound(); }; }
public static void PlaySound(bool withVibrate, string fileName) { NSUrl url = NSUrl.FromFilename (fileName); SystemSound systemSound = new SystemSound (url); if (withVibrate) { systemSound.PlayAlertSound (); } else { systemSound.PlaySystemSound (); } }
public void SetNotificationSound() { try { url = NSUrl.FromFilename("notifysound.mp3"); ss = new SystemSound(url); ss.PlayAlertSound(); } catch (System.Exception e) { } }
void EndGame() { _timer.Stop(); SystemSound systemSound = new SystemSound(1323); systemSound.PlayAlertSound(); InvokeOnMainThread(() => { _letterLabel.UserInteractionEnabled = true; _timerSlider.Enabled = true; _newGameButton.Enabled = true; }); }
public static void PlaySound(bool withVibrate, string fileName) { NSUrl url = NSUrl.FromFilename(fileName); SystemSound systemSound = new SystemSound(url); if (withVibrate) { systemSound.PlayAlertSound(); } else { systemSound.PlaySystemSound(); } }
void BuzzTimer_Elapsed(object sender, ElapsedEventArgs e) { // Generate the NSUrl to the sound file if (url == null) { url = NSUrl.FromFilename("door_bell.wav"); } // Generate the SystemSound instance with the NSUrl if (systemSound == null) { systemSound = new SystemSound(url); } systemSound.PlayAlertSound(); }
private void StartShufflePlayer() { shuffleSound.PlayAlertSound(); }
//https://forums.xamarin.com/discussion/35751/how-the-hell-i-can-play-a-simple-ios-system-sound private void UKeyboardClick() { SystemSound systemSound = new SystemSound(1333); systemSound.PlayAlertSound(); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Устанавливаем бэкграунд из текстуры UIImageView background = new UIImageView( ResizeUIImage( UIImage.FromFile("background.jpg"), (float)View.Bounds.Size.Width, (float)View.Bounds.Size.Height)); View.Add(background); UILabel gameOverLabel = new UILabel { Frame = new CoreGraphics.CGRect(View.Bounds.Size.Width / 2 - 75, 150, 150, 50), Font = CommonFont, TextAlignment = UITextAlignment.Center, TextColor = UIColor.White }; gameOverLabel.Text = "Игра окончена!"; View.Add(gameOverLabel); UILabel scoreTitle = new UILabel { Frame = new CoreGraphics.CGRect(View.Bounds.Size.Width / 2 - 75, 170, 150, 50), Font = CommonFont, TextAlignment = UITextAlignment.Center, TextColor = UIColor.White }; scoreTitle.Text = "Ваш счёт:"; View.Add(scoreTitle); score.Frame = new CoreGraphics.CGRect(View.Bounds.Size.Width / 2 - 75, 185, 150, 50); score.TextAlignment = UITextAlignment.Center; score.Font = UIFont.FromName("GillSans-BoldItalic", 18f); score.TextColor = UIColor.White; View.Add(score); UIButton startButton = new UIButton { Frame = new CoreGraphics.CGRect(View.Bounds.Size.Width / 2 - 75, View.Bounds.Size.Height - 100, 150, 50), Font = CommonFont, BackgroundColor = ButtonColor }; startButton.SetTitle("В МЕНЮ", UIControlState.Normal); View.Add(startButton); startButton.TouchUpInside += (sender, e) => { UIViewController mainMenu = Storyboard.InstantiateViewController("MainMenu"); NavigationController.PushViewController(mainMenu, true); }; NSUrl url; if (int.Parse(score.Text) >= 3500) { url = NSUrl.FromFilename("greatScoreRus.wav"); } else if (int.Parse(score.Text) >= 2000 && int.Parse(score.Text) < 3500) { url = NSUrl.FromFilename("loserScoreRus.wav"); } else if (int.Parse(score.Text) >= 500 && int.Parse(score.Text) < 2000) { url = NSUrl.FromFilename("antScoreRus.wav"); } else { url = NSUrl.FromFilename("veryLowScoreRus.wav"); } SystemSound ss = new SystemSound(url); ss.PlayAlertSound(); }
public static void Play() { SystemSound sound = SystemSound.FromFile("Sounds/CrystalBell.aiff"); sound.PlayAlertSound(); }
partial void playAlertSound(NSObject sender) { Sound.PlayAlertSound(); }
public void DTMFPlayTone(string t, float reproduceSpeed) { if (!isPlaying) { isPlaying = true; switch (t) { case "0": systemSound = new SystemSound(1200); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "1": systemSound = new SystemSound(1201); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "2": systemSound = new SystemSound(1202); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "3": systemSound = new SystemSound(1203); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "4": systemSound = new SystemSound(1204); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "5": systemSound = new SystemSound(1205); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "6": systemSound = new SystemSound(1206); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "7": systemSound = new SystemSound(1207); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "8": systemSound = new SystemSound(1208); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "9": systemSound = new SystemSound(1209); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "#": systemSound = new SystemSound(1211); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; case "*": systemSound = new SystemSound(1210); systemSound.PlayAlertSound(); StopSound(reproduceSpeed.ToString()); break; default: if (isPlaying) { systemSound = new SystemSound(1210); systemSound.Close(); } break; } isPlaying = false; } }