public void Execute() { if (form2.InvokeRequired) { form2.Invoke(new MethodInvoker(Execute)); } else { form2.BringToFront(); form2.Up(); } }
private void button1_Click(object sender, EventArgs e) { if (f2 == null || f2.IsDisposed) { f2 = new Form2(); f2.Show(); } else { if (f2.WindowState == FormWindowState.Minimized) { f2.WindowState = FormWindowState.Normal; } f2.Show(); f2.BringToFront(); } }
private void boHypo71_Click(object sender, EventArgs e) { // hace llamado al formulario2, el cual corresponde a las lecturas de arribos para la // localizacion con el Hypo71. Form2 frm2 = new Form2(this); frm2.Show(); frm2.BringToFront(); }
private void panel1_MouseUp(object sender, MouseEventArgs e) { // el panel1 es donde se dibuja la traza activa. Aqui se busca saber si el raton se desplaza // entre el hundido y el soltado del boton del raton. Si se activa el boton izquierdo y se // desplaza el raton, se entra al panel de clasificacion ( si no se desplaza, no se hace nada // por el momento). Con el boton derecho, se indica el tiempo, absoluto si no hay desplazo o // el intervalo correspondiente al arrastre. int xf,yf,i,j,k,nuar,j1,j2,jb,jj,byf,dfcu,mmx,mmn; double fax,fay,fcra; long tii1=0; double dif=0,t1,t2,ttt; string ss="",lin="",ee="",ca=""; bool si=false; NoMostrar = true; moveresp = false; if (panel2.Visible == true) { panel2.Size = new Size(219, 74); panel2.Location = new Point(243, 254); panel2.Visible = false; } if (estado==false) return; // la variable estado es false si no existe ninguna lectura de trazas en memoria. bxf = e.X; byf = e.Y; xf = panel1.Size.Width; yf = panel1.Size.Height; jb = tim[id].Length - 1; // tiempo de la ultima muestra if (tim[id][jb-1] <= 0) { do { jb -= 1; if (tim[id][jb - 1] > 0) break; } while (jb > 0); jb -= 1; } if (jb < 2) return; jj = 1 + (int)((tim[id][jb] - timin) / dur); if (esp == 0) fay = (yf - 45.0) / jj; // esp es la variable que guarda el espaciamiento entre lineas. else fay = esp; fax = dur / xf; j1 = (int)((byi - 45.0) / fay); // se calcula cuantas lineas existen antes de la actual. t1 = timin + bxi * fax + j1 * dur; // se tiene en cuenta el tiempo de las lineas anteriores j2 = (int)((byf - 45.0) / fay); t2 = (timin + bxf * fax + j2 * dur); if (t2 < t1) { ttt = t1; t1 = t2; t2 = ttt; } // t1 es el tiempo inical del intervalo y t2 el tiempo final. tii1 = (long)(Fei+(t1*10000000.0)); if (DR > 0) { if (fcnan[id] <= 0) { ss = "NO hay Factor!.."; tip.IsBalloon = false; tip.AutoPopDelay = 3000; tip.SetToolTip(boDR, ss); panelDR.Visible = false; DR = 0; boDR.BackColor = Color.Gold; return; } tDR1 = t1; tDR2 = t2; if (checkBoxHz.Checked == true && DR==1) PromedioFiltrado(); panelDR.Visible = true; panelDR.BringToFront(); panelDR.Invalidate(); return; /*if (DR == 1) { if (checkBoxHz.Checked == true) PromedioFiltrado(); panelDR.Visible = true; panelDR.BringToFront(); panelDR.Invalidate(); return; } else { DibujoVelocidadDR(t1, t2); }*/ } if (vista == true) { try { splitContainer1.Visible = true; splitContainer1.Location = new Point(1,1); splitContainer1.Size = new Size(Width-100,Height-100); tie1=t1; backgroundWorker1.RunWorkerAsync(); return; } catch { return; } } if (tremor == true) { if (tinitremor == 0) { tinitremor = t1; t1cod = tinitremor; t2cod = tinitremor + incTremor; bovar.Visible = false; boaste.Visible = false; boClaSola.Visible = true; } else { fcra=2.0*1.0/ra[id]; if (t2 - t1 <= fcra) { if (tremofin == true) tifintremor = t1; } else { nucod = (short)(id); panelAmp.Visible = true; labelMrc.Text = ""; t1cod = tinitremor; t2cod = tinitremor + incTremor; t1amp = t1; t2amp = t2; panelAmp.Invalidate(); } } Cuadro_Tremor(); return; } if (e.Button == MouseButtons.Right) { if (panelcla.Visible == true) return; if (bxi == bxf && byi == byf) { DateTime fech1 = new DateTime(tii1); ss = string.Format("{0:HH}:{0:mm}:{0:ss}.{0:ff}", fech1); } else { dif = Math.Abs(t2 - t1); ss = string.Format("{0:0.00}",dif)+" seg"; ss += string.Format(" ({0:0.00}')",dif/60.0); i = (int)((t1-tim[id][0])*ra[id]); if (i < 0) i = 0; j = (int)((t2-tim[id][0])*ra[id]); if (j > jb) j = jb; if (j > 0 && j > i) { mmx = cu[id][i]; mmn = mmx; for (k = i + 1; k < j; k++) { if (mmx < cu[id][k]) mmx = cu[id][k]; else if (mmn > cu[id][k]) mmn = cu[id][k]; } dfcu = mmx - mmn; ss += " " + dfcu.ToString() + " cue"; if (fcnan[id] > 0) { //dif = Math.Abs((fcnan[id]*dfcu)/(1000.0*ga[id])); dif = Math.Abs((fcnan[id]*dfcu)/(double)(ga[id])); //ss += string.Format(" {0:0.00} mc/s ga={1:0} fc={2:0.000000}", dif,ga[id],fcnan[id]); ss += string.Format(" {0:0.00} ",dif)+Unidad[id]; ss += string.Format(" ga={0:0} fc={1:0.000000}", ga[id], fcnan[id]); } } } tip.IsBalloon = true; tip.InitialDelay = 0; tip.ReshowDelay = 0; tip.AutomaticDelay = 0; tip.SetToolTip(panel1, ss); } else { if (VerEspectro == true) { yesp = (short)(e.Y); xesp = (short)(e.X); moveresp = false; return; } else if (interpol == true) { ip1 = (int)((t1 - tim[id][0]) * ra[id]); ip2 = (int)((t2 - tim[id][0]) * ra[id]); if (ip1 < 0) ip1 = 0; if (ip2 >= tim[id].Length) ip2 = tim[id].Length - 1; if (ip2 - ip1 <= 2) return; ipb1 = ip1; ipb2 = ip2; si=CalculoInterpolacion(id); if (si == true) { panelInterP.Visible = true; panelInterP.Invalidate(); } return; } tie1 = t1; tie2 = t2; if (sipro == 1) { sipro = 2; boprom.BackColor = Color.SpringGreen; p1=(int)((t1-tim[id][0])*ra[id]); p2=(int)((t2-tim[id][0])*ra[id]); if (p1 < 0) p1 = 0; if (p2 <= 0) { sipro = 1; boprom.BackColor = Color.IndianRed; } else if (tremor==false) panel1.Invalidate(); return; } //MessageBox.Show("tie1="+tie1.ToString()+" tie2="+tie2.ToString()+" clSola="+clSola.ToString()); if (tie1 != tie2) { if (File.Exists("datos.txt")) YaClasificados(); if (clSola == -1) { //MessageBox.Show("2"); if ((tie2 - tie1) < 10.0) { NoMostrar = true; ca="VENTANA MENOR DE 10 SEGUNDOS!!\nNO se GRABA en la BASE sismos con\nDuracion Menor a 10 Segundos\n\nSALIR??"; DialogResult result = MessageBox.Show(ca, "Duracion Menor de 10 Segundos", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) return; } Cladat[0].X = bxi; Cladat[0].Y = byi; Cladat[1].X = e.X; Cladat[1].Y = e.Y; //MessageBox.Show("0.X="+Cladat[0].X.ToString()+" 0.Y="+Cladat[0].Y.ToString()+" 1.X="+Cladat[1].X.ToString()+" 1.Y="+Cladat[1].Y.ToString()); if (loscajones == false) for (i = 0; i < nutra; i++) siEst[i] = true; panelcla.BringToFront(); Clasificar(); } else { nucod = (short)(id); panelAmp.Visible = false; Pti = 0; Sti = 0; Cti = 0; Ati = 0; periodo = 0; t1cod = tie1; t2cod = tie2; BuscaCompCoda(); // rutina que busca si la traza actual corresponde a una componente de una estacion triaxial. panelcoda.Visible = true; panelcoda.Invalidate(); } } else if (siArch == true) // si la opcion de mostrar la duracion de los archivos esta activa. { for (i = 0; i < contarch; i++) { if (t1 > tiar[i] && t2 < (tiar[i] + duar[i])) { for (j = 0; j < nutra; j++) siEst[j] = false; StreamReader ar = new StreamReader("datos.txt"); lin = ""; while (lin != null) { try { lin = ar.ReadLine(); if (lin == null) break; ttt=(double.Parse(lin.Substring(34,19))-Feisuds)/10000000.0; if (ttt==tiar[i] && string.Compare(nomar[i].Substring(0,12),lin.Substring(16,12)) == 0) { nuar = int.Parse(lin.Substring(53, 3)); for (k = 0; k < nuar; k++) { sismo = nomar[i]; ee = lin.Substring(57 + k * 5, 4); for (j = 0; j < nutra; j++) { if (string.Compare(ee.Substring(0,4), est[j].Substring(0, 4)) == 0) { siEst[j] = true; break; } }// for j }// for k tie1 = ttt; tie2 = ttt + duar[i]; }// if ttt } catch { } } ar.Close(); if (elimiclas == false) { // se llama al programa clasificador si se activa dentro del cajon que muestra la duracion del archivo, siempre y cuando no se hayya activado el boton de eliminar la clasificacion. Form2 frm2 = new Form2(this); frm2.Show(); frm2.BringToFront(); } else { // aqui ya se ha activado el boton de eliminar archivo. panel2.Visible = true; ca = "Eliminando archivos...."; util.Mensaje(panel2,ca,false); NoMostrar = true; si = util.EliminaClasificacion(tie1,sismo,rutbas); elimiclas = false; boEliClas.BackColor = Color.White; util.Leerbase(panel2,rutbas,ll1,ll2,cl,volcan); if (File.Exists("amplis.txt")) LeerAmplitud(); Reviarch(); panel2.Visible = false; panel1.Invalidate(); } break; } } } else { Graphics dc1 = panel1.CreateGraphics(); Pen lap = new Pen(Color.Orange, 2); Pen lap2 = new Pen(Color.Red, 2); dc1.DrawLine(lap, e.X, 0, e.X, panel1.Height); if (panel1a.Visible == true) { Graphics dc1a = panel1a.CreateGraphics(); dc1a.DrawLine(lap, e.X, 0, e.X, panel1a.Height); dc1.DrawLine(lap2,e.X-10,e.Y,e.X+10,e.Y); dc1a.DrawLine(lap2,e.X-10,e.Y,e.X+10,e.Y); } lap.Dispose(); lap2.Dispose(); } } return; }
private void showChangesPopUp() { Form2 f = new Form2(); f.Show(); f.BringToFront(); }
private void LivMedia_SelectedIndexChanged(object sender, EventArgs e) { if (livMedia.SelectedItems.Count == 1) { Media selected = currentList[livMedia.SelectedItems[0].Index]; if (delMode) { deleteItem(selected, false); } else if (editMode) { tbxLink.Text = selected.link; tbxName.Text = selected.name; currentid = selected.id; nudRating.Value = selected.rating; pbxPreview.ImageLocation = picturePath + selected.pictureName; pictureName = selected.pictureName; if (selected.dateAdded > DateTime.MinValue) { dtpWatchdate.Value = selected.dateAdded; } if (selected.parts > 0) { nudParts.Value = selected.parts; } if (selected.wishList) { cbxAddWishList.Checked = true; } if (selected.type == "Film") { rbnMovie.Checked = true; } else if (selected.type == "Serie") { rbnSeries.Checked = true; } else { rbnAnime.Checked = true; } List <string> usedGenres = selected.genre.Split('|').ToList(); tbcMain.SelectedIndex = 1; deleteItem(selected, true); } else if (infomode) { f = new Form2(selected); f.MouseLeave += Form2_MouseLeave; f.Opacity = 0.7; f.ShowDialog(); f.BringToFront(); //infosShowing = true; //schon länger auskommentiert } else { string link = selected.link; if (link != "") { Process.Start(link); } } } }
//Just hide first layout, by hiding group box, then pop form2 and assign to its closing event a function private void PopForm2() { //Test all controls box2.Hide(); Form2 form2 = new Form2(); form2.Location = new Point(100, 100); form2.BringToFront(); form2.Show(); //Assign function to event leave form form2.FormClosed += new FormClosedEventHandler(UpdateMenu_Form2Leave); //Disable menu items on this, form1 menuItem1.Enabled = false; menuItem2.Enabled = false; }