Ejemplo n.º 1
0
            public void RefreshStream(bool forced = false, INamedStreamWithVolumeControl newStream = null)
            {
                if (Id == null)
                {
                    return;
                }

                if (_stream != null && !forced)
                {
                    return;
                }

                IStreamWithVolumeControl old = _stream;

                _stream = newStream != null ? newStream : SharedManager.GetStreamById(Id);

                if (old == _stream)
                {
                    return;
                }

                if (old != null)
                {
                    INotifyPropertyChanged notifiable = (INotifyPropertyChanged)old;
                    notifiable.PropertyChanged -= this.Stream_PropertyChanged;
                }

                if (_stream != null)
                {
                    INotifyPropertyChanged notifiable = (INotifyPropertyChanged)_stream;
                    notifiable.PropertyChanged += this.Stream_PropertyChanged;
                    _streamName = _stream.DisplayName;
                    if (_stream is IAudioDeviceSession)
                    {
                        IAudioDeviceSession session = (IAudioDeviceSession)_stream;

                        if (session.Parent != null)
                        {
                            _parent    = session.Parent;
                            ParentName = session.Parent.DisplayName;
                        }
                    }
                    IconPath     = _stream.IconPath;
                    IsDesktopApp = _stream.IsDesktopApp;
                }

                RaisePropertyChanged("Stream");
                RaisePropertyChanged("StreamName");
                RaisePropertyChanged("Disabled");
                RaisePropertyChanged("QualifiedStreamName");
            }