Ejemplo n.º 1
0
        public void BroadcastExecuteOnClientTest()
        {
            ClientCall remoteCall = null; // TODO: Initialize to an appropriate value

            RemoteExecution.BroadcastExecuteOnClient(remoteCall);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The override does not send anything but makes a client call
        /// </summary>
        public override void ExecuteResult(ControllerContext context)
        {
            //make the client call
            if (string.IsNullOrEmpty(this.Call.ClientId))
            {
                RemoteExecution.BroadcastExecuteOnClient(this.Call);
            }
            else
            {
                RemoteExecution.ExecuteOnClient(this.Call, false);
                //wait until the call has been made so the connection is not trunckated
                int len = (int)(string.Concat("data:", this.Call.ToString(), "\n").Length / 20);
                while (true)
                {
                    if (SseHelper.ConnectionsMade.Contains(this.Call.ClientId))
                    {
                        break;
                    }
                    //wait a few miliseconds
                    Thread.Sleep(len);
                }

                //send just success
                var jsonp = new JavaScriptSerializer().Serialize(new { success = true });
                context.HttpContext.Response.ContentType = "application/json";
                context.HttpContext.Response.Write(jsonp);
            }
        }
        public static void ReloadUserList()
        {
            dynamic reload = new ClientCall {
                CallerId = string.Empty, ClientId = string.Empty
            };

            reload.getUsers();
            RemoteExecution.BroadcastExecuteOnClient(reload);
        }