当前位置: 首页>>代码示例>>C#>>正文


C# MirrorData类代码示例

本文整理汇总了C#中MirrorData的典型用法代码示例。如果您正苦于以下问题:C# MirrorData类的具体用法?C# MirrorData怎么用?C# MirrorData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MirrorData类属于命名空间,在下文中一共展示了MirrorData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的MirrorData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。