コード例 #1
0
ファイル: ExplorerObjects.cs プロジェクト: jugstalt/gview5
        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
ファイル: ExplorerObjects.cs プロジェクト: jugstalt/gview5
        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);
        }