Esempio n. 1
0
        public static Task <Server> GetServerById(string serverId, string serverKind)
        {
            return(Task.Run(() =>
            {
                var context = new ServerIdContext
                {
                    t = new TaskCompletionSource <Server>(),
                    serverId = serverId,
                };

                var handle = GCHandle.Alloc(context, GCHandleType.Normal);
                var callback = new ServerByIdCallback(GetServerByIdCallback);

                pitaya_server_by_id(pitaya, serverId, serverKind, callback, GCHandle.ToIntPtr(handle));

                return context.t.Task;
            }));
        }
Esempio n. 2
0
 private static extern bool pitaya_server_by_id(
     IntPtr pitaya,
     string serverId,
     string serverKind,
     ServerByIdCallback callback1,
     IntPtr userData);