-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestViewModel.cs
More file actions
129 lines (107 loc) · 3.43 KB
/
Copy pathTestViewModel.cs
File metadata and controls
129 lines (107 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.DatabaseServices;
using ACD = Autodesk.Civil.DatabaseServices;
using ACDS = Autodesk.Civil.DatabaseServices.Styles;
namespace C3d23._2._1_CTest
{
class TestViewModel
{
#region Properties
private ACDS.SurfaceStyle _selectedSurfStyle;
public ACDS.SurfaceStyle SelectedSurfStyle
{
get => _selectedSurfStyle;
set
{
_selectedSurfStyle = value;
OnPropertyChanged(nameof(SelectedPartsList));
}
}
private ObservableCollection<ACDS.SurfaceStyle> _surfStyles;
public ObservableCollection<ACDS.SurfaceStyle> SurfStyles
{
get => _surfStyles;
set
{
_surfStyles = value;
OnPropertyChanged(nameof(SurfStyles));
}
}
private ACDS.PartsList _selectedPartsList;
public ACDS.PartsList SelectedPartsList
{
get => _selectedPartsList;
set
{
_selectedPartsList = value;
OnPropertyChanged(nameof(SelectedPartsList));
}
}
private ObservableCollection<ACDS.PartsList> _partsLists;
public ObservableCollection<ACDS.PartsList> PartsLists
{
get => _partsLists;
set
{
_partsLists = value;
OnPropertyChanged(nameof(PartsLists));
}
}
#endregion
#region
public TestViewModel()
{
SurfStyles = new ObservableCollection<ACDS.SurfaceStyle>();
foreach (ObjectId surfStyleId in C3D.SurfaceStyles.GetListOfSurfaceStyles())
{
try
{
ACD.Styles.SurfaceStyle surfStyle = C3D.SurfaceStyles.GetSurfaceStyle(surfStyleId);
SurfStyles.Add(surfStyle);
}
catch (Exception e)
{
//Console.WriteLine(e);
//throw;
}
}
PartsLists = new ObservableCollection<ACDS.PartsList>();
foreach (ObjectId partListId in C3D.PartsList.GetListOfPartsLists())
{
try
{
ACD.Styles.PartsList partList = C3D.PartsList.GetPartsList(partListId);
PartsLists.Add(partList);
}
catch (Exception e)
{
//Console.WriteLine(e);
//throw;
}
}
SelectedPartsList = PartsLists[0];
}
#endregion
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public void TriggerChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}
}