Esempio n. 1
0
        public static Event DoEvent(this IEventSource self,
                                    string name,
                                    EventReturnMethod returnMethod,
                                    PythonDictionary args = null)
        {
            args = args ?? new PythonDictionary();
            var argList = args.Select(EventArg.Convert)
                          .ToList();

            return(self.DoEvent(name, returnMethod, argList));
        }
Esempio n. 2
0
 public static Event Create(string name, EventReturnMethod returnMethod, PythonDictionary parameters)
 {
     return(new Event(name,
                      returnMethod,
                      parameters?.Select(p => new EventArg(( string )p.Key, p.Value))));
 }
Esempio n. 3
0
		/// <summary>
		/// 指定したメソッドを使用して、指定したリソースに指定した辞書をアップロードします。
		/// </summary>
		/// <param name="self">WebClient インスタンス。</param>
		/// <param name="address">コレクションを受信するリソースの URI。</param>
		/// <param name="method">リソースに文字列を送信するために使用する HTTP メソッド。</param>
		/// <param name="dict">リソースに送信する dict。</param>
		/// <returns>サーバーが送信した応答を格納している文字列。</returns>
		public static string UploadDict(this WebClient self, string address, string method, PythonDictionary dict)
		{
			self.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded; charset=UTF-8";

			return self.UploadString(address, method ?? "POST", dict.Select(_ => Uri.EscapeDataString((_.Key ?? "").ToString()) + "=" + Uri.EscapeDataString((_.Value ?? "").ToString())).Join("&"));
		}