添加项目文件。
This commit is contained in:
41
Szmedi.RvKits/Drawing/CopyAnnotationViewModel.cs
Normal file
41
Szmedi.RvKits/Drawing/CopyAnnotationViewModel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user