videourl = dt.Rows[0]["videourl"].ToString();
axWindowsMediaPlayer1.URL = videourl;
axWindowsMediaPlayer1.settings.rate = 1.0;
axWindowsMediaPlayer1.Ctlcontrols.play();
//axWindowsMediaPlayer1.settings.setMode("loop", true);
private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
try
{
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
{
ShowImage(Files[selected], pictureBox);
timer2.Enabled = true;
pictureBox.Visible = true;
axWindowsMediaPlayer1.Visible = false;
axWindowsMediaPlayer1.Ctlcontrols.stop();
}
else if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped)
{
}
}
catch (Exception ex)
{
Utils.LogHandler.HandleError(ex);
}
}
axWindowsMediaPlayer1.settings.rate = 1.0;
axWindowsMediaPlayer1.Ctlcontrols.play();
//axWindowsMediaPlayer1.settings.setMode("loop", true);
private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
try
{
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
{
ShowImage(Files[selected], pictureBox);
timer2.Enabled = true;
pictureBox.Visible = true;
axWindowsMediaPlayer1.Visible = false;
axWindowsMediaPlayer1.Ctlcontrols.stop();
}
else if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped)
{
}
}
catch (Exception ex)
{
Utils.LogHandler.HandleError(ex);
}
}
string[] Files;
var root = Application.ExecutablePath;
var temp = root.Split('\\');
temp[temp.Length - 1] = "";
temp[temp.Length - 2] = "Images";
var newpath = string.Join("\\", temp);
Files = Directory.GetFiles(newpath);
/// <summary>
/// Show the image in the PictureBox.
/// </summary>
public static void ShowImage(string path, PictureBox pct)
{
pct.ImageLocation = path;
}
/// <summary>
/// Show the next image.
/// </summary>
private void ShowNextImage()
{
ShowImage(this.Files[(++this.selected) % this.Files.Length], this.pictureBox);
}
var root = Application.ExecutablePath;
var temp = root.Split('\\');
temp[temp.Length - 1] = "";
temp[temp.Length - 2] = "Images";
var newpath = string.Join("\\", temp);
Files = Directory.GetFiles(newpath);
/// <summary>
/// Show the image in the PictureBox.
/// </summary>
public static void ShowImage(string path, PictureBox pct)
{
pct.ImageLocation = path;
}
/// <summary>
/// Show the next image.
/// </summary>
private void ShowNextImage()
{
ShowImage(this.Files[(++this.selected) % this.Files.Length], this.pictureBox);
}
{
try
{
btnSubmit.Enabled = false;
gbLabels.Visible = false;
gbLabels.BackgroundImage = null;
OpenFileDialog fDialog = new OpenFileDialog();
fDialog.AddExtension = true;
fDialog.CheckFileExists = true;
fDialog.CheckPathExists = true;
fDialog.Title = "Open Image Files";
fDialog.Filter = "All files (*.*)|*.*|JPEG Files|*.jpeg|GIF Files|*.gif";
fDialog.InitialDirectory = @"C:\";
fDialog.Multiselect = true;
if (fDialog.ShowDialog() == DialogResult.OK)
{
imageFiles = fDialog.FileNames;
Files = new string[imageFiles.Length];
for (int j = 0; j <= imageFiles.Length - 1; j++)
{
System.Drawing.Image im = System.Drawing.Image.FromFile(imageFiles[j]);
int ActualWidth = im.Width;
int ActualHeight = im.Height;
im.Dispose();
if (ActualWidth > 3600 && ActualHeight > 2400)
{
MessageBox.Show("Please upload image with size less than 3600X2400", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
txtImageName.Text = imageFiles[j];
FileStream fssource = new FileStream(txtImageName.Text, FileMode.Open);
var root1 = txtImageName.Text;
var temp1 = root1.Split('\\');
var image = temp1[temp1.Length - 1];
var root = Application.ExecutablePath;
var temp = root.Split('\\');
temp[temp.Length - 1] = "";
temp[temp.Length - 2] = "Images";
var newpath = string.Join("\\", temp);
bool folderExists = Directory.Exists(newpath);
if (!folderExists)
Directory.CreateDirectory(newpath);
newpath = newpath + "_" + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + "ReceiptionBack" + "." + image.Split('.')[1];
txtImageName.Text = newpath;
Files[j] = txtImageName.Text;
FileStream fsdest = new FileStream(newpath, FileMode.Create);
while (true)
{
int i;
i = fssource.ReadByte();
if (i == -1)
break;
fsdest.WriteByte(Convert.ToByte(i));
}
fsdest.Close();
}
}
}
btnSubmit.Enabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnfont_Click(object sender, EventArgs e)
{
try
{
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
Font font = fontDialog1.Font;
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font));
string fontString = tc.ConvertToString(font);
txtFont.Text = fontString;
}
}
catch (Exception ex)
{
Utils.LogHandler.HandleError(ex);
}
}
{
try
{
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
Font font = fontDialog1.Font;
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font));
string fontString = tc.ConvertToString(font);
txtFont.Text = fontString;
}
}
catch (Exception ex)
{
Utils.LogHandler.HandleError(ex);
}
}
{
try
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
string color = colorDialog1.Color.ToArgb().ToString("x");
//color = color.Substring(2, 6);
//color = "#" + color;
txtColor.Text = color;
}
}
catch (Exception ex)
{
Utils.LogHandler.HandleError(ex);
}
}

