private void data_places_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { PlaceWriter place = new PlaceWriter(); place = place_writer[e.RowIndex]; PlaceForm place_form = new PlaceForm(place); place_form.Show(); }
public PlaceForm(PlaceWriter place_writer) { InitializeComponent(); place_Work = null; place_Writer = place_writer; this.Cursor = Cursors.WaitCursor; var webClient = new WebClient(); var webClient2 = new WebClient(); string url = "http://94.230.164.34:8080/api/PicturePlace?id=" + place_Writer.Id_place; webClient.DownloadDataCompleted += DownloadDataCompleted; webClient.DownloadDataTaskAsync(url); place_name_lbl.Text = place_Writer.Place_name; adress_lbl.Text += place_Writer.Place_address; rating_lbl.Text += place_Writer.Place_rating; place_name_lbl.Left = 750 - place_name_lbl.Width / 2; adress_lbl.Left = 750 - adress_lbl.Width / 2; rating_lbl.Left = 750 - rating_lbl.Width / 2; if (MainForm.user != null) { mark_lbl.Visible = true; mark_combo.Visible = true; add_lbl.Visible = true; add_combo.Visible = true; data_comments.AllowUserToAddRows = true; } if (place_Writer.Place_description != null) { web.DocumentText = place_Writer.Place_description; } else { web.DocumentText = Description.empty_description; } url = "http://94.230.164.34:8080/api/CommentPlace?id=" + place_Writer.Id_place; try { string response_comments = Encoding.UTF8.GetString(webClient2.DownloadData(url)); comments = JsonConvert.DeserializeObject <List <Comment_Place> >(response_comments); data_comments.Rows.Clear(); for (int i = 0; i < comments.Count; i++) { data_comments.Rows.Add(); data_comments.Rows[i].Cells[0].Value = comments[i].Comment; data_comments.Rows[i].Cells[1].Value = comments[i].Nick; data_comments.Rows[i].Cells[2].Value = comments[i].Date.Value.Day.ToString() + "." + comments[i].Date.Value.Month.ToString() + "." + comments[i].Date.Value.Year.ToString(); data_comments.Rows[i].ReadOnly = true; } } catch { Messages.ErrorComments(); } if (MainForm.user != null) { url = "http://94.230.164.34:8080/api/Routes?nick=" + MainForm.user.Nick; try { response = Encoding.UTF8.GetString(webClient.DownloadData(url)); route_writer = JsonConvert.DeserializeObject <List <RouteWriter> >(response); add_combo.Items.Clear(); for (int i = 0; i < route_writer.Count; i++) { add_combo.Items.Add(route_writer[i].Route_name); } } catch { Messages.ErrorRoutes(); } } }