예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SessionOperations"/> class. Creates and registers
        /// the bus attachment, bus listener, bus object and interface for the application then establishes
        /// the alljoyn tcp connection.
        /// </summary>
        /// <param name="mp">Main page for the application</param>
        public SessionOperations(MainPage mp)
        {
            Task task = new Task(async() =>
            {
                try
                {
                    this.mainPage = mp;

                    this.busAtt      = new BusAttachment("Sessions", true, 4);
                    this.busObject   = new MyBusObject(this.busAtt, this);
                    this.busListener = new MyBusListener(this.busAtt, this);

                    this.busAtt.Start();
                    await this.busAtt.ConnectAsync(ConnectSpecs);
                }
                catch (Exception ex)
                {
                    var errMsg = AllJoynException.GetErrorMessage(ex.HResult);
                    this.mainPage.Output("Couldn't connect to AllJoyn: " + errMsg);
                }
            });

            task.Start();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SessionOperations"/> class. Creates and registers 
        /// the bus attachment, bus listener, bus object and interface for the application then establishes 
        /// the alljoyn tcp connection.
        /// </summary>
        /// <param name="mp">Main page for the application</param>
        public SessionOperations(MainPage mp)
        {
            Task task = new Task(async () =>
                {
                    try
                    {
                        this.mainPage = mp;

                        this.busAtt = new BusAttachment("Sessions", true, 4);
                        this.busObject = new MyBusObject(this.busAtt, this);
                        this.busListener = new MyBusListener(this.busAtt, this);

                        this.busAtt.Start();
                        await this.busAtt.ConnectAsync(ConnectSpecs);
                    }
                    catch (Exception ex)
                    {
                        var errMsg = AllJoynException.GetErrorMessage(ex.HResult);
                        this.mainPage.Output("Couldn't connect to AllJoyn: " + errMsg);
                    }
                });
                task.Start();
        }