Пример #1
0
 void Raise(EventHandler e)
 {
     if (e == null)
     {
         return;
     }
     Platform.RunOnMainThread(() => e(this, EventArgs.Empty));
 }
Пример #2
0
        void ThreadPlay(int times = 1)
        {
            var args  = new BowlPlayerEventArgs(times);
            var bowls = times.Times().Select(i => Platform.CreateBowlSound(BowlSoundPath)).ToArray();

            Platform.RunOnMainThread(() => StartedPlaying.Raise(this, args));

            foreach (var bowl in bowls)
            {
                bowl.Play(Platform.Preferences.BowlVolumePercentage);
                Platform.ThreadSleep(TimeBetweenBowls);
            }

            Platform.ThreadSleep(AbstractBowlSound.SoundDuration);

            foreach (var bowl in bowls)
            {
                bowl.Dispose();
            }

            Platform.RunOnMainThread(() => StoppedPlaying.Raise(this, args));
        }