void frmMain_Shown(object sender, EventArgs e) { Application.DoEvents(); ConnectionTest.ConnectionTest ct = new ConnectionTest.ConnectionTest(); ct.DohvatiListuMjestaCompleted += ct_DohvatiListuMjestaCompleted; ct.DohvatiListuMjestaAsync(); Application.DoEvents(); ConnectionTest.ConnectionTest ct1 = new ConnectionTest.ConnectionTest(); ct1.DohvatiListuInternetProvideraCompleted += ct_DohvatiListuInternetProvideraCompleted; ct1.DohvatiListuInternetProvideraAsync(); Application.DoEvents(); ConnectionTest.ConnectionTest ct2 = new ConnectionTest.ConnectionTest(); ct2.DohvatiListuOsCompleted += ct2_DohvatiListuOsCompleted; ct2.DohvatiListuOsAsync(); Application.DoEvents(); ConnectionTest.ConnectionTest ct3 = new ConnectionTest.ConnectionTest(); ct3.DohvatiListuTipVezeCompleted += ct3_DohvatiListuTipVezeCompleted; ct3.DohvatiListuTipVezeAsync(); }
private void btnPosalji_Click(object sender, EventArgs e) { if (comMjesto.SelectedValue == DBNull.Value || comMjesto.SelectedValue == null) { MessageBox.Show("Molim, odaberite mjesto."); return; } if (comInternetProvideri.SelectedValue == DBNull.Value || comInternetProvideri.SelectedValue == null) { MessageBox.Show("Molim, odaberite Internet providera."); return; } if (comTipVeze.SelectedValue == DBNull.Value || comTipVeze.SelectedValue == null) { MessageBox.Show("Molim, odaberite tip veze."); return; } if (comOs.SelectedValue == DBNull.Value || comOs.SelectedValue == null) { MessageBox.Show("Molim, odaberite OS."); return; } if (!testFinished) { MessageBox.Show("Pokrenite test prije pozivanja ove opcije."); return; } try { ConnectionTest.ConnectionTest ct = new ConnectionTest.ConnectionTest(); DataSet ds = new DataSet(); AppData.dsData.CT_RezultatiDataTable dt = new AppData.dsData.CT_RezultatiDataTable(); AppData.dsData.CT_RezultatiRow row = dt.NewCT_RezultatiRow(); row.guid = Guid.NewGuid(); row.mjesto_guid = (Guid)comMjesto.SelectedValue; row.internetprovider_guid = (Guid)comInternetProvideri.SelectedValue; row.tipveze_guid = (Guid)comTipVeze.SelectedValue; row.os_guid = (Guid)comOs.SelectedValue; row.echo = Convert.ToDecimal(echo / iterations); row.potpis = Convert.ToDecimal(potpis / iterations); row.racun = Convert.ToDecimal(slanje / iterations); row.TimeStamp = new DateTime(1900, 1, 1); dt.Rows.Add(row); ds.Tables.Add(dt); bool test = ct.Posalji(ds); if (test) { MessageBox.Show("Podaci su uspješno poslani."); } else { MessageBox.Show("Greška kod slanja."); } } catch (Exception ex) { MessageBox.Show(String.Format("Greška kod slanja: {0}", ex.Message)); } }