private void data_spectacles_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { SpectacleTheater spectacle = new SpectacleTheater(); spectacle = spectacle_theater[e.RowIndex]; SpectacleForm spectacle_form = new SpectacleForm(spectacle); spectacle_form.Show(); }
public SpectacleForm(SpectacleTheater spectacle_theater) { InitializeComponent(); spectacle_Theater = spectacle_theater; this.Cursor = Cursors.WaitCursor; var webClient = new WebClient(); var webClient2 = new WebClient(); string url = "http://94.230.164.34:8080/api/PictureSpectacle?id=" + spectacle_Theater.Id_spectacle; webClient.DownloadDataCompleted += DownloadDataCompleted; webClient.DownloadDataTaskAsync(url); spectacle_title_lbl.Text = spectacle_Theater.Spectacle_title; site_lbl.Text = spectacle_Theater.Spectacle_link; rating_lbl.Text += spectacle_Theater.Spectacle_rating; spectacle_title_lbl.Left = 750 - spectacle_title_lbl.Width / 2; site_lbl.Left = 750 - site_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 (spectacle_Theater.Spectacle_description != null) { web.DocumentText = spectacle_Theater.Spectacle_description; } else { web.DocumentText = Description.empty_description; } url = "http://94.230.164.34:8080/api/CommentSpectacle?id=" + spectacle_Theater.Id_spectacle; try { string response_comments = Encoding.UTF8.GetString(webClient2.DownloadData(url)); comments = JsonConvert.DeserializeObject <List <Comment_Spectacle> >(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(); } } }