41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
|
|
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<View3D>().Where(v => !v.IsTemplate);
|
|||
|
|
}
|
|||
|
|
[ObservableProperty]
|
|||
|
|
private IList<View3D> 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<object>)obj).Cast<View3D>().ToList();
|
|||
|
|
}
|
|||
|
|
}
|