public void SendRequestToServer(MyRequestMethod requestMethod, RequestUser requestUser, OnRequestCompletedMethod method) { BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_Completed); Tuple<MyRequestMethod, RequestUser, OnRequestCompletedMethod> tuple = Tuple.Create<MyRequestMethod, RequestUser, OnRequestCompletedMethod>(requestMethod, requestUser, method); backgroundWorker.RunWorkerAsync(tuple); }
private string GetRequestMethod(MyRequestMethod request) { return "POST"; }
private string GetRequestAdress(MyRequestMethod request) { if (request == MyRequestMethod.CreateUser) { if (USEDEVSERVER) return CREATEUSER_DEV; else return CREATEUSER; } if (request == MyRequestMethod.GetUser) { if (USEDEVSERVER) return GETUSER_DEV; else return GETUSER; } if (request == MyRequestMethod.AddWall) { if (USEDEVSERVER) return ADDWALL_DEV; else return ADDWALL; } if (request == MyRequestMethod.CreateMessage) { if (USEDEVSERVER) return CREATEMESSAGE_DEV; else return CREATEMESSAGE; } return ""; }