static void Main(string[] args) { LibNews kek = new LibNews(); kek.Title = "Новая Новость"; kek.ReleaseDate = DateTime.Now; kek.TextContent = "Очень интересное описание новости"; int?proxyPort = 8000; // 18000; if (proxyPort.HasValue) { // mitmweb --web-port 28000 --listen-port 18000 --mode reverse:http://localhost:13044 var kk = new NewsServiceClient("BasicHttpBinding_INewsService", $"http://localhost:{proxyPort.Value}/INewService"); var ar = kk.SelectAllCategory(); foreach (var item in ar) { Console.WriteLine(item.NameCat); } kk.CreateNewWithCat(kek, new string[] { "Актуально сейчас", "Актуально всегда" }); Console.WriteLine("Querying through proxy has been completed"); } Console.ReadLine(); }
private void btAdd_Click(object sender, EventArgs e) { lbConnecting.Visible = true; try { LibNews addingNews = new LibNews(); addingNews.Title = tbTitle.Text; addingNews.ReleaseDate = DateTime.Now; addingNews.TextContent = tbTextContent.Text; string restaurantName = cbRestaurantAdd.Text; var NSC = new NewsServiceClient("BasicHttpBinding_INewsService", $"http://{wcfServerIp}/INewService"); NSC.CreateNewWithCatAndRest(addingNews, new string[] { cbCategory.Text }, restaurantName, null); cbRestaurantAdd.Text = ""; cbCategory.Text = ""; tbTitle.Text = ""; tbTextContent.Text = ""; } catch (Exception) { MessageBox.Show("News server is not connected right now"); } finally { lbConnecting.Visible = false; } }