本文整理汇总了C#中MirrorData类的典型用法代码示例。如果您正苦于以下问题:C# MirrorData类的具体用法?C# MirrorData怎么用?C# MirrorData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MirrorData类属于命名空间,在下文中一共展示了MirrorData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Process
/// <summary>
/// Creates an instance of <cref name="CompactBubbleViewModel"/> class
/// from given node value
/// </summary>
/// <param name="value">Node value</param>
/// <returns>Instance of <cref name="CompactBubbleViewModel"/> class</returns>
public static CompactBubbleViewModel Process(MirrorData value)
{
items = 0;
var viewModel = ProcessThing(value, true);
viewModel.NumberOfItems = items;
return viewModel;
}
开发者ID:sh4nnongoh,项目名称:Dynamo,代码行数:13,代码来源:CompactBubbleHandler.cs
示例2: ProcessThing
internal WatchViewModel ProcessThing(MirrorData data, string tag, bool showRawData)
{
if (data.IsCollection)
{
var list = data.GetElements();
var node = new WatchViewModel(visualizationManager, list.Count == 0 ? "Empty List" : "List", tag, true);
foreach (var e in list.Select((element, idx) => new { element, idx }))
{
node.Children.Add(ProcessThing(e.element, tag + ":" + e.idx, showRawData));
}
return node;
}
// MAGN-3494: If "data.Data" is null, then return a "null" string
// representation instead of casting it as dynamic (that leads to
// a crash).
if (data.IsNull || data.Data == null)
return new WatchViewModel(visualizationManager, NULL_STRING, tag);
//If the input data is an instance of a class, create a watch node
//with the class name and let WatchHandler process the underlying CLR data
var classMirror = data.Class;
if (null != classMirror)
{
if (data.Data == null && !data.IsNull) //Must be a DS Class instance.
return ProcessThing(classMirror.ClassName, tag, showRawData); //just show the class name.
return Process(data.Data, tag, showRawData);
}
//Finally for all else get the string representation of data as watch content.
return Process(data.Data, tag, showRawData);
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:34,代码来源:IWatchHandler.cs
示例3: RuntimeMirror
/// <summary>
/// This consutructor is for instantiating a Runtime mirror object where we already have the mirrorData
/// </summary>
/// <param name="mirrorData"></param>
/// <param name="core"></param>
public RuntimeMirror(MirrorData mirrorData, ProtoCore.Core core, ProtoCore.Core staticCore = null) : base(core, staticCore)
{
Validity.Assert(this.core != null);
TargetExecutive = core.CurrentExecutive.CurrentDSASMExec;
deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, core);
this.mirrorData = mirrorData;
}
开发者ID:algobasket,项目名称:Dynamo,代码行数:12,代码来源:Mirror.cs
示例4: RuntimeMirror
/// <summary>
/// This consutructor is for instantiating a Runtime mirror object where we already have the mirrorData
/// </summary>
/// <param name="mirrorData"></param>
/// <param name="core"></param>
public RuntimeMirror(MirrorData mirrorData, ProtoCore.RuntimeCore runtimeCoreReflect, ProtoCore.Core staticCore = null)
: base(runtimeCoreReflect, staticCore)
{
Validity.Assert(this.runtimeCore != null);
TargetExecutive = runtimeCoreReflect.CurrentExecutive.CurrentDSASMExec;
deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, runtimeCoreReflect);
this.mirrorData = mirrorData;
}
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:13,代码来源:Mirror.cs
示例5: ProcessThing
internal WatchViewModel ProcessThing(MirrorData data, string tag, bool showRawData)
{
try
{
return baseHandler.Process(data, tag, showRawData);
}
catch (Exception)
{
return Process(data.Data, tag, showRawData);
}
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:11,代码来源:RevitWatchHandler.cs
示例6: ProcessThing
private WatchViewModel ProcessThing(MirrorData data, string tag, bool showRawData, WatchHandlerCallback callback)
{
try
{
return baseHandler.Process(data, tag, showRawData, callback);
}
catch (Exception)
{
return callback(data.Data, tag, showRawData);
}
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:11,代码来源:RevitWatchHandler.cs
示例7: AssertWatchContent
/// <summary>
/// Validates the watch content with given mirror data.
/// </summary>
/// <param name="watch">WatchViewModel of the watch node</param>
/// <param name="mirrorData">MirrorData to be shown in watch</param>
private void AssertWatchContent(WatchViewModel watch, MirrorData mirrorData)
{
Assert.IsNotNull(mirrorData);
if (mirrorData.IsCollection)
AssertWatchTreeBranchContent(watch.Children, mirrorData.GetElements());
else if (mirrorData.IsNull)
Assert.AreEqual("null", watch.NodeLabel);
else
{
string nodeLabel = string.Format("{0}", mirrorData.Data);
Assert.AreEqual(nodeLabel, watch.NodeLabel);
}
}
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:18,代码来源:WatchNodeTests.cs
示例8: AssertValue
public void AssertValue(MirrorData data, object value)
{
if (data.IsCollection)
AssertCollection(data, value as IEnumerable);
else if (value == null)
Assert.IsTrue(data.IsNull);
else if (value is int)
Assert.AreEqual((int)value, Convert.ToInt32(data.Data));
else if (value is double)
Assert.AreEqual((double)value, Convert.ToDouble(data.Data), 0.00001);
else
Assert.AreEqual(value, data.Data);
}
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:13,代码来源:DSEvaluationTest.cs
示例9: RuntimeMirror
public RuntimeMirror(string varname, int blockDecl, ProtoCore.RuntimeCore runtimeCore, ProtoCore.Core staticCore = null)
: base(runtimeCore, staticCore)
{
TargetExecutive = runtimeCore.CurrentExecutive.CurrentDSASMExec;
deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, runtimeCore);
Validity.Assert(this.runtimeCore != null);
variableName = varname;
blockDeclaration = blockDecl;
StackValue svData = deprecateThisMirror.GetValue(variableName, blockDeclaration).DsasmValue;
mirrorData = new MirrorData(staticCore, this.runtimeCore, svData);
}
开发者ID:limrzx,项目名称:Dynamo,代码行数:14,代码来源:Mirror.cs
示例10: ProcessThing
internal WatchViewModel ProcessThing(MirrorData data, string tag, bool showRawData = true)
{
//If the input data is an instance of a class, create a watch node
//with the class name and let WatchHandler process the underlying CLR data
var classMirror = data.Class;
if (null != classMirror)
{
if (data.Data == null && !data.IsNull) //Must be a DS Class instance.
return ProcessThing(classMirror.ClassName, tag); //just show the class name.
return ProcessThing(data.Data as dynamic, tag, showRawData);
}
//Finally for all else get the string representation of data as watch content.
return ProcessThing(data.Data as dynamic, tag);
}
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:15,代码来源:RevitWatchHandler.cs
示例11: ProcessThing
/// <summary>
/// Counts the number of all collection items of node output and if specified
/// it generates appropriate view model for compact preview bubble
/// </summary>
/// <param name="mirrorData">Data which represents the value of node output</param>
/// <param name="generateViewModel">Flag to not create unused view models</param>
/// <returns><cref name="CompactBubbleViewModel"/> instance
/// if <paramref name="generateViewModel"/> is specified. Otherwise, null</returns>
private static CompactBubbleViewModel ProcessThing(MirrorData mirrorData, bool generateViewModel)
{
if (mirrorData == null)
{
return generateViewModel ? new CompactBubbleViewModel(Resources.NullString, 0) : null;
}
if (mirrorData.IsCollection)
{
var list = mirrorData.GetElements();
foreach (var item in list)
{
ProcessThing(item, false);
}
return generateViewModel
? new CompactBubbleViewModel(true)
{
NodeLabel = list.Any() ? "List" : "Empty List"
}
: null;
}
items++;
if (!generateViewModel) return null;
var viewModel = new CompactBubbleViewModel(false);
if (mirrorData.Data == null && !mirrorData.IsNull && mirrorData.Class != null)
{
viewModel.NodeLabel = mirrorData.Class.ClassName;
}
else if (mirrorData.Data is Enum)
{
viewModel.NodeLabel = ((Enum)mirrorData.Data).GetDescription();
}
else
{
// Cut StringData so that only the type name remains
// for example, "Point (Z = 0.000, Y = 0.000, Z = 0.000)" -> "Point"
viewModel.NodeLabel = string.IsNullOrEmpty(mirrorData.StringData)
? string.Empty
: mirrorData.StringData.Split('(')[0];
}
return viewModel;
}
开发者ID:sh4nnongoh,项目名称:Dynamo,代码行数:56,代码来源:CompactBubbleHandler.cs
示例12: ProcessThing
internal WatchViewModel ProcessThing(MirrorData data, string tag, bool showRawData = true)
{
//If the input data is an instance of a class, create a watch node
//with the class name and let WatchHandler process the underlying CLR data
var classMirror = data.Class;
if (null != classMirror)
{
if (data.Data == null && !data.IsNull) //Must be a DS Class instance.
return ProcessThing(classMirror.ClassName, tag); //just show the class name.
return ProcessThing(data.Data as dynamic, tag, showRawData);
}
// MAGN-3494: If "data.Data" is null, then return a "null" string
// representation instead of casting it as dynamic (that leads to
// a crash).
if (data.Data == null)
return new WatchViewModel("null", tag);
//Finally for all else get the string representation of data as watch content.
return ProcessThing(data.Data as dynamic, tag, showRawData);
}
开发者ID:khoaho,项目名称:Dynamo,代码行数:21,代码来源:IWatchHandler.cs
示例13: AssertCollection
private void AssertCollection(MirrorData data, IEnumerable collection)
{
Assert.IsTrue(data.IsCollection);
List<MirrorData> elements = data.GetElements();
int i = 0;
foreach (var item in collection)
{
AssertValue(elements[i++], item);
}
}
开发者ID:khoaho,项目名称:Dynamo,代码行数:10,代码来源:DSEvaluationTest.cs
示例14: AssertMirrorData
private void AssertMirrorData(MirrorData data1, MirrorData data2)
{
if (data1.IsNull)
Assert.True(data2.IsNull);
else if (data1.IsCollection)
{
Assert.True(data2.IsCollection);
List<MirrorData> elems1 = data1.GetElements();
List<MirrorData> elems2 = data2.GetElements();
Assert.AreEqual(elems1.Count, elems2.Count);
int i = 0;
foreach (var item in elems1)
{
AssertMirrorData(item, elems2[i++]);
}
}
else
Assert.AreEqual(data1.Data, data2.Data);
}
开发者ID:khoaho,项目名称:Dynamo,代码行数:19,代码来源:DSEvaluationTest.cs
示例15: SelectivelyAssertValues
private void SelectivelyAssertValues(MirrorData data, Dictionary<int, object> selectedValues)
{
Assert.IsTrue(data.IsCollection);
if (data.IsCollection)
{
List<MirrorData> elements = data.GetElements();
foreach (var pair in selectedValues)
{
AssertValue(elements[pair.Key], pair.Value);
}
}
}
开发者ID:khoaho,项目名称:Dynamo,代码行数:13,代码来源:DSEvaluationTest.cs
示例16: AddToSizeMap
private void AddToSizeMap(MirrorData data, ICollection<double> map)
{
if (data.IsCollection)
{
var list = data.GetElements();
foreach (MirrorData t in list)
{
AddToSizeMap(t, map);
}
}
else if (data.Data is IEnumerable)
{
var list = data.Data as IEnumerable;
AddToSizeMap(list, map);
}
else
{
map.Add(ComputeBBoxDiagonalSize(data.Data));
}
}
开发者ID:heegwon,项目名称:Dynamo,代码行数:20,代码来源:NodeModel.cs
示例17: GetGraphicItemsFromMirrorData
private static void GetGraphicItemsFromMirrorData(MirrorData mirrorData, List<IGraphicItem> graphicItems)
{
if (mirrorData == null) return;
if (mirrorData.IsCollection)
{
foreach (var el in mirrorData.GetElements())
{
GetGraphicItemsFromMirrorData(el, graphicItems);
}
}
else
{
var graphicItem = mirrorData.Data as IGraphicItem;
if (graphicItem == null) return;
graphicItems.Add(graphicItem);
}
}
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:19,代码来源:NodeModelExtensions.cs
示例18: RevitGeometryFromMirrorData
/// <summary>
/// Convert mirror data objects for nodes to Revit types.
/// </summary>
/// <param name="data"></param>
/// <param name="geoms"></param>
private void RevitGeometryFromMirrorData(MirrorData data, ref List<GeometryObject> geoms)
{
if (data.IsCollection)
{
foreach (var md in data.GetElements())
{
try
{
RevitGeometryFromMirrorData(md, ref geoms);
}
catch (Exception ex)
{
this.dynamoModel.Logger.Log(ex.Message);
}
}
}
else
{
try
{
var geom = data.Data as PolyCurve;
if (geom != null)
{
geoms.AddRange(geom.ToRevitType());
return;
}
var point = data.Data as Point;
if (point != null)
{
geoms.Add(DocumentManager.Instance.CurrentUIApplication.Application.Create.NewPoint(point.ToXyz()));
return;
}
var curve = data.Data as Curve;
if (curve != null)
{
geoms.Add(curve.ToRevitType());
return;
}
}
catch (Exception ex)
{
this.dynamoModel.Logger.Log(ex.Message);
}
}
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:52,代码来源:RevitVisualizationManager.cs
示例19: OnNodeValueQueried
private void OnNodeValueQueried(AsyncTask asyncTask)
{
lock (cachedMirrorDataMutex)
{
var task = asyncTask as QueryMirrorDataAsyncTask;
cachedMirrorData = task.MirrorData;
}
RaisePropertyChanged("IsUpdated");
}
开发者ID:w-fish,项目名称:Dynamo,代码行数:10,代码来源:NodeModel.cs
示例20: RequestValueUpdateAsync
/// <summary>
/// Call this method to asynchronously update the cached MirrorData for
/// this NodeModel through DynamoScheduler. AstIdentifierForPreview is
/// being accessed within this method, therefore the method is typically
/// called from the main/UI thread.
/// </summary>
///
internal void RequestValueUpdateAsync(IScheduler scheduler, EngineController engine)
{
// A NodeModel should have its cachedMirrorData reset when it is
// requested to update its value. When the QueryMirrorDataAsyncTask
// returns, it will update cachedMirrorData with the latest value.
//
lock (cachedMirrorDataMutex)
{
cachedMirrorData = null;
}
// Do not have an identifier for preview right now. For an example,
// this can be happening at the beginning of a code block node creation.
var variableName = AstIdentifierForPreview.Value;
if (string.IsNullOrEmpty(variableName))
return;
var task = new QueryMirrorDataAsyncTask(new QueryMirrorDataParams
{
Scheduler = scheduler,
EngineController = engine,
VariableName = variableName
});
task.Completed += OnNodeValueQueried;
scheduler.ScheduleForExecution(task);
}
开发者ID:w-fish,项目名称:Dynamo,代码行数:34,代码来源:NodeModel.cs
注:本文中的MirrorData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论