I have this program wherein I use timer to redirect to another page. It do work but the problem is when I click cancel button a messagebox will appear and when the user will not click on it and the timer ticks, messagebox didn't close. How can I automatically close the message box??
this is what it looks like..
and here is the code I used to redirect the page
DispatcherTimer sessionTimer = new DispatcherTimer();
public CashDepositAccount()
{
InitializeComponent();
con = new SqlConnection(ConfigurationManager.ConnectionStrings["kiosk_dbConnectionString1"].ConnectionString);
con.Open();
SqlCommand cmd1 = new SqlCommand("Select idle From [dbo].[Idle]", con);
idle = Convert.ToInt32(cmd1.ExecuteScalar());
InputManager.Current.PreProcessInput += Activity;
activityTimer = new DispatcherTimer
{
Interval = TimeSpan.FromMinutes(idle),
IsEnabled = true
};
activityTimer.Tick += Inactivity;
}
#region
void Inactivity(object sender, EventArgs e)
{
navigate = "Home";
Application.Current.Properties["navigate"] = navigate;
}
void Activity(object sender, PreProcessInputEventArgs e)
{
activityTimer.Stop();
activityTimer.Start();
}
How can I close the message box when I redirect to the main page when Timer ticks?