hi
this is Krishna
I have a windows application which plays image and flash ads.i used three timers to play these ads.for example my folder contains 1.swf,2.jpg,3.jpg,4.swf,5.swf,.....
here i am using if condition.but i wanted to use like if extention is .swf then it has to use timer1 and play flash add.if the next files extention is .jpg then it has to use timer2 how to do that.
my code is like below:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Demo_Flash
{
public partial class Form1 : Form
{
Timer timer1 = new Timer();
Timer timer2 = new Timer();
Timer timer3 = new Timer();
int i = 0;
int j = 0;
public Form1()
{
InitializeComponent();
i = 1;
j = 1;
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = (1000) * 10;
timer1.Enabled = true;
timer1.Start();
timer2.Tick += new EventHandler(timer2_Tick);
timer2.Interval = (1000) * 10;
timer2.Enabled = false;
timer3.Tick += new EventHandler(timer3_Tick);
timer3.Interval = (1000) * 5;
timer3.Enabled = true;
timer3.Start();
}
void timer1_Tick(object sender, EventArgs e)
{
pictureBox1.Visible = false;
pictureBox1.Enabled = false;
axShockwaveFlash1.Visible = true;
axShockwaveFlash1.BringToFront();
if (i == 1)
{
string path = System.Environment.CurrentDirectory;
path += @"\Top_1.swf";
axShockwaveFlash1.LoadMovie(0, path);
axShockwaveFlash1.Play();
i++;
}
else if (i == 2)
{
string path = System.Environment.CurrentDirectory;
path += @"\Top_2.swf";
axShockwaveFlash1.LoadMovie(0, path);
axShockwaveFlash1.Play();
i--;
}
}
void timer2_Tick(object sender, EventArgs e)
{
axShockwaveFlash1.Visible = false;
pictureBox1.BringToFront();
pictureBox1.Visible = true;
pictureBox1.Enabled = true;
if (j == 1)
{
pictureBox1.Image = Image.FromFile("D:/Project Source/Experimented/Bulk Sms/ProjectSms/ProjectSms/bin/Debug/Advertisement1_1.jpg");
j++;
}
else if (j == 2)
{
pictureBox1.Image = Image.FromFile("D:/Project Source/Experimented/Bulk Sms/ProjectSms/ProjectSms/bin/Debug/Advertisement2_1.jpg");
j--;
}
}
void timer3_Tick(object sender, EventArgs e)
{
timer3.Enabled = false;
timer2.Enabled = true;
timer2.Start();
}
}
}
Note:
the code above may be wrong i am not an expert in C#
my thing is simple like below:
1.i have windows form i have to display some(flash or images) adds on it from root directory(or a particular directory say D:\Images)
with certain intervals(ex:8 sec)
the directory may contain flash or images i have to display both on same location (for example first add is flash and second add is image then first my form display flash after 8 seconds it display image the loop is continued regardless of weather it is a image or flash) then what i have to do