this below code is for predefined forms where i have created instance for a2 form and a3 form as g and j ..
public partial class a1 : Window
{
public static int count = 0;
Timer timer;
public int Interval;
List<string> li;
public a1()
{
InitializeComponent();
int interval = 10 * 1000;
timer = new Timer(interval);
Interval = interval;
timer.Elapsed += new ElapsedEventHandler(a);timer.Start();
timer.AutoReset = true;
}
private void a(object sender,ElapsedEventArgs elapsedEvent)
{
StopTimer();
bool AutoRepeat = true;
if (AutoRepeat)
StartTimer(); count++;
this.Dispatcher.Invoke(() =>
{
this.Hide();
});
if (count == 1)
{
this.Dispatcher.Invoke(() =>
{
g.Show();
});
}
else if (count == 2)
{
this.Dispatcher.Invoke(() =>
{
g.Close();
});
this.Dispatcher.Invoke(() =>
{
j.Show();
});
}
else
{
this.Show();
}
}
a2 g = new a2();a3 j = new a3();
public void StopTimer()
{
timer.Stop();
timer.Enabled = false;
}
public void StartTimer()
{
StopTimer();
timer.Enabled = true;
timer.Interval = Interval;
timer.Start();
}
}