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


C# System.Reference类代码示例

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


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

示例1: AttachToModel

 public void AttachToModel(Reference @ref)
 {
     reference = @ref;
     Detached = false;
     reference.PropertyChanged += reference_PropertyChanged;
     SetupForm();
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:7,代码来源:ReferencePresenter.cs

示例2: WaitAsync

        public async Task<bool> WaitAsync(Reference<int> callerState)
        {
            if (_disposed)
                return false;
            var localState = _state;
            if (callerState.Value != localState)
            {
                callerState.Value = localState;
                return false;
            }

            TaskCompletionSource<object> taskCompletionSource;
            lock (_locker)
            {
                if (callerState.Value != _state)
                {
                    callerState.Value = _state;
                    return false;
                }

                taskCompletionSource = new TaskCompletionSource<object>();
                _pending.AddLast(taskCompletionSource);

                callerState.Value = _state;
            }
            await taskCompletionSource.Task.ConfigureAwait(false);
            return true;

        }
开发者ID:mattwarren,项目名称:temp.raven.storage,代码行数:29,代码来源:AsyncEvent.cs

示例3: StorageActionsAccessor

	    public StorageActionsAccessor(TableStorage storage, Reference<WriteBatch> writeBatch, Reference<SnapshotReader> snapshot, IdGenerator generator, IBufferPool bufferPool, OrderedPartCollection<AbstractFileCodec> fileCodecs)
            : base(snapshot, generator, bufferPool)
        {
            this.storage = storage;
            this.writeBatch = writeBatch;
	        this.fileCodecs = fileCodecs;
        }
开发者ID:felipeleusin,项目名称:ravendb,代码行数:7,代码来源:StorageActionsAccessor.cs

示例4: AssemblyInfo

 private AssemblyInfo(string path, string name, Version version, Reference[] references)
 {
     Path = path;
     Name = name;
     Version = version;
     References = references;
 }
开发者ID:modulexcite,项目名称:ReferenceGenerator,代码行数:7,代码来源:AssemblyInfo.cs

示例5: SkipTasksForDisabledIndexes1

        public void SkipTasksForDisabledIndexes1(string requestedStorage)
        {
            using (var storage = NewTransactionalStorage(requestedStorage))
            {
                storage.Batch(accessor => accessor.Tasks.AddTask(new RemoveFromIndexTask(101), DateTime.Now));

                storage.Batch(accessor =>
                {
                    var foundWork = new Reference<bool>();
                    var idsToSkip = new List<int>()
                    {
                        101
                    };

                    var task = accessor.Tasks.GetMergedTask<RemoveFromIndexTask>(
                        x => MaxTaskIdStatus.Updated,
                        x => { },
                        foundWork,
                        idsToSkip);
                    Assert.Null(task);
                });

                storage.Batch(accessor =>
                {
                    Assert.True(accessor.Tasks.HasTasks);
                    Assert.Equal(1, accessor.Tasks.ApproximateTaskCount);
                });
            }
        }
开发者ID:knives-out,项目名称:ravendb,代码行数:29,代码来源:RavenDB-4222.cs

示例6: OnCreate

        public override void OnCreate(object view)
        {
            foreach (var member in GetAttributeMembers(view.GetType()))
            {
                var key = member.Attribute.Key ?? member.MemberType.FullName;

                Reference reference;
                if (!store.TryGetValue(key, out reference))
                {
                    reference = new Reference
                    {
                        Context = Activator.CreateInstance(member.Attribute.Context ?? member.MemberType)
                    };

                    var support = reference.Context as IViewContextSupport;
                    if (support != null)
                    {
                        support.Initilize();
                    }

                    store[key] = reference;
                }

                reference.Counter++;

                member.SetValue(view, reference.Context);
            }
        }
开发者ID:usausa,项目名称:Smart-Net-CE,代码行数:28,代码来源:ViewContextPlugin.cs

示例7: RoomSpace

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="spaceReference"></param>
        public RoomSpace(Document doc, Reference spaceReference)
        {
            m_doc = doc;
            LightFixtures = new List<LightFixture>();
            Space refSpace = m_doc.GetElement(spaceReference) as Space;

            // Set properties of newly create RoomSpace object from Space
            AverageEstimatedIllumination = refSpace.AverageEstimatedIllumination;
            Area = refSpace.Area;
            CeilingReflectance = refSpace.CeilingReflectance;
            FloorReflectance = refSpace.FloorReflectance;
            WallReflectance = refSpace.WallReflectance;
            CalcWorkPlane = refSpace.LightingCalculationWorkplane;
            ParentSpaceObject = refSpace;

            // Populate light fixtures list for RoomSpace
            FilteredElementCollector fec = new FilteredElementCollector(m_doc)
            .OfCategory(BuiltInCategory.OST_LightingFixtures)
            .OfClass(typeof(FamilyInstance));
            foreach (FamilyInstance fi in fec)
            {
                if (fi.Space.Id == refSpace.Id)
                {
                    ElementId eID = fi.GetTypeId();
                    Element e = m_doc.GetElement(eID);
                    //TaskDialog.Show("C","LF: SPACEID " + fi.Space.Id.ToString() + "\nSPACE ID: " + refSpace.Id.ToString());
                    LightFixtures.Add(new LightFixture(e,fi));
                }
            }
        }
开发者ID:kmorin,项目名称:LightingAnalysis,代码行数:35,代码来源:RoomSpace.cs

示例8: CheckDirectDataAccess

        private bool CheckDirectDataAccess(Namespace ns, List<Wire> wires, string dataModule, Reference reference, Service serv)
        {
            Component comp = serv.Component;
            bool hasDirectDataAccess = false;
            List<Binding> bindings = new List<Binding>();
            if (serv.Binding != null)
                bindings.Add(serv.Binding);
            if (reference.Binding != null)
                bindings.Add(reference.Binding);
            BindingTypeHolder binding = bindingGenerator.CheckForBindings(bindings);

            if (!binding.hasAnyBinding())
            {
                // direct access
                if (comp.Name == dataModule || dataModule == ANY && serv.Interface is Database)
                {
                    hasDirectDataAccess = true;
                }
                else
                {
                    // need to check
                    hasDirectDataAccess = HasDirectDataAccess(ns, wires, comp, dataModule);
                }
            }

            return hasDirectDataAccess;
        }
开发者ID:Bubesz,项目名称:soal-cs,代码行数:27,代码来源:DataAccessFinder.cs

示例9: CanContructEscapedReferences

        public void CanContructEscapedReferences()
        {
            var value = "identifier#property";
            var reference = new Reference(value);
            Assert.AreEqual(reference.Identifier, "identifier");
            Assert.AreEqual(reference.PropertyNames, new List<string> { "property" });
            Assert.AreEqual(value, reference.Value);

            value = ("identifier#property.subProperty");
            reference = new Reference(value);
            Assert.AreEqual(reference.Identifier, "identifier");
            Assert.AreEqual(reference.PropertyNames, new List<string> { "property", "subProperty" });
            Assert.AreEqual(value, reference.Value);

            value = @"\#identif\\\\\#ier\.\\#propertyName.\.abc\\.def";
            reference = new Reference(value);
            Assert.AreEqual(reference.Identifier, @"#identif\\#ier.\");
            Assert.AreEqual(reference.PropertyNames, new List<string> { "propertyName", @".abc\", "def" });
            Assert.AreEqual(value, reference.Value);

            value = @"#propertyName.\.abc\\.def";
            reference = new Reference(value);
            Assert.IsEmpty(reference.Identifier);
            Assert.AreEqual(reference.PropertyNames, new List<string> { "propertyName", @".abc\", "def" });
            Assert.AreEqual(value, reference.Value);
        }
开发者ID:qjw2bqn,项目名称:czml-writer,代码行数:26,代码来源:TestReference.cs

示例10: ToProtoType

        public static Autodesk.DesignScript.Geometry.Curve ToProtoType(this Autodesk.Revit.DB.Curve revitCurve, 
            bool performHostUnitConversion = true, Reference referenceOverride = null)
        {
            if (revitCurve == null)
            {
                throw new ArgumentNullException("revitCurve");
            }

            dynamic dyCrv = revitCurve;
            Autodesk.DesignScript.Geometry.Curve converted = RevitToProtoCurve.Convert(dyCrv);

            if (converted == null)
            {
                throw new Exception("An unexpected failure occurred when attempting to convert the curve");
            }

            converted = performHostUnitConversion ? converted.InDynamoUnits() : converted;

            // If possible, add a geometry reference for downstream Element creation
            var revitRef = referenceOverride ?? revitCurve.Reference;
            if (revitRef != null)
            {
                converted.Tags.AddTag(ElementCurveReference.DefaultTag, revitRef);
            }

            return converted;
        }
开发者ID:whztt07,项目名称:Dynamo,代码行数:27,代码来源:RevitToProtoCurve.cs

示例11: CreateDimensionElement

        /// <summary>
        /// Create a new dimension element using the given
        /// references and dimension line end points.
        /// This method opens and commits its own transaction,
        /// assuming that no transaction is open yet and manual
        /// transaction mode is being used.
        /// Note that this has only been tested so far using
        /// references to surfaces on planar walls in a plan
        /// view.
        /// </summary>
        public static void CreateDimensionElement(
            View view,
            XYZ p1,
            Reference r1,
            XYZ p2,
            Reference r2)
        {
            Document doc = view.Document;

              ReferenceArray ra = new ReferenceArray();

              ra.Append( r1 );
              ra.Append( r2 );

              Line line = Line.CreateBound( p1, p2 );

              using( Transaction t = new Transaction( doc ) )
              {
            t.Start( "Create New Dimension" );

            Dimension dim = doc.Create.NewDimension(
              view, line, ra );

            t.Commit();
              }
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:36,代码来源:CmdDimensionWallsIterateFaces.cs

示例12: IsIndexStale

        protected override bool IsIndexStale(IndexStats indexesStat, IStorageActionsAccessor actions, bool isIdle, Reference<bool> onlyFoundIdleWork)
        {
            var isStale = actions.Staleness.IsMapStale(indexesStat.Id);
            var indexingPriority = indexesStat.Priority;
            if (isStale == false)
                return false;

            if (indexingPriority == IndexingPriority.None)
                return true;

            if ((indexingPriority & IndexingPriority.Normal) == IndexingPriority.Normal)
            {
                onlyFoundIdleWork.Value = false;
                return true;
            }

            if ((indexingPriority & (IndexingPriority.Disabled | IndexingPriority.Error)) != IndexingPriority.None)
                return false;

            if (isIdle == false)
                return false; // everything else is only valid on idle runs

            if ((indexingPriority & IndexingPriority.Idle) == IndexingPriority.Idle)
                return true;

            if ((indexingPriority & IndexingPriority.Abandoned) == IndexingPriority.Abandoned)
            {
                var timeSinceLastIndexing = (SystemTime.UtcNow - indexesStat.LastIndexingTime);

                return (timeSinceLastIndexing > context.Configuration.TimeToWaitBeforeRunningAbandonedIndexes);
            }

            throw new InvalidOperationException("Unknown indexing priority for index " + indexesStat.Id + ": " + indexesStat.Priority);
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:34,代码来源:IndexingExecuter.cs

示例13: CommandManager

 public CommandManager(string clientId, Reference<Player> playerReference, IWorld word, INotificationService notificationService)
 {
     _clientId = clientId;
     _playerReference = playerReference;
     _world = word;
     _notificationService = notificationService;
 }
开发者ID:jrmitch120,项目名称:Legend,代码行数:7,代码来源:CommandManager.cs

示例14: ImplementInvokeMethodOnTarget

		protected override void ImplementInvokeMethodOnTarget(AbstractTypeEmitter @class, ParameterInfo[] parameters, MethodEmitter invokeMethodOnTarget, MethodInfo callbackMethod, Reference targetField)
		{
			invokeMethodOnTarget.CodeBuilder.AddStatement(
				new ExpressionStatement(
					new MethodInvocationExpression(SelfReference.Self, InvocationMethods.EnsureValidTarget)));
			base.ImplementInvokeMethodOnTarget(@class, parameters, invokeMethodOnTarget, callbackMethod, targetField);
		}
开发者ID:JulianBirch,项目名称:Castle.Core,代码行数:7,代码来源:InterfaceInvocationTypeGenerator.cs

示例15: Argument

        /// <summary>
        /// Initializes a new instance of the Argument class.
        /// </summary>
        /// <param name="name">The optional name of the argument.</param>
        /// <param name="modifiers">Modifers applied to this argument.</param>
        /// <param name="argumentExpression">The expression that forms the body of the argument.</param>
        /// <param name="location">The location of the argument in the code.</param>
        /// <param name="parent">The parent code part.</param>
        /// <param name="tokens">The tokens that form the argument.</param>
        /// <param name="generated">Indicates whether the argument is located within a block of generated code.</param>
        internal Argument(
            CsToken name, 
            ParameterModifiers modifiers, 
            Expression argumentExpression,
            CodeLocation location, 
            Reference<ICodePart> parent,
            CsTokenList tokens, 
            bool generated)
        {
            Param.Ignore(name);
            Param.Ignore(modifiers);
            Param.AssertNotNull(argumentExpression, "argumentExpression");
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.Ignore(tokens);
            Param.Ignore(generated);

            this.name = name;
            this.modifiers = modifiers;
            this.argumentExpression = argumentExpression;
            this.location = location;
            this.parent = parent;
            this.tokens = tokens;
            this.generated = generated;
        }
开发者ID:katerina-marchenkova,项目名称:my,代码行数:35,代码来源:Argument.cs


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