private void handleRequest(HttpListenerContext context) { var eventArgs = new HttpEventArgs(context.Request, context.Response); var method = context.Request.HttpMethod; try { if (method == HttpMethod.Get.Method) { OnGet?.Invoke(this, eventArgs); } else if (method == HttpMethod.Post.Method) { OnPost?.Invoke(this, eventArgs); } else if (method == HttpMethod.Put.Method) { OnPut?.Invoke(this, eventArgs); } } catch (NotImplementedException) { context.Response.Abort(); } }
public void Post(string host, string path, string json, Action <string, FizzException> callback) { if (OnPost != null) { OnPost.Invoke(host, path, json); } }
public void Post(string title, string summary, IEnumerable <NamedAction> tasks) { var post = new EventPost(title, summary, tasks); Items.Add(post); OnPost.InvokeIfExists(post); }
public override void HandleEvent(NodeEvent eventValue) { if (eventValue is ViewActionEvent) { switch (((ViewActionEvent)eventValue).Action) { case (SourceActions.Post): if (OnPost != null) { OnPost.Execute(); } break; case (SourceActions.Cancel): if (OnCancel != null) { OnCancel.Execute(); } break; } } base.HandleEvent(eventValue); }
protected virtual void OnPostAction(PostEventArgs <string> e) { OnPost?.Invoke(this, e); }
private void onRequest(HttpListenerContext context) { var req = context.Request; var res = context.Response; var eventArgs = new HttpRequestEventArgs(context); if (req.HttpMethod == "GET" && !OnGet.IsNull()) { OnGet(this, eventArgs); return; } if (req.HttpMethod == "HEAD" && !OnHead.IsNull()) { OnHead(this, eventArgs); return; } if (req.HttpMethod == "POST" && !OnPost.IsNull()) { OnPost(this, eventArgs); return; } if (req.HttpMethod == "PUT" && !OnPut.IsNull()) { OnPut(this, eventArgs); return; } if (req.HttpMethod == "DELETE" && !OnDelete.IsNull()) { OnDelete(this, eventArgs); return; } if (req.HttpMethod == "OPTIONS" && !OnOptions.IsNull()) { OnOptions(this, eventArgs); return; } if (req.HttpMethod == "TRACE" && !OnTrace.IsNull()) { OnTrace(this, eventArgs); return; } if (req.HttpMethod == "CONNECT" && !OnConnect.IsNull()) { OnConnect(this, eventArgs); return; } if (req.HttpMethod == "PATCH" && !OnPatch.IsNull()) { OnPatch(this, eventArgs); return; } res.StatusCode = (int)HttpStatusCode.NotImplemented; }
void Post(string path, System.Collections.Specialized.NameValueCollection query) { OnPost?.Invoke(path, query); }
public void UpdateData <T>(string path, T data, OnPost callback) { string url = String.Format("{0}{1}.json", databaseRoot, path); RestClient.Put <T>(url, data).Then(response => { callback(); }); }
protected void OnPostAction(PostEventArgs <Dictionary <string, object> > e) { OnPost?.Invoke(this, e); }
protected virtual void OnPostAction(PostEventArgs <ObjectType> e) { OnPost?.Invoke(this, e); }