1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | public QResult ExecuteCode(QCode code) { if (this.User == null) throw new Exception("Not logged in."); QResult result = new QResult(); string url = string.Format("/codes/execute?shots={0}&seed={1}&deviceRunType={2}", code.shots.ToString(), code.seed.ToString(), code.deviceRunType ); string data = string.Format("qasm={0}&codeType={1}&name={2}", code.qasm, code.codeType, code.name ); var kvp = new List<KeyValuePair<string, string>>(); kvp.Add(new KeyValuePair<string, string>("qasm", code.qasm)); kvp.Add(new KeyValuePair<string, string>("codeType", code.codeType)); kvp.Add(new KeyValuePair<string, string>("name", code.name)); HttpContent content = new FormUrlEncodedContent(kvp); result = FetchAPIData(url, HttpMethod.Post, content); Debug.WriteLine("ExecuteCode received the following JSON from the API:"); Debug.WriteLine(result.Message); return result; } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |