コード例 #1
0
ファイル: BowlPlayer.cs プロジェクト: kelegorm/awareness
        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));
        }
コード例 #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));
        }
コード例 #3
0
ファイル: AppDelegate.cs プロジェクト: kelegorm/awareness
        void BowlPlayerWillPlay(object sender, BowlPlayerEventArgs e)
        {
            if (Controller.BowlPlayer.IsPlaying) return;

            var duration = BowlPlayer.TimeBetweenBowls.Seconds * (e.TimesPlayed - 1) + BowlSound.SoundDuration.Seconds;
            iTunes.GoQuiet (duration.Seconds ());

            // We sleep for a moment to let iTunes go quiet.
            Platform.ThreadSleep (1.Second ());
        }
コード例 #4
0
ファイル: AppDelegate.cs プロジェクト: kelegorm/awareness
        void BowlPlayerStartedPlaying(object sender, BowlPlayerEventArgs e)
        {
            if (Controller.BowlPlayer.IsPlaying) return;

            NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest);
        }