コード例 #1
0
ファイル: NameScopeTests.cs プロジェクト: Carbonfrost/f-core
        public void FindName_should_traverse_to_parent_scope()
        {
            var parent   = new NameScope();
            var instance = new object();

            parent.RegisterName("c", instance);
            var ns = new NameScope(parent);

            Assert.Same(instance, ns.FindName("c"));
        }
コード例 #2
0
        /// <summary>
        /// Sets the image of the field the fighter is moving to to it's own image
        /// </summary>
        /// <param name="pDTO"> The fighter that is moving </param>
        public void SetsImage(Fighter_DTO pDTO)
        {
            Image ima = new Image();
            //gets image from participant to move.
            string image = pDTO.ImageGS;

            //finds the image field based on the coords
            string arenaFieldName = pDTO.PointGS.ToString();

            ima         = (Image)ScopeName.FindName(arenaFieldName);
            ima.Stretch = Stretch.Fill;
            ima.Source  = new BitmapImage(new Uri(System.IO.Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\Sources\\" + image));
        }
コード例 #3
0
 void ResolvePendingReferences()
 {
     foreach (var fixup in pending_name_references)
     {
         foreach (var name in fixup.Names)
         {
             bool isFullyInitialized;
             // FIXME: sort out relationship between name_scope and name_resolver. (unify to name_resolver, probably)
             var obj = name_scope.FindName(name) ?? name_resolver.Resolve(name, out isFullyInitialized);
             if (obj == null)
             {
                 throw new XamlObjectWriterException(String.Format("Unresolved object reference '{0}' was found", name));
             }
             if (!AddToCollectionIfAppropriate(fixup.ParentType, fixup.ParentMember, fixup.ParentValue, obj, null))                      // FIXME: is keyObj always null?
             {
                 fixup.ParentMember.Invoker.SetValue(fixup.ParentValue, obj);
             }
         }
     }
 }
コード例 #4
0
ファイル: ResourceContextBar.cs プロジェクト: Egaros/lib
 object INameScope.FindName(string name)
 {
     return(_nameScope.FindName(name) ?? NameScope.FindName(this, name));
 }
コード例 #5
0
 object INameScope.FindName(string s)
 {
     return(ns.FindName(s));
 }