예제 #1
0
        private void CreateAndAddSession(IAudioSessionControl session)
        {
            try
            {
                if (!_parent.TryGetTarget(out IAudioDevice parent))
                {
                    throw new Exception("Device session parent is invalid but device is still notifying.");
                }

                var newSession = new AudioDeviceSession(parent, session);
                _dispatcher.BeginInvoke((Action)(() =>
                {
                    if (newSession.State == SessionState.Moved)
                    {
                        _movedSessions.Add(newSession);
                        newSession.PropertyChanged += MovedSession_PropertyChanged;
                    }
                    else
                    {
                        AddSession(newSession);
                    }
                }));
            }
            catch (ZombieProcessException ex)
            {
                Trace.TraceError($"{ex}");
            }
            catch (Exception ex)
            {
                Trace.TraceError($"{ex}");
            }
        }
        private void CreateAndAddSession(IAudioSessionControl session)
        {
            try
            {
                if (!_parent.TryGetTarget(out IAudioDevice parent))
                {
                    throw new Exception("Device session parent is invalid but device is still notifying.");
                }

                var newSession = new AudioDeviceSession(parent, session);
                _dispatcher.BeginInvoke((Action)(() =>
                {
                    if (newSession.State == SessionState.Moved)
                    {
                        _movedSessions.Add(newSession);
                        newSession.PropertyChanged += MovedSession_PropertyChanged;
                    }
                    else
                    {
                        AddSession(newSession);
                    }
                }));
            }
            catch (ZombieProcessException ex)
            {
                // No need to log these to the cloud, but the debug output
                // can still be helpful for troubleshooting.
                Trace.TraceError($"{ex}");
            }
            catch (Exception ex)
            {
                AppTrace.LogWarning(ex);
            }
        }