Пример #1
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            // Initialize the DSLink platform-specific library.
            UWPPlatform.Initialize();
            //Task.Run(ExampleDSLink.InitializeLink);
            try
            {
                ExampleDSLink.InitializeLink().Wait();
            }
            catch (AggregateException e)
            {
                foreach (Exception i in e.InnerExceptions)
                {
                    Debug.WriteLine(i.InnerException.GetType().FullName);
                    Debug.WriteLine(i.InnerException.Message);
                    Debug.WriteLine(i.InnerException.StackTrace);
                }
            }
            catch (KeyNotFoundException e)
            {
                Debug.WriteLine(e.StackTrace);
            }

            InitializeComponent();
            Suspending += OnSuspending;
        }
Пример #2
0
        public static async Task InitializeLink()
        {
            var dslink =
                new ExampleDSLink(new Configuration(new List <string>(), "sdk-dotnet",
                                                    responder: true, requester: true,
                                                    brokerUrl: "http://192.168.1.90:8090/conn",
                                                    loadNodesJson: false, logLevel: LogLevel.Debug,
                                                    communicationFormat: "json"));

            await dslink.Connect();
        }