@@ -1043,6 +1043,7 @@ private void Connection_MetadataReceived(object sender, IMetadata e)
10431043 public ObservableCollection < PluginMenuItemViewModel > PluginMenuItemCollection { get ; } = new ObservableCollection < PluginMenuItemViewModel > ( ) ;
10441044 private readonly ObservableCollection < IMcvCommentViewModel > _comments = new ObservableCollection < IMcvCommentViewModel > ( ) ;
10451045 public ObservableCollection < ConnectionViewModel > Connections { get ; } = new ObservableCollection < ConnectionViewModel > ( ) ;
1046+ public ICollectionViewLiveShaping ConnectedConnections { get ; }
10461047
10471048 private ConnectionViewModel _selectedConnection ;
10481049 public ConnectionViewModel SelectedConnection
@@ -1705,6 +1706,28 @@ public MainViewModel(IIo io, ILogger logger, IOptions options, ISitePluginLoader
17051706 _browserLoader = browserLoader ;
17061707
17071708 Comments = CollectionViewSource . GetDefaultView ( _comments ) ;
1709+ //ConnectedConnections = CollectionViewSource.GetDefaultView(Connections);
1710+ //ConnectedConnections.Filter = x =>
1711+ //{
1712+ // return x is ConnectionViewModel connVm && connVm.CanDisconnect;
1713+ //};
1714+ var view = new CollectionViewSource { Source = Connections } . View ;
1715+ view . Filter = obj =>
1716+ {
1717+ if ( ! ( obj is ConnectionViewModel connVm ) )
1718+ {
1719+ return false ;
1720+ }
1721+ return connVm . CanDisconnect ;
1722+ //return true;
1723+ } ;
1724+ ConnectedConnections = view as ICollectionViewLiveShaping ;
1725+ if ( ConnectedConnections . CanChangeLiveFiltering )
1726+ {
1727+ //ConnectedConnections.LiveFilteringProperties.Add("CanDisconnect");
1728+ ConnectedConnections . LiveFilteringProperties . Add ( nameof ( ConnectionViewModel . CanDisconnect ) ) ;
1729+ ConnectedConnections . IsLiveFiltering = true ;
1730+ }
17081731
17091732 MainViewContentRenderedCommand = new RelayCommand ( ContentRendered ) ;
17101733 MainViewClosingCommand = new RelayCommand < CancelEventArgs > ( Closing ) ;
0 commit comments