using System.Collections; using System.Collections.ObjectModel; using System.Linq; using System.Windows; using Autodesk.Revit.DB; using Autodesk.Revit.UI; namespace Szmedi.RvKits.DrawingTools; public partial class CopyAnnotationViewModel : ObservableObject { public CopyAnnotationViewModel(UIApplication uiapp) { var doc = uiapp.ActiveUIDocument.Document; View3Ds = new FilteredElementCollector(doc).OfClass(typeof(View3D)).Cast().Where(v => !v.IsTemplate); } [ObservableProperty] private IList view3DsSelected; [ObservableProperty] private IEnumerable view3Ds; [RelayCommand] private void Confirm(object obj) { if (obj is Window window) { if (View3DsSelected is { Count: > 0 }) { window.DialogResult = true; } } } [RelayCommand] private void SelectionChanged(object obj) { var type = obj.GetType(); View3DsSelected = ((ObservableCollection)obj).Cast().ToList(); } }