Пример #1
0
        private void Button_Click2(object sender, RoutedEventArgs e)
        {
            int          ret;
            IAsyncAction ConnectAction = Windows.System.Threading.ThreadPool.RunAsync((ConnectThread) =>
            {
                SID = iotc.IOTC_Get_SessionID();
                ret = iotc.IOTC_Connect_ByUID_Parallel("XXXXXXXXXXXXXXXXXXXXX", SID); //put UID here

                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                    Windows.UI.Core.CoreDispatcherPriority.High,
                    new Windows.UI.Core.DispatchedHandler(() =>
                {
                    UpdateUI("IOTC_Get_SessionID = " + SID + ", Connect [" + ret + "]");
                }));



                nRDTIndex = rdt.RDT_Create(SID, RDT_WAIT_TIMEMS, 0);
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                    Windows.UI.Core.CoreDispatcherPriority.High,
                    new Windows.UI.Core.DispatchedHandler(() =>
                {
                    UpdateUI("RDT Create [" + nRDTIndex + "]");
                }));
                if (nRDTIndex < 0)
                {
                    iotc.IOTC_Session_Close(SID);
                    iotc.IOTC_DeInitialize();
                    rdt.RDT_DeInitialize();
                }
            });
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int ret;

            ret              = IOTC1.IOTC_Initialize2(0);
            textblock1.Text += "\nInitialize = " + ret + "\n";

            IAsyncAction ConnectAction = Windows.System.Threading.ThreadPool.RunAsync((ConnectThread) =>
            {
                SID = IOTC1.IOTC_Get_SessionID();
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                    Windows.UI.Core.CoreDispatcherPriority.High,
                    new Windows.UI.Core.DispatchedHandler(() =>
                {
                    UpdateUI("IOTC_Get_SessionID = [" + SID + "]\n");
                }));
                ret = IOTC1.IOTC_Connect_ByUID_Parallel("XXXXXXXXXXXXXXXXXX", SID); //put UID here
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                    Windows.UI.Core.CoreDispatcherPriority.High,
                    new Windows.UI.Core.DispatchedHandler(() =>
                {
                    UpdateUI("Connect = [" + ret + "]\n");
                }));
            });
        }
Пример #3
0
        private void Button_Click2(object sender, RoutedEventArgs e)
        {
            int ret;

            byte[] acc = new byte[20];
            byte[] pwd = new byte[20];

            acc = System.Text.Encoding.UTF8.GetBytes("admin");
            pwd = System.Text.Encoding.UTF8.GetBytes("888888");

            tutk.iotc.ClientStartInfo clientInfo = new tutk.iotc.ClientStartInfo();

            IAsyncAction ConnectAction = Windows.System.Threading.ThreadPool.RunAsync((ConnectThread) =>
            {
                SID = IOTC1.IOTC_Get_SessionID();
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                    Windows.UI.Core.CoreDispatcherPriority.High,
                    new Windows.UI.Core.DispatchedHandler(() =>
                {
                    UpdateUI("IOTC_Get_SessionID = " + ret);
                }));

                ret = IOTC1.IOTC_Connect_ByUID_Parallel("XXXXXXXXXXXXXXXXXXXX", SID); //put UID here
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                    Windows.UI.Core.CoreDispatcherPriority.High,
                    new Windows.UI.Core.DispatchedHandler(() =>
                {
                    UpdateUI("IOTC Connect = " + ret);
                }));

                avIndex = AV1.avClientStart(SID, acc, pwd, 10, clientInfo, 0);
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                    Windows.UI.Core.CoreDispatcherPriority.High,
                    new Windows.UI.Core.DispatchedHandler(() =>
                {
                    UpdateUI("avClientStart = " + avIndex);
                }));
            });
        }