public static void LoadStage(DemoStage stage) { Instance.stage = stage; switch (stage) { case DemoStage.Original: Application.LoadLevel("stage_original"); break; case DemoStage.Digitized: Application.LoadLevel(0); break; case DemoStage.FileCabinet: Application.LoadLevel(0); break; case DemoStage.ScrapPaper: Application.LoadLevel(0); break; case DemoStage.Robot: Application.LoadLevel(0); break; case DemoStage.Brain: Application.LoadLevel(0); break; } }
public static async Task <HttpResponseMessage> Invoke(string serviceUrl, string json, HttpMethod method, string token = "", DemoStage dateFilter = DemoStage.None) { HttpClient client = new HttpClient(); try { string requestURL = ServerBaseURL + serviceUrl; if (dateFilter != DemoStage.None) { requestURL = requestURL + "?DateFilter=" + (int)dateFilter; } HttpRequestMessage request = new HttpRequestMessage(method, requestURL); client.DefaultRequestHeaders .Accept .Add(new MediaTypeWithQualityHeaderValue("application/json")); //ACCEPT header if (!string.IsNullOrEmpty(token)) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); } if (!string.IsNullOrEmpty(json)) { request.Content = new StringContent(json, Encoding.UTF8, "application/json"); //CONTENT-TYPE header; //request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", bootstrapContext.Token); } return(await client.SendAsync(request)); } catch (Exception ex) { HttpResponseMessage responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, ReasonPhrase = ex.Message, Content = new StringContent(ex.Message) }; return(responseMessage); } }