Ejemplo n.º 1
0
        /// <summary>
        /// Starts the application.
        /// </summary>
        /// <param name="config">Options to run with.</param>
        /// <returns></returns>
        private static async Task Run(MambaConfiguration config)
        {
            using (var experience = new ExperienceController(new ExperienceControllerConfig
            {
                AppId = config.ExperienceId,
                TrellisToken = config.Token,
                TrellisUrl = config.TrellisUrl
            }))
            {
                ElementData elements;
                // load experience first
                try
                {
                    elements = await experience.Initialize();
                }
                catch (Exception exception)
                {
                    Log.Error($"Could not initialize experience: '{exception}'.");

                    return;
                }

                using (var network = new MyceliumController(new MyceliumControllerConfiguration
                {
                    Ip = config.MyceliumIp,
                    Port = config.MyceliumPort,
                    Token = config.Token
                }))
                {
                    using (var kinect = new KinectController(new KinectControllerConfiguration(), network, elements))
                    {
                        network.Start();
                        kinect.Start();

                        Console.ReadLine();

                        Log.Information("Shutting down.");
                    }
                }
            }
        }