Ejemplo n.º 1
0
        private void MainLoop()
        {
            var conf = new cycle_conf()
            {
                connection_n = 10,
            };

            cycle = Lib.cycle_create(ref conf, false);

            session = Lib.session_create_client_by_url(cycle, serverUrl);

            if (onDataReceiveCallback != null)
            {
                thisHandle = GCHandle.Alloc(this);
                Lib.session_set_userdata(session, (IntPtr)thisHandle);
                Lib.session_set_receive_function(session, HandleReceive);
            }
            if (onStatusChangeCallback != null)
            {
                Lib.session_set_status_change_function(session, HandleStatusChange);
            }
            Lib.session_connect(session);

            started = true;

            while (!taskCancelSource.IsCancellationRequested && pauseHandle.WaitOne())
            {
                lock (this)
                {
                    Lib.cycle_step(cycle, 1);
                    Lib.session_getinfo(session, ref info);
                }
                Thread.Sleep(1);
            }
        }
Ejemplo n.º 2
0
Archivo: Lib.cs Proyecto: Tx203035/mlc
 public static extern IntPtr cycle_create(ref cycle_conf conf, bool is_server);