-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first step for adding specialized view for parameters
- Loading branch information
Showing
6 changed files
with
145 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 53 additions & 7 deletions
60
sources/RevitDBExplorer/Domain/DataModel/SnoopableParameter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Autodesk.Revit.DB; | ||
using RevitDBExplorer.WPF; | ||
|
||
// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md | ||
|
||
namespace RevitDBExplorer.Domain.DataModel | ||
{ | ||
internal class SnoopableParameter | ||
internal class SnoopableParameter : BaseViewModel | ||
{ | ||
private Parameter parameter; | ||
|
||
|
||
|
||
public string Name => parameter.Definition.Name; | ||
public string Value { get; private set; } | ||
|
||
|
||
public SnoopableParameter(Parameter parameter) | ||
{ | ||
this.parameter = parameter; | ||
|
||
} | ||
|
||
|
||
public void Read() | ||
{ | ||
var dataType = parameter.Definition.GetDataType(); | ||
bool isMeasurableSpec = UnitUtils.IsMeasurableSpec(dataType); | ||
string value = ""; | ||
if (isMeasurableSpec) | ||
{ | ||
value = parameter.AsValueString(); | ||
} | ||
else | ||
{ | ||
|
||
switch (parameter.StorageType) | ||
{ | ||
case StorageType.String: | ||
value = parameter.AsString(); | ||
break; | ||
case StorageType.Integer: | ||
value = parameter.AsInteger().ToString(); | ||
break; | ||
case StorageType.ElementId: | ||
value = parameter.AsValueString(); | ||
break; | ||
case StorageType.Double: | ||
value += parameter.AsDouble().ToString(); | ||
break; | ||
|
||
} | ||
} | ||
Value = value; | ||
OnPropertyChanged(nameof(Value)); | ||
} | ||
|
||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters