private void Wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (ct) { var links = wb.Document.GetElementsByTagName("a"); foreach (HtmlElement link in links) { if (link.GetAttribute("className") == "btn dark medium") { pagelink = link.GetAttribute("href"); break; } } ProgressBar1.Increment(20); // Incremented 20 if (pagelink == "") { ProgressBar1.Value = 0; MessageBox.Show("Sorry the entered code was not found.", "Please try another id"); button1.Enabled = true; textBox1.Enabled = true; wb.Dispose(); return; } wb2.ScriptErrorsSuppressed = true; wb2.Navigate(pagelink.Trim()); wb2.DocumentCompleted += Wb2_DocumentCompleted; wb.Dispose(); } }
private void timer1_Tick(object sender, EventArgs e) { ProgressBar1.Increment(1); if (ProgressBar1.Value == 100) { Label4.Show(); timer1.Stop(); } Label3.Text = ProgressBar1.Value + (" %"); }
private void Timer1_Tick(object sender, EventArgs e) { ProgressBar1.Increment(1); if (ProgressBar1.Value == ProgressBar1.Maximum) { frmLogin oFrmLogin = new frmLogin(oLogin); oFrmLogin.Show(); this.Hide(); Timer1.Stop(); } }
private void Timer1_Tick(object sender, EventArgs e) { ProgressBar1.Increment(1); if (ProgressBar1.Value == ProgressBar1.Maximum) { Timer1.Stop(); this.labelthanhcong.Text = "Cơ sở dữ liệu đã được Backup thành công"; this.labelform.Text = ""; ProgressBar1.Visible = false; btnThucHien.Visible = false; btnHoanThanh.Visible = true; this.btnHoanThanh.Focus(); Log_BUS.ThemNhatKy("Dữ liệu", "Sao lưu dữ liệu"); } }
public void Timer1_Tick(object sender, EventArgs e) { ProgressBar1.Increment(1); if (ProgressBar1.Value == ProgressBar1.Maximum) { timer1.Stop(); this.labelthanhcong.Text = "Phục hồi thành công!"; this.labelform.Text = ""; ProgressBar1.Visible = false; btnThucHien.Visible = false; btnHoanThanh.Visible = true; this.btnHoanThanh.Focus(); Log_BUS.ThemNhatKy("Dữ liệu", "Phục hồi dữ liệu"); } }
private void button1_Click(object sender, EventArgs e) { wb = new WebBrowser(); wb2 = new WebBrowser(); ProgressBar1.Increment(10); // Incremented 20 label1.Visible = false; saveToolStripMenuItem.Enabled = false; ct = true; label1.Text = ""; textBox1.Enabled = false; button1.Enabled = false; wb.ScriptErrorsSuppressed = true; string temp = "https://vitspot.com/?s=" + textBox1.Text; wb.Navigate(temp); ProgressBar1.Increment(20); // Incremented 20 wb.DocumentCompleted += Wb_DocumentCompleted; }
private void Timer1_Tick(object sender, EventArgs e) { ProgressBar1.Increment(1); switch (ProgressBar1.Value) { case 1: loaderLabel.Text = "Loading...."; break; case 20: loaderLabel.Text = "Setting Up Pages...."; break; case 40: loaderLabel.Text = "Loading Forms...."; break; case 60: loaderLabel.Text = "Loading Doctors...."; break; case 80: loaderLabel.Text = "Loading Patients...."; break; case 99: loaderLabel.Text = "Welcome..."; LoginPage loginPage = new LoginPage(); loginPage.Show(); this.Hide(); break; default: break; } percentageLabel.Text = ProgressBar1.Value + " %"; }
private void Prog_In_Timer_Tick(object sender, EventArgs e) { //Inrement by +1 in progressbar #1 (get it started) ProgressBar1.Increment(+1); //Add percent towards the central label Label2.Text = "Loading... " + ProgressBar1.Value.ToString + "%"; IO.StreamReader r = default(IO.StreamReader); //Self-setup and checkup if (ProgressBar1.Value == "1") { if (My.Computer.FileSystem.DirectoryExists("C:\\CoderRevolt\\WebBrowser\\V1")) { //Check if returning user } else { //If user is new, then create core directory folder My.Computer.FileSystem.CreateDirectory("C:\\CoderRevolt\\WebBrowser\\V1"); } } //Make sure History and Bookmarks panels are loaded up for next ProgressCheck @ Value '10' if (ProgressBar1.Value == "5") { Hist.Show(); Hist.Hide(); Bookmarks.Show(); Bookmarks.Hide(); } //Bookmark Self-Check and Setup if (ProgressBar1.Value == "10") { if (My.Computer.FileSystem.FileExists("C:\\CoderRevolt\\WebBrowser\\V1\\Bookmarks.gwbb")) { r = new IO.StreamReader("C:\\CoderRevolt\\WebBrowser\\V1\\Bookmarks.gwbb"); while ((r.Peek() > -1)) { Bookmarks.ListBox1.Items.Add(r.ReadLine); } r.Close(); } else { } if (My.Computer.FileSystem.FileExists("C:\\CoderRevolt\\WebBrowser\\V1\\Bookmarks2.gwbb")) { r = new IO.StreamReader("C:\\CoderRevolt\\WebBrowser\\V1\\Bookmarks2.gwbb"); while ((r.Peek() > -1)) { Bookmarks.ListBox2.Items.Add(r.ReadLine); } r.Close(); } else { } } //History Self-Check and Setup if (ProgressBar1.Value == "20") { if (My.Computer.FileSystem.FileExists("C:\\CoderRevolt\\WebBrowser\\V1\\History1.gwbb")) { r = new IO.StreamReader("C:\\CoderRevolt\\WebBrowser\\V1\\History1.gwbb"); while ((r.Peek() > -1)) { Hist.ListBox1.Items.Add(r.ReadLine); } r.Close(); } else { } if (My.Computer.FileSystem.FileExists("C:\\CoderRevolt\\WebBrowser\\V1\\History2.gwbb")) { r = new IO.StreamReader("C:\\CoderRevolt\\WebBrowser\\V1\\History2.gwbb"); while ((r.Peek() > -1)) { Hist.ListBox2.Items.Add(r.ReadLine); } r.Close(); } else { } } if (ProgressBar1.Value == "100") { Prog_In_Timer.Stop(); this.Hide(); Main.Show(); } }
// metodo implementa en el timer un progressbar para que cada momento va cambiando una imagen de posicion private void timer1_Tick(object sender, EventArgs e) { ProgressBar1.Increment(2); if (ProgressBar1.Value == 0) { cambiar("imagenes/image (1).png"); lb_iniciar.Text = "."; } else if (ProgressBar1.Value == 8) { cambiar("imagenes/image (2).png"); lb_iniciar.Text = ".."; } else if (ProgressBar1.Value == 16) { cambiar("imagenes/image (3).png"); lb_iniciar.Text = "..."; } else if (ProgressBar1.Value == 24) { cambiar("imagenes/image (4).png"); lb_iniciar.Text = "."; } else if (ProgressBar1.Value == 32) { cambiar("imagenes/image (5).png"); lb_iniciar.Text = ".."; } else if (ProgressBar1.Value == 40) { cambiar("imagenes/image (6).png"); lb_iniciar.Text = "..."; } else if (ProgressBar1.Value == 48) { cambiar("imagenes/image (7).png"); lb_iniciar.Text = "."; } else if (ProgressBar1.Value == 56) { cambiar("imagenes/image (8).png"); lb_iniciar.Text = ".."; } else if (ProgressBar1.Value == 64) { cambiar("imagenes/image (9).png"); lb_iniciar.Text = "..."; } else if (ProgressBar1.Value == 72) { cambiar("imagenes/image (10).png"); lb_iniciar.Text = "."; } else if (ProgressBar1.Value == 80) { cambiar("imagenes/image (11).png"); lb_iniciar.Text = ".."; } else if (ProgressBar1.Value == 88) { cambiar("imagenes/image (12).png"); lb_iniciar.Text = "..."; } else if (ProgressBar1.Value == 96) { cambiar("imagenes/image (2).png"); lb_iniciar.Text = "."; } else if (ProgressBar1.Value == 100) { // cuando el progressbar llega al final se procede a iniciar sesion por medio de una consulta sql verificando si el usuario y contraseña ingresados sean correctos lb_iniciar.Text = "Iniciando..."; pb_iniciar.Hide(); btn_iniciar.Show(); ProgressBar1.Value = 0; lb_iniciar.Hide(); DataSet ds; ds = conexion.sqlconsulta("Select id_usuario,tipo from tbl_usuarios where usuario='" + tb_usuario.Text + "' and pass='******' "); try { if (ds.Tables[0].Rows.Count == 0) { timer1.Stop(); MessageBox.Show("Su nombre o contraseña son incorrectos"); tb_password.Enabled = true; tb_usuario.Enabled = true; } else { var tipo = ds.Tables[0].Rows[0].ItemArray[1].ToString(); int ID = int.Parse(ds.Tables[0].Rows[0].ItemArray[0].ToString()); // verifica el tipo de usuario que corresponde para los permisos necesarios if (tipo.Trim() == "ADMINISTRADOR") { frm_inicio.conexion = this.conexion; frm_inicio.ID = ID; frm_inicio.Show(); } else if (tipo.Trim() == "USUARIO") { frm_inicio.ID = ID; frm_inicio.conexion = this.conexion; frm_inicio.tipo_usuario = "USUARIO"; frm_inicio.Show(); } } } catch (Exception ex) { } timer1.Stop(); } }
private void SearchDuplicates() { MergeCtl.Base = fBase; MergeCtl.MergeMode = fRMMode; MergeCtl.SetRec1(null); MergeCtl.SetRec2(null); MatchParams mParams; //mParams.IndistinctNameMatching = chkIndistinctMatching.Checked; mParams.NamesIndistinctThreshold = (float)decimal.ToDouble(edNameAccuracy.Value) / 100.0f; mParams.DatesCheck = chkBirthYear.Checked; mParams.YearsInaccuracy = decimal.ToInt32(edYearInaccuracy.Value); mParams.CheckEventPlaces = false; bool res = false; btnSkip.Enabled = false; try { ProgressBar1.Minimum = 0; ProgressBar1.Maximum = fTree.RecordsCount; ProgressBar1.Value = fRMIndex; int recNum = fTree.RecordsCount; for (int i = fRMIndex; i < recNum; i++) { fRMIndex = i; ProgressBar1.Increment(1); GEDCOMRecord iRec = fTree[i]; if (iRec.RecordType != fRMMode) { continue; } for (int j = i + 1; j < recNum; j++) { GEDCOMRecord kRec = fTree[j]; if (kRec.RecordType != fRMMode) { continue; } if (iRec == kRec) { continue; } if (fRMSkip.IndexOf(iRec.XRef + "-" + kRec.XRef) >= 0) { continue; } res = iRec.IsMatch(kRec, mParams) >= 100.0f; if (res && fRMMode == GEDCOMRecordType.rtIndividual) { res = CheckPersonsEx((GEDCOMIndividualRecord)iRec, (GEDCOMIndividualRecord)kRec); } if (res) { MergeCtl.SetRec1(iRec); MergeCtl.SetRec2(kRec); break; } } if (res) { break; } } } finally { btnSkip.Enabled = true; } }
public void Increment() { Label2.Text = "1"; ProgressBar1.Increment(1); Application.DoEvents(); }
//--------------------------------------------------------------------------------------------------------------------- //Subroutine to query the controller database for object references to be used as inputrefs for EVs and TLs public void runOBJQUERY(ref ADODB.Connection adoConn, string sqlstring, ListView inListView, Label intxtLABEL) { ADODB.Recordset adoRS = new ADODB.Recordset(); string inputrefmod = null; int reccount = 0; reccount = 0; int i = 0; i = 0; try { //--------------------------------------------------------------------------------------------------------------------- //open the ODBC connection adoRS.ActiveConnection = adoConn; //--------------------------------------------------------------------------------------------------------------------- //send the SQL query to the ODBC connection adoRS.Open(sqlstring); totalrefLABEL.Text = reccount.ToString(); //--------------------------------------------------------------------------------------------------------------------- //write the display the ODBC query result set in the List box - increment the progress bar while (!adoRS.EOF) { ProgressBar1.Increment(+1); inListView.Items.Add((string)adoRS.Fields[0].Value); inListView.Items[i].SubItems.Add((string)adoRS.Fields[1].Value); inputrefmod = adoRS.Fields[2].Value.ToString().Replace("BAC.", ""); inListView.Items[i].SubItems.Add(inputrefmod); inListView.Items[i].SubItems.Add(adoRS.Fields[3].Value.ToString()); inListView.Items[i].SubItems.Add(adoRS.Fields[4].Value.ToString()); adoRS.MoveNext(); i = i + 1; } intxtLABEL.Text = i.ToString(); ProgressBar1.Value = 100; //disable the create object button if there are no objects to create TLs or EVs for if (i > 0) { createBUTTON.Enabled = true; } else { createBUTTON.Enabled = false; } } catch (Exception e) { Console.WriteLine(e); throw; } //-------------------------------------------------------------------- //close the result set adoRS.Close(); adoRS = null; System.Threading.Thread.Sleep(500); }
private void createButton_Click(object sender, EventArgs e) { ADODB.Connection adoConn = new ADODB.Connection(); string strdsn = null; string sqlstring2 = null; string sqlstring3 = null; string sqlstring4 = null; string objtocreate = null; objtocreate = ""; string objtype = null; string devaddress = null; string lastdevaddress = null; //string wherestring = null; //wherestring = ""; int iocount = 0; iocount = 0; int evtlcount = 0; evtlcount = 0; int i = 0; i = 0; string evtltext = null; evtltext = ""; string createinstance = null; createinstance = ""; int j = 0; j = 1; string refobj = null; refobj = ""; string refname = null; refname = ""; int loopval = 0; loopval = 0; int numobjcreated = 0; numobjcreated = 0; int logintervalval = 0; logintervalval = 0; int bufferSize = 0; bufferSize = 2688; int startTime = 0; startTime = 0; string algval = null; algval = ""; string lowlimitval = null; lowlimitval = ""; string hilimitval = ""; bool analogevflag = false; analogevflag = false; int counter = 0; counter = 0; string monobjref = null; monobjref = ""; ListView evtlList = default(ListView); Label objectlabel = default(Label); objectLIST objrefval = default(objectLIST); string refdev = null; string iptrefobjtype = null; int ipref = 0; ipref = 0; string[,] newobjectlist = new string[101, 3]; string instance = null; try { //--------------------------------------------------------------------------------------------------------------------- //initialize boxes and labels newevtlVIEW.Items.Clear(); bufferSize = Convert.ToInt32(txtSamples.Text); newevtlVIEW.Visible = true; oldevtlVIEW.Visible = false; ProgressBar1.Value = 0; //--------------------------------------------------------------------------------------------------------------------- //set up ODBC DSN text strdsn = dsnTEXTBOX.Text; if (string.IsNullOrEmpty(strdsn)) { strdsn = "Delta Network"; } //--------------------------------------------------------------------------------------------------------------------- //connect to the ODBC DSN adoConn = new ADODB.Connection(); adoConn.ConnectionString = "DSN=" + strdsn + ";"; adoConn.Open(); //--------------------------------------------------------------------------------------------------------------------- //build up SQL Strings for generating existing object list objrefval = (objectLIST)objCOMBO.Items[objCOMBO.SelectedIndex]; objtype = objrefval.Name; iptrefobjtype = Convert.ToString(objrefval.ItemData); devaddress = devTEXTBOX.Text; lastdevaddress = lastdevTEXT.Text; if (rangeCHECK.Checked == true) { //wherestring = "DEV_ID >= " + devaddress + " AND DEV_ID <= " + lastdevaddress; } else { //wherestring = "DEV_ID = " + devaddress; } //count i/o objects iocount = Convert.ToInt32(totalrefLABEL.Text); //--------------------------------------------------------------------------------------------------------------------- //check whether user wants to create EV or TL objects if (eventRAD.Checked) { objtocreate = "EV"; trendRAD.Checked = false; } else if (trendRAD.Checked) { objtocreate = "TL"; eventRAD.Checked = false; } evtlList = oldevtlVIEW; objectlabel = totobjsLABEL; //--------------------------------------------------------------------------------------------------------------------- //build object creation string based on selected object typue - EV or TL if (objtocreate == "EV") { //determine whether to create a COS or OOR EV if (objCOMBO.Text == "BV" | objCOMBO.Text == "BI" | objCOMBO.Text == "BO" | objCOMBO.Text == "MI" | objCOMBO.Text == "MV" | objCOMBO.Text == "SCH") { algval = "COS"; //evtltext = "EV (ParametersType, DEV_ID, Instance, Name, InputRef) Values('" & algval & "', " & devaddress & ", " evtltext = "EV (ParametersType, DEV_ID, Instance, Name, InputRef) Values('" + algval + "'"; analogevflag = false; } else { algval = "Out of Range"; evtltext = "EV (ParametersType, DEV_ID, Instance, Name, InputRef, ParametersOutofRangeLowlimit, ParametersOutofRangeHiLimit) Values('" + algval + "'"; analogevflag = true; } } else if (objtocreate == "TL") { //determine whether to create a COV or Polling Trend Log if (objCOMBO.Text == "MV" | objCOMBO.Text == "BV" | objCOMBO.Text == "BI" | objCOMBO.Text == "BO" | objCOMBO.Text == "SCH") { logintervalval = 0; } else { logintervalval = Convert.ToInt32(sampleInterval.Text); } // evtltext = "TL (LogInterval, DEV_ID, Instance, Name, InputRef) Values(" & logintervalval & ", " & devaddress & ", " evtltext = "TL (LogInterval, BufferSize, DEV_ID, Instance, Name, InputRef) Values(" + logintervalval; analogevflag = false; } string objectProperty = "value"; if (objCOMBO.Text == "PI") { objectProperty = "TotalPulses"; } //--------------------------------------------------------------------------------------------------------------------- //loop to generate insert sql script that will create the objects - also calls the create object subroutine if (iocount > 0) { ProgressBar1.Increment(1); loopval = (srcobjVIEW.SelectedItems.Count - 1); //get the number of selected items in the reference object ListView. "-1" used because listview index starts at 0 newobjLABEL.Visible = true; oldobjLABEL.Visible = false; //loop through the reference object listview to grab the obj ref and obj name for (i = 0; i <= loopval; i++) { ProgressBar1.Increment(+1); refobj = srcobjVIEW.SelectedItems[i].Text; refname = srcobjVIEW.SelectedItems[i].SubItems[1].Text; refdev = chkIsRemote.Checked? devTEXTBOX.Text: srcobjVIEW.SelectedItems[i].SubItems[3].Text; instance = srcobjVIEW.SelectedItems[i].SubItems[4].Text; //If AV is being logged, use the same instance ID if ((objCOMBO.Text == "AV" & objtocreate == "TL" & chkmatchAVInstance.Checked)) { createinstance = instance; } else { sqlstring2 = "SELECT Instance, Name, InputRef FROM OBJECT_BAC_" + objtocreate + " " + " WHERE " + "DEV_ID = " + refdev; createinstance = Convert.ToString(queryTLEV(ref adoConn, sqlstring2) + 1); } //If we're looking at a remote device, set the refobj to the remote device if (chkIsRemote.Checked) { //refdev = devTEXTBOX.Text; } //special condition to set up EV parameters for out of range EV objects if (analogevflag == true) { lowlimitval = (Double.Parse(srcobjVIEW.SelectedItems[i].SubItems[2].Text) - 5).ToString(); hilimitval = (Double.Parse(srcobjVIEW.SelectedItems[i].SubItems[2].Text) + 5).ToString(); sqlstring3 = "INSERT INTO OBJECT_BAC_" + evtltext + ", " + refdev + ", " + createinstance + ", " + "'" + refname + " " + objtocreate + createinstance + "', " + "'" + refobj + ".value', " + lowlimitval + ", " + hilimitval + ")"; } else { if ((objtocreate == "TL")) { sqlstring3 = "INSERT INTO OBJECT_BAC_" + evtltext + ", " + bufferSize + " , " + refdev + ", " + createinstance + ", " + "'" + refname + " " + objtocreate + "', " + "'" + refobj + "." + objectProperty + "')"; } else { sqlstring3 = "INSERT INTO OBJECT_BAC_" + evtltext + " , " + refdev + ", " + createinstance + ", " + "'" + refname + " Alarm" + "', " + "'" + refobj + ".value')"; } } TextBox1.Text = sqlstring3; //write to a hidden text field for debugging sqlstring4 = "SELECT ObjRef, Name, InputRef FROM OBJECT_BAC_" + objtocreate + " " + " WHERE " + "DEV_ID = " + refdev + " AND Instance = " + createinstance; ipref = tstobjref(ref oldevtlVIEW, refobj); if (ipref == 0) { createOBJs(ref adoConn, sqlstring3); //call the create object subroutine newobjectlist = newobjquery(ref adoConn, sqlstring4); newevtlVIEW.Items.Add(newobjectlist[0, 0]); newevtlVIEW.Items[j - 1].SubItems.Add(newobjectlist[0, 1]); newevtlVIEW.Items[j - 1].SubItems.Add(newobjectlist[0, 2]); j = j + 1; } } ProgressBar1.Value = 100; numobjcreated = (j - 1); totobjsLABEL.Text = numobjcreated.ToString(); createdobjLABEL.Text = numobjcreated + " " + objtocreate + " objects created"; //---------old code---------- //If srcobjVIEW.SelectedItems.Count() > 0 Then 'only run the TL query if objects were created // evtlList = newevtlVIEW // sqlstring3 = "Select ObjRef, Name, InputRef, DEV_ID FROM Object_BAC_" & objtocreate & " Where " & wherestring & " AND InputRefObjectType = " & iptrefobjtype // objectlabel = totobjsLABEL // runOBJQUERY(adoConn, sqlstring3, evtlList, objectlabel) //indnewitems(newevtlVIEW, newobjectlist, numobjcreated) //Else //MessageBox.Show("No Objects Created - Please select an object reference from the list", "No Items Selected") //End If //--------------------------- //present message to the user if no items were created/selected if (srcobjVIEW.SelectedItems.Count <= 0) { MessageBox.Show("No Objects Created - Please select an object reference from the list", "No Items Selected"); } srcobjVIEW.SelectedItems.Clear(); } else { refobj = ""; refname = ""; } //--------------------------------------------------------------------------------------------------------------------- //disable the Create Object button until the network is queried again createBUTTON.Enabled = false; //--------------------------------------------------------------------------------------------------------------------- //close the result set and ODBC connection adoConn.Close(); adoConn = null; return; } catch (Exception exception) { MessageBox.Show("Data Error Detected. Please ensure that you have enter a valid object reference, valid Device Address and correct ODBC DSN", "ODBC Reference Error"); dsnTEXTBOX.Text = "Delta Network"; adoConn.Close(); adoConn = null; ProgressBar1.Value = 0; } //======================================================= //Service provided by Telerik (www.telerik.com) //Conversion powered by NRefactory. //Twitter: @telerik //Facebook: facebook.com/telerik //======================================================= }
private void T2_ProgressChanged(object sender, ProgressChangedEventArgs e) { ProgressBar1.Increment(10); ProgressBar1.Update(); }