Пример #1
0
        public Task <IExplorerObject> CreateInstanceByFullName(string FullName, ISerializableExplorerObjectCache cache)
        {
            if (cache.Contains(FullName))
            {
                return(Task.FromResult(cache[FullName]));
            }

            if (FullName == this.FullName)
            {
                WMSExplorerObject exObject = new WMSExplorerObject(this.ParentExplorerObject);
                cache.Append(exObject);
                return(Task.FromResult <IExplorerObject>(exObject));
            }
            return(Task.FromResult <IExplorerObject>(null));
        }
Пример #2
0
        public IExplorerObject CreateInstanceByFullName(string FullName, ISerializableExplorerObjectCache cache)
        {
            if (cache.Contains(FullName))
            {
                return(cache[FullName]);
            }

            if (FullName == this.FullName)
            {
                WMSExplorerObject exObject = new WMSExplorerObject(this.ParentExplorerObject);
                cache.Append(exObject);
                return(exObject);
            }
            return(null);
        }
Пример #3
0
        async public Task <IExplorerObject> CreateInstanceByFullName(string FullName, ISerializableExplorerObjectCache cache)
        {
            if (cache.Contains(FullName))
            {
                return(cache[FullName]);
            }

            FullName = FullName.Replace("/", @"\");
            int lastIndex = FullName.LastIndexOf(@"\");

            if (lastIndex == -1)
            {
                return(null);
            }

            string cnName = FullName.Substring(0, lastIndex);
            string svName = FullName.Substring(lastIndex + 1, FullName.Length - lastIndex - 1);

            WMSExplorerObject cnObject = new WMSExplorerObject(this);

            cnObject = await cnObject.CreateInstanceByFullName(cnName, cache) as WMSExplorerObject;

            if (cnObject == null || await cnObject.ChildObjects() == null)
            {
                return(null);
            }

            foreach (IExplorerObject exObject in await cnObject.ChildObjects())
            {
                if (exObject.Name == svName)
                {
                    cache.Append(exObject);
                    return(exObject);
                }
            }
            return(null);
        }