/* * the function below check the internet connection and update realtime database */ private void timer1_Tick(object sender, EventArgs e) { if (Sec % 15 == 0) { bool connection = NetworkInterface.GetIsNetworkAvailable(); if (connection == true) { ConnectionLable.Text = "Connected"; } else { ConnectionLable.Text = "Connection Lost"; } ConnectionLable.Refresh(); } if (Sec > 0) { Sec--; } else { if (Sec == 0 && Min == 0) { done = true; Sec = 59; Min = 14; } else { Min--; Sec = 59; } } ClockTimer.Text = Min.ToString("00") + ":" + Sec.ToString("00"); ClockTimer.Refresh(); if (done) { done = false; myfunction(); } }