예제 #1
0
        static async Task ListApps(Lassie.Client client)
        {
            var apps = await client.ListApplicationsAsync();

            foreach (Lassie.Application app in apps.Applications)
            {
                Console.WriteLine("App EUI: {0} name: {1}", app.ApplicationEUI, app.Tags["name"]);
            }
        }
예제 #2
0
파일: Node.cs 프로젝트: stalehd/LassieSharp
        public NodeTree(Lassie.Client c)
        {
            client       = c;
            Path         = "/";
            CurrentEntry = Root;

            var apps = new Node {
                Parent = Root, Name = "applications"
            };
            var gateways = new Node {
                Parent = Root, Name = "gateways"
            };

            Root.Children = () =>
            {
                var ret = new List <Node>();
                ret.Add(apps);
                ret.Add(gateways);
                return(ret);
            };
            Root.Attributes = () => new List <string>();
            apps.Children   = () =>
            {
                var a  = new List <Node>();
                var al = client.ListApplicationsAsync();
                al.Wait();
                foreach (Lassie.Application app in al.Result.Applications)
                {
                    a.Add(AppNodeFromApplication(app, apps));
                }
                return(a);
            };
            gateways.Children = () =>
            {
                var g  = new List <Node>();
                var gl = client.ListGatewaysAsync();
                gl.Wait();
                foreach (Lassie.Gateway gw in gl.Result.Gateways)
                {
                    g.Add(GwNodeFromGateway(gw, gateways));
                }
                return(g);
            };
            apps.Attributes     = () => new List <string>();
            gateways.Attributes = () => new List <string>();
        }