示例#1
0
        private static void VolumeWatcher_DriveRemoved(object sender, VolumeChangedEventArgs e)
        {
            try
            {
                var fileSystemWatcher = fileSystemWatchers[e.DriveLetter];

                fileSystemWatcher.EnableRaisingEvents = false;
            }
            catch (Exception ex)
            {
                #if DEBUG
                Debug.WriteLine(ex);

                if (ex.InnerException != null)
                {
                    Debug.WriteLine(ex.InnerException);
                }
                #else
                Trace.WriteLine(ex);

                if (ex.InnerException != null)
                {
                    Trace.WriteLine(ex.InnerException);
                }
                #endif
            }
        }
示例#2
0
 public void SetVolume(VolumeChangedEventArgs e)
 {
     if (player != null)
     {
         player.SetVolume(e.Volume);
     }
 }
示例#3
0
        private static void VolumeWatcher_DriveInserted(object sender, VolumeChangedEventArgs e)
        {
            try
            {
                var watcher = fileSystemWatchers[e.DriveLetter];

                if (watcher.Path == string.Empty)
                {
                    watcher.Path = string.Format(@"{0}:\", e.DriveLetter);
                }

                watcher.EnableRaisingEvents = true;
            }
            catch (Exception ex)
            {
                #if DEBUG
                Debug.WriteLine(ex);

                if (ex.InnerException != null)
                {
                    Debug.WriteLine(ex.InnerException);
                }
                #else
                Trace.WriteLine(ex);

                if (ex.InnerException != null)
                {
                    Trace.WriteLine(ex.InnerException);
                }
                #endif
            }
        }
        private async void VolumeController_VolumeChanged(object sender, VolumeChangedEventArgs e)
        {
            await Task.Delay(500);

            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {
                Volume = _volumeController.GetVolume();
            });
        }
示例#5
0
        private async void OnVolumeStatusUpdaterVolumeChanged(object?sender, VolumeChangedEventArgs e)
        {
            if (this.initializeFlag.Initialize())
            {
                return;
            }

            if (!e.IsMuted)
            {
                await this.SetVolumeAsync(e.Volume).ConfigureAwait(false);
            }
            else
            {
                await this.SetMuteStateAsync(true).ConfigureAwait(false);
            }
        }
 private void VolumeManagerOnVolumeChanged(object sender, VolumeChangedEventArgs volumeChangedEventArgs)
 {
     _player.Volume = (double)volumeChangedEventArgs.Volume;
     _player.IsMuted = volumeChangedEventArgs.Mute;
 }
 private void VolumeManagerOnVolumeChanged(object sender, VolumeChangedEventArgs volumeChangedEventArgs)
 {
     _player.Volume  = (double)volumeChangedEventArgs.Volume;
     _player.IsMuted = volumeChangedEventArgs.Mute;
 }
示例#8
0
 private void ControllerOnVolumeChangedEvent(object sender, VolumeChangedEventArgs e)
 {
     trkVolume.Value = e.Level;
 }
示例#9
0
 /// <summary>
 /// Invoked when audio volume level has been changed
 /// </summary>
 /// <param name="sender">object</param>
 /// <param name="e">VolumeChangedEventArgs</param>
 private void AudioVolume_Changed(object sender, VolumeChangedEventArgs e)
 {
     //MessagingCenter.Send<IPlayService, int>(this, "VOLUME_CHANGE", e.Level);
     VolumeChanged?.Invoke(this, new AudioVolumeChangedEventArgs(e.Level));
 }
示例#10
0
 /// <summary>
 /// Handles event raised when volume setting has been changed so we can set the volumes for
 /// the voices (i.e. MP3 and SAPI).
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void View_VolumeChanged(object sender, VolumeChangedEventArgs e)
 {
     if (!View.AudioMuted)
     {
         ChangeVolume(e.Volume);
     }
 }
示例#11
0
 private void VolumeManagerOnVolumeChanged(object sender, VolumeChangedEventArgs e)
 {
     _player.Volume = (float)e.Volume;
     _player.Muted  = e.Mute;
 }
示例#12
0
 private void VolumeManagerOnVolumeChanged(object sender, VolumeChangedEventArgs volumeChangedEventArgs)
 {
     Player.Volume = (float)volumeChangedEventArgs.Volume;
     Player.Muted  = volumeChangedEventArgs.Mute;
 }
示例#13
0
        public override object ReadJson(
            JsonReader reader,
            Type objectType,
            object existingValue,
            JsonSerializer serializer
        )
        {
            var jObject = JObject.Load(reader);
            var eventName = jObject["event"].Value<string>();
            var jReader = jObject.CreateReader();

            switch (eventName)
            {
                case EventArgs.MuteChangedEventArgs.EventName:
                    {
                        var args = new MuteChangedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }

                // ** Can't receive "on_event" ? **
                //case EventArgs.OnEventEventArgs.EventName:
                //    {
                //        var args = new OnEventEventArgs();
                //        serializer.Populate(jReader, args);

                //        return args;
                //    }

                case EventArgs.OptionsChangedEventArgs.EventName:
                    {
                        var args = new OptionsChangedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.PlaybackStateChangedEventArgs.EventName:
                    {
                        var args = new PlaybackStateChangedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.PlaylistChangedEventArgs.EventName:
                    {
                        var args = new PlaylistChangedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.PlaylistDeletedEventArgs.EventName:
                    {
                        var args = new PlaylistDeletedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.PlaylistsLoadedEventArgs.EventName:
                    {
                        var args = new PlaylistsLoadedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.SeekedEventArgs.EventName:
                    {
                        var args = new SeekedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.StreamTitleChangedEventArgs.EventName:
                    {
                        var args = new StreamTitleChangedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.TracklistChangedEventArgs.EventName:
                    {
                        var args = new TracklistChangedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.TrackPlaybackEndedEventArgs.EventName:
                    {
                        var args = new TrackPlaybackEndedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.TrackPlaybackPausedEventArgs.EventName:
                    {
                        var args = new TrackPlaybackPausedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.TrackPlaybackResumedEventArgs.EventName:
                    {
                        var args = new TrackPlaybackResumedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.TrackPlaybackStartedEventArgs.EventName:
                    {
                        var args = new TrackPlaybackStartedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                case EventArgs.VolumeChangedEventArgs.EventName:
                    {
                        var args = new VolumeChangedEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
                default:
                    {
                        var args = new UnexpectedEventEventArgs();
                        serializer.Populate(jReader, args);

                        return args;
                    }
            }
        }
 private void VolumeManagerOnVolumeChanged(object sender, VolumeChangedEventArgs e)
 {
     _player.Volume = (float) e.Volume;
     _player.Muted = e.Mute;
 }
示例#15
0
 private void OnVolumeChanged(object sender, VolumeChangedEventArgs e)
 {
     VolumeChanged?.Invoke(this, Volume);
 }