private async Task PageHasCertificate(string url) { // if site has certificate than it will load by https:// url = url.Replace("http://", "https://"); try { if (WebRequest.Create(url) is HttpWebRequest request) { request.Method = "HEAD"; HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse; response?.Close(); } siteAddress.Text = url; pageHasCerificate = true; } catch (NullReferenceException exception) { CustomMessages.DisplayCustomErrorMsg("NullReferenceException", exception.Message); pageHasCerificate = false; } catch (Exception exception) { CustomMessages.DisplayCustomErrorMsg("UnrecognizedException", exception.Message); pageHasCerificate = false; } // TODO: Obsługa poszczególnych wyjątków, tak aby poinformować użytkownika nie tylko o tym, że nie udało się nawiązać połączenia, ale również czemu to się nie udało }
private void DataGridView_SelectionChanged(object sender, EventArgs e) { // recognize whether selection changed and make changes to singleDataGridView DataGridView view = sender as DataGridView; PrepareSingleDataGridView(view); if (view == null) { return; } if (view.SelectedCells.Count >= 1) { DataGridViewRow selectedRow = view.Rows[view.SelectedCells[0].RowIndex]; int corrector = 0; for (int index = 0; index < selectedRow.Cells.Count; index++) { try { if (selectedRow.Cells[index].OwningColumn.Visible) { singleRowDataTable.Rows[index - corrector].SetField(1, selectedRow.Cells[index].Value); } else { corrector++; } } catch { CustomMessages.DisplayCustomErrorMsg("Something went wrong while displaying selected row in single row view -> DataGridView_SelectionChanged()", "Single row view Error"); break; } } } }