public override Task <ILazyTreeNode <INetDiskFile> > GetFileRootAsync()
        {
            var tree = new LazyTreeNode <INetDiskFile>(new BaiduNetdiskFile()
            {
                Owner = this,
                Path  = "/"
            })
            {
                ChildrenProvider = async parent =>
                {
                    var result = new List <BaiduNetdiskFile>();
                    var page   = 1;
                    do
                    {
                        var files = await Api.GetFileListAsync(Token, parent.Path, page);

                        if (files.FileList.Count == 0)
                        {
                            break;
                        }
                        result.AddRange(files.FileList);
                        page++;
                    } while (true);
                    result.ForEach(v => v.Owner = this);
                    return(result);
                }
            };

            return(Task.FromResult((ILazyTreeNode <INetDiskFile>)tree));
        }
        private TreeNode GetRecordsetNode(AccessRecordsetModel model)
        {
            var result = new LazyTreeNode(model).Add(GetDaoFieldsParentNode(model.Fields));

            if (model.Connection != null)
            {
                result.Add(new LazyTreeNode("Connection", model.Connection).Add(GetConnectionNode(model.Connection)));
            }

            result.AddRange(() => GetObjectPropertiesAsTreeNodes(model));

            return(result);
        }
예제 #3
0
        public override Task <ILazyTreeNode <INetDiskFile> > GetFileRootAsync()
        {
            var tree = new LazyTreeNode <INetDiskFile>(new SixCloudFile())
            {
                ChildrenProvider = async parent =>
                {
                    var json = await WebApi.GetFilesByPathAsync(new GetFilesByPathArgs { Path = parent.Path, PageSize = 999 });

                    return(json.Success
                        ? json.Result["list"].Select(item => item.ToObject <SixCloudFile>()).ToList()
                        : Enumerable.Empty <SixCloudFile>());
                }
            };

            return(Task.FromResult <ILazyTreeNode <INetDiskFile> >(tree));
        }
예제 #4
0
        public override Task <ILazyTreeNode <INetDiskFile> > GetFileRootAsync()
        {
            var tree = new LazyTreeNode <INetDiskFile>(new OnedriveFile()
            {
                Owner = this
            })
            {
                ChildrenProvider = async parent =>
                {
                    var result = new List <OnedriveFile>();
                    if (parent.Path == "/")
                    {
                        result.AddRange((await Api.GetRootFilesAsync()).FileList);
                    }
                    else
                    {
                        var tmp = await Api.GetFilesAsync(parent.Path);

                        result.AddRange(tmp.FileList);
                        while (!string.IsNullOrEmpty(tmp.NextPage))
                        {
                            using (var client = new HttpClient()
                            {
                                DefaultRequestHeaders =
                                {
                                    Authorization = new AuthenticationHeaderValue("Bearer", AccessToken)
                                }
                            })
                            {
                                tmp = JsonConvert.DeserializeObject <OnedriveListFileResult>(await client.GetStringAsync(tmp.NextPage));
                                result.AddRange(tmp.FileList);
                            }
                        }
                    }

                    result.ForEach(v => v.Owner = this);
                    return(result);
                }
            };

            return(Task.FromResult((ILazyTreeNode <INetDiskFile>)tree));
        }
        private List <TreeNode> GetApplicationNodes(RotApplicationModel rotApplicationModel)
        {
            var result = new List <TreeNode>();
            //var app = rotApplicationModel.Application;
            var model = new AccessApplicationModel(rotApplicationModel.Application);

            var vbe             = model.VBE.Value;
            var vbeProjectsNode = new LazyTreeNode(vbe.Projects).AddRange(() => vbe.Projects.Select(p => new LazyTreeNode(p)));
            var vbeWindowsNode  = new LazyTreeNode(vbe.Windows).AddRange(() => vbe.Windows.Select(w => new LazyTreeNode(w)));
            var vbeAddinsNode   = new LazyTreeNode(vbe.Addins).AddRange(() => vbe.Addins.Select(a => new LazyTreeNode(a)));

            var vbeNode = new LazyTreeNode(vbe)
                          .AddRange(() =>
                                    new TreeNode[] {
                new LazyTreeNode("MainWindow").AddRange(() => GetObjectPropertiesAsTreeNodes(vbe.MainWindow)),
                vbeWindowsNode,
                new LazyTreeNode("Active project").AddRange(() => GetVBProjectNodes(vbe.ActiveVBProject)),
                vbeProjectsNode,
                vbeAddinsNode
            }
                                    );

            result.Add(vbeNode);

            var tempVars = model.TempVars.Value;

            if (tempVars.Any())
            {
                result.Add(new TreeNode($"Temp Vars", tempVars.Select(t => new TreeNode(t.ToString())).ToArray()));
            }

            result.Add(GetCurrentProjectParentNode(model.CurrentProject));

            result.AddRange(GetObjectPropertiesAsTreeNodes(model));

            return(result);
        }
예제 #6
0
        public override Task <ILazyTreeNode <INetDiskFile> > GetFileRootAsync()
        {
            var tree = new LazyTreeNode <INetDiskFile>(new SixCloudFile()
            {
                Owner = this
            })
            {
                ChildrenProvider = async parent =>
                {
                    var result = new List <SixCloudFile>();
                    var json   = await Api.GetFilesByPathAsync(new GetFilesByPathArgs { Path = parent.Path, PageSize = 999 });

                    if (!json.Success)
                    {
                        return(result);
                    }
                    result = json.Result["list"].Select(v => v.ToObject <SixCloudFile>()).ToList();
                    result.ForEach(v => v.Owner = this);
                    return(result);
                }
            };

            return(Task.FromResult((ILazyTreeNode <INetDiskFile>)tree));
        }