I need to create a new list that will hold indexes and with that list ill decide if the user have to

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have this two variables in the top level of Form1:


<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; bool isNumericChanged = <span style="color:Blue; false;
<span style="color:Blue; int counter= 0;
[/code]

<br/>
Now i added a new timer Timer2 in the designer set it to 500ms and enables set to false.
Now in the numericUpDown where i change the threshold value i did:


<pre>private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
timer2.Start();
if (isNumericChanged == true)
{
counter = 0;
isNumericChanged = false;
}
}[/code]

<br/>
And in timer2 tick event i did:


<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; private <span style="color:Blue; void timer2_Tick(<span style="color:Blue; object sender, EventArgs e)
{
counter = counter + 1;
<span style="color:Blue; if (counter > 5)
{
isNumericChanged = <span style="color:Blue; true;
}

}
[/code]

<br/>
The idea is that once when i loaded a video file im doing first process according to the threshold value in the numericupdown i select.
If i did 0 or 1 then i dont need to do anything after it since it will process and copy to hard disk all the frames.

But the idea is that if i set the threshold to 60% ( the numbers in the numericupdown are tanslated to % ) so im getting for example only 59 frames on the hard disk.
Now if i change the numericupdown value up or down by one number or more it will actiavte the timer2 wait 500ms and then somehow it shold get all files list from the hard disk from the output dir and then itshould create a list of frames but of indexs from
the frames on the hard disk.
For example if i have 59 frames on the hard disk the list long will be 59 indexes.
Then i should compare this list to the list i already have ofthe averages number that are above the threshold.
And if this 59 frames already on hard disk it will not do anything just sohw me the 59 frames from hard disk.
But if if this 59 files not on the hard disk or if i moved the numericupdown value lower the the first time threshold i set it will enable the process button and will givem e the option to process the frames again without the files on the hard disk already
if they are exist.

So i will not have to process all over again but without this 59 files.

I want to create new function that will create another list of above averages wich will be compare to the list of files on hard disk and wich decide what to do.
This function shold be called once in the timer or in the numericupdown changed event and once in the constructor each time i run the program it should check.

This is the Form1 code:


<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; using System;
<span style="color:Blue; using System.Collections.Generic;
<span style="color:Blue; using System.ComponentModel;
<span style="color:Blue; using System.Data;
<span style="color:Blue; using System.Drawing;
<span style="color:Blue; using System.Linq;
<span style="color:Blue; using System.Text;
<span style="color:Blue; using System.Windows.Forms;
<span style="color:Blue; using Polkan.DataSource;
<span style="color:Blue; using System.IO;
<span style="color:Blue; using unfreez_wrapper;

<span style="color:Blue; namespace Extracting_Frames
{
<span style="color:Blue; public <span style="color:Blue; partial <span style="color:Blue; class Form1 : Form
{
<span style="color:Blue; bool isNumericChanged = <span style="color:Blue; false;
<span style="color:Blue; int counter= 0;
<span style="color:Blue; string averagesListTextFile = <span style="color:#A31515; @"d:averagesList.txt";
StreamWriter w;
OpenFileDialog openFileDialog1;
<span style="color:Blue; int Hrs = 0; <span style="color:Green; //number of hours
<span style="color:Blue; int Min = 0; <span style="color:Green; //number of Minutes
<span style="color:Blue; int Sec = 0; <span style="color:Green; //number of Sec
<span style="color:Blue; int timeElapsed;
WmvAdapter f;
<span style="color:Green; //outputDir
<span style="color:Blue; private <span style="color:Blue; string _outputDir = <span style="color:#A31515; @"d:Frames";<span style="color:Green; //Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "ffff");
<span style="color:Green; //moviefile
<span style="color:Blue; private <span style="color:Blue; string _videoFile;<span style="color:Green; // = @"d:Lightnings Israel 03042011 Youtube4Down.com.avi";//@"D:Weather_MoviesMVI_1939.avi";//Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "DSCF0910.AVI");
FileInfo[] _fi = <span style="color:Blue; null;
<span style="color:Blue; delegate <span style="color:Blue; void del1(<span style="color:Blue; object sender, ProgressEventArgs e);
<span style="color:Blue; delegate <span style="color:Blue; void del2(<span style="color:Blue; object sender, EventArgs e);
<span style="color:Blue; delegate <span style="color:Blue; void del3(<span style="color:Blue; object sender, FrameCountEventArgs e);

<span style="color:Green; //Controls
<span style="color:Blue; private System.Windows.Forms.Button button1 = <span style="color:Blue; new System.Windows.Forms.Button();
<span style="color:Blue; private System.Windows.Forms.PictureBox pictureBox1 = <span style="color:Blue; new System.Windows.Forms.PictureBox();
<span style="color:Blue; private System.Windows.Forms.ProgressBar progressBar1 = <span style="color:Blue; new System.Windows.Forms.ProgressBar();
<span style="color:Blue; private System.Windows.Forms.Label label2 = <span style="color:Blue; new System.Windows.Forms.Label();
<span style="color:Blue; private List<<span style="color:Blue; int> _fts;
<span style="color:Blue; private List<<span style="color:Blue; int> threshList;

<span style="color:Blue; public Form1()
{
InitializeComponent();
numericUpDown1.Enabled = <span style="color:Blue; false;
openFileDialog1 = <span style="color:Blue; new OpenFileDialog();
timeElapsed = 0;
label1.Visible = <span style="color:Blue; false;
label2.Visible = <span style="color:Blue; false;
label3.Visible = <span style="color:Blue; false;
label4.Visible = <span style="color:Blue; false;
label8.Visible = <span style="color:Blue; false;
label9.Visible = <span style="color:Blue; false;
label11.Visible = <span style="color:Blue; false;
label12.Visible = <span style="color:Blue; false;
label10.Text = <span style="color:#A31515; "00:00:00";
<span style="color:Green; //label13.Text = "50%";
label13.Visible = <span style="color:Blue; false;
label6.Visible = <span style="color:Blue; false;
myTrackPanelss1.trackBar1.Enabled = <span style="color:Blue; true;
myTrackPanelss1.panel1.Visible = <span style="color:Blue; false;
checkBox2.Enabled = <span style="color:Blue; false;
label15.Visible = <span style="color:Blue; false;

<span style="color:Blue; if (Directory.Exists(_outputDir))
{
_fi = <span style="color:Blue; new DirectoryInfo(_outputDir).GetFiles();
myTrackPanelss1.trackBar1.Maximum = _fi.Length - 1;

<span style="color:Blue; if ( myTrackPanelss1.trackBar1.Maximum > 0)
{
SetPicture(0);
myTrackPanelss1.trackBar1.Scroll += <span style="color:Blue; new EventHandler(trackBar1_Scroll);
myTrackPanelss1.trackBar1.Enabled = <span style="color:Blue; true;
checkBox2.Enabled = <span style="color:Blue; true;
}
<span style="color:Blue; if (_fi.Length >= 0)
{
label15.Text = _fi.Length.ToString();
label15.Visible = <span style="color:Blue; true;
}
}

<span style="color:Blue; if (!File.Exists(_videoFile))
{
button1.Enabled = <span style="color:Blue; false;

}
<span style="color:Blue; else
{
button1.Enabled = <span style="color:Blue; true;
}

<span style="color:Green; //Init();
}

<span style="color:Blue; private <span style="color:Blue; void Init()
{
<span style="color:Green; //
<span style="color:Green; // button1
<span style="color:Green; //
<span style="color:Blue; this.button1.Location = <span style="color:Blue; new System.Drawing.Point(725, 382);
<span style="color:Blue; this.button1.Name = <span style="color:#A31515; "button1";
<span style="color:Blue; this.button1.Size = <span style="color:Blue; new System.Drawing.Size(75, 23);
<span style="color:Blue; this.button1.TabIndex = 0;
<span style="color:Blue; this.button1.Text = <span style="color:#A31515; "button1";
<span style="color:Blue; this.button1.UseVisualStyleBackColor = <span style="color:Blue; true;
<span style="color:Blue; this.button1.Click += <span style="color:Blue; new System.EventHandler(<span style="color:Blue; this.button1_Click);
<span style="color:Green; //
<span style="color:Green; // pictureBox1
<span style="color:Green; //
<span style="color:Blue; this.pictureBox1.Location = <span style="color:Blue; new System.Drawing.Point(204, 12);
<span style="color:Blue; this.pictureBox1.Name = <span style="color:#A31515; "pictureBox1";
<span style="color:Blue; this.pictureBox1.Size = <span style="color:Blue; new System.Drawing.Size(406, 278);
<span style="color:Blue; this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
<span style="color:Blue; this.pictureBox1.TabIndex = 1;
<span style="color:Blue; this.pictureBox1.TabStop = <span style="color:Blue; false;
<span style="color:Green; //
<span style="color:Green; // trackBar1
<span style="color:Green; //
myTrackPanelss1.trackBar1.Location = <span style="color:Blue; new System.Drawing.Point(12, 307);
myTrackPanelss1.trackBar1.Name = <span style="color:#A31515; "trackBar1";
myTrackPanelss1.trackBar1.Size = <span style="color:Blue; new System.Drawing.Size(788, 45);
myTrackPanelss1.trackBar1.TabIndex = 2;
<span style="color:Green; //
<span style="color:Green; // label1
<span style="color:Green; //
<span style="color:Blue; this.label1.AutoSize = <span style="color:Blue; true;
<span style="color:Blue; this.label1.Location = <span style="color:Blue; new System.Drawing.Point(12, 392);
<span style="color:Blue; this.label1.Name = <span style="color:#A31515; "label1";
<span style="color:Blue; this.label1.Size = <span style="color:Blue; new System.Drawing.Size(35, 13);
<span style="color:Blue; this.label1.TabIndex = 3;
<span style="color:Blue; this.label1.Text = <span style="color:#A31515; "label1";
<span style="color:Green; //
<span style="color:Green; // progressBar1
<span style="color:Green; //
<span style="color:Blue; this.progressBar1.Location = <span style="color:Blue; new System.Drawing.Point(15, 346);
<span style="color:Blue; this.progressBar1.Name = <span style="color:#A31515; "progressBar1";
<span style="color:Blue; this.progressBar1.Size = <span style="color:Blue; new System.Drawing.Size(785, 23);
<span style="color:Blue; this.progressBar1.TabIndex = 4;
<span style="color:Green; //
<span style="color:Green; // label2
<span style="color:Green; //
<span style="color:Blue; this.label2.AutoSize = <span style="color:Blue; true;
<span style="color:Blue; this.label2.Location = <span style="color:Blue; new System.Drawing.Point(398, 392);
<span style="color:Blue; this.label2.Name = <span style="color:#A31515; "label2";
<span style="color:Blue; this.label2.Size = <span style="color:Blue; new System.Drawing.Size(35, 13);
<span style="color:Blue; this.label2.TabIndex = 3;
<span style="color:Blue; this.label2.Text = <span style="color:#A31515; "label1";

<span style="color:Blue; this.ClientSize = <span style="color:Blue; new System.Drawing.Size(829, 430);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.progressBar1);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.label2);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.label1);
<span style="color:Blue; this.Controls.Add( myTrackPanelss1.trackBar1);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.pictureBox1);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.button1);
}

<span style="color:Green; //go
<span style="color:Blue; private <span style="color:Blue; void button1_Click(<span style="color:Blue; object sender, EventArgs e)
{
Start(<span style="color:Blue; false);
}

<span style="color:Blue; private <span style="color:Blue; void Start(<span style="color:Blue; bool secondpass)
{
SetPicture(-1);
<span style="color:Blue; if (Directory.Exists(_outputDir) && secondpass == <span style="color:Blue; false)
{
<span style="color:Green; /*if (MessageBox.Show("Directory exists, delete?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != System.Windows.Forms.DialogResult.Yes)
{
MessageBox.Show("aborted.");
return;
//throw new Exception("User aborted");
}*/

<span style="color:Green; //Directory.Delete(_outputDir, true);
<span style="color:Green; //Directory.CreateDirectory(_outputDir);
}
<span style="color:Blue; else
{
Directory.CreateDirectory(_outputDir);
}
WmvAdapter f = <span style="color:Blue; new WmvAdapter(_videoFile,
Path.Combine(_outputDir));

f.Secondpass = secondpass;
f.FramesToSave = _fts;

f.FrameCountAvailable += <span style="color:Blue; new WmvAdapter.FrameCountEventHandler(f_FrameCountAvailable);
f.StatusChanged += <span style="color:Blue; new WmvAdapter.EventHandler(f_StatusChanged);
f.ProgressChanged += <span style="color:Blue; new WmvAdapter.ProgressEventHandler(f_ProgressChanged);

<span style="color:Blue; this.Text = <span style="color:#A31515; "Working...";
label5.Visible = <span style="color:Blue; true;
pictureBox1.Image = Properties.Resources.Weather_Michmoret;
Hrs = 0; <span style="color:Green; //number of hours
Min = 0; <span style="color:Green; //number of Minutes
Sec = 0; <span style="color:Green; //number of Sec
timeElapsed = 0;
label10.Text = <span style="color:#A31515; "00:00:00";
label11.Visible = <span style="color:Blue; false;
label12.Visible = <span style="color:Blue; false;
label9.Visible = <span style="color:Blue; false;
label8.Visible = <span style="color:Blue; false;
<span style="color:Blue; this.button1.Enabled = <span style="color:Blue; false;
myTrackPanelss1.trackBar1.Enabled = <span style="color:Blue; false;
<span style="color:Blue; this.checkBox2.Enabled = <span style="color:Blue; false;
<span style="color:Blue; this.checkBox1.Enabled = <span style="color:Blue; false;
timer1.Start();
<span style="color:Green; //this.Enabled = false;
label2.Text = <span style="color:#A31515; "";
label1.Visible = <span style="color:Blue; true;
label2.Visible = <span style="color:Blue; true;
label3.Visible = <span style="color:Blue; true;
label4.Visible = <span style="color:Blue; true;
f.Start();
}


<span style="color:Green; /* private void Start(bool secondpass)
{
SetPicture(-1);

if (Directory.Exists(_outputDir))
{
//Directory.Delete(_outputDir, true);
//Directory.CreateDirectory(_outputDir);
}
else
{
Directory.CreateDirectory(_outputDir);
}


f.Secondpass = secondpass;
f.FramesToSave = _fts;

f.FrameCountAvailable += new WmvAdapter.FrameCountEventHandler(f_FrameCountAvailable);
f.StatusChanged += new WmvAdapter.EventHandler(f_StatusChanged);
f.ProgressChanged += new WmvAdapter.ProgressEventHandler(f_ProgressChanged);
label1.Visible = true;
label2.Visible = true;
label3.Visible = true;
label4.Visible = true;
timeElapsed = 0;
timer1.Start();
this.Text = "Working...";
//this.Enabled = false;
f.Start();
}*/

<span style="color:Blue; private <span style="color:Blue; void SetPicture(<span style="color:Blue; int indx)
{
<span style="color:Blue; if (_fi == <span style="color:Blue; null)
{
pictureBox1.Image = Properties.Resources.Weather_Michmoret;
label5.Visible = <span style="color:Blue; true;
}
<span style="color:Blue; else
{
<span style="color:Blue; if (indx >= 0 && indx <= myTrackPanelss1.trackBar1.Maximum && _fi.Length > indx)
{
<span style="color:Blue; using (FileStream fs = <span style="color:Blue; new FileStream(_fi[indx].FullName, FileMode.Open))
{
<span style="color:Blue; this.label8.Visible = <span style="color:Blue; true;
<span style="color:Blue; this.label9.Visible = <span style="color:Blue; true;
<span style="color:Blue; this.label9.Text = _fi[indx].FullName;
Image img = <span style="color:Blue; null;
Bitmap bmp = <span style="color:Blue; null;
Image imgOLd = <span style="color:Blue; null;

<span style="color:Blue; try
{
label5.Visible = <span style="color:Blue; false;

img = Image.FromStream(fs);
bmp = <span style="color:Blue; new Bitmap(img);

imgOLd = <span style="color:Blue; this.pictureBox1.Image;
<span style="color:Blue; this.pictureBox1.Image = bmp;
<span style="color:Blue; if (imgOLd != <span style="color:Blue; null)
imgOLd.Dispose();

img.Dispose();
img = <span style="color:Blue; null;
}
<span style="color:Blue; catch
{
<span style="color:Blue; if (img != <span style="color:Blue; null)
img.Dispose();
<span style="color:Blue; if (bmp != <span style="color:Blue; null)
bmp.Dispose();
<span style="color:Blue; if (imgOLd != <span style="color:Blue; null)
imgOLd.Dispose();
}
}
}
<span style="color:Blue; else
{
Image imgOLd = <span style="color:Blue; this.pictureBox1.Image;
<span style="color:Green; //this.pictureBox1.Image = null;

<span style="color:Blue; if (imgOLd != <span style="color:Blue; null)
{
imgOLd.Dispose();
imgOLd = <span style="color:Blue; null;
}

Application.DoEvents();
}
}
}

<span style="color:Blue; void f_StatusChanged(<span style="color:Blue; object sender, EventArgs e)
{
<span style="color:Blue; if (InvokeRequired)
{
<span style="color:Blue; this.Invoke(<span style="color:Blue; new del2(f_StatusChanged), <span style="color:Blue; new <span style="color:Blue; object[] { <span style="color:Blue; null, e });
<span style="color:Blue; return;
}
<span style="color:Blue; else
{
WmvAdapter f = (WmvAdapter)sender;
List<<span style="color:Blue; double> averages = f.AveragesList;
<span style="color:Blue; bool secondPass = f.Secondpass;

<span style="color:Green; //free the resources
f.Dispose();

<span style="color:Blue; this.progressBar1.Value = <span style="color:Blue; this.progressBar1.Maximum;

<span style="color:Blue; if (!secondPass)
{
<span style="color:Green; //do the second pass processing
DoCheckResults(_outputDir, averages);
w = <span style="color:Blue; new StreamWriter(averagesListTextFile);
w.WriteLine(<span style="color:#A31515; "DANNY VIDEO META DATArnFORMAT VERSION:1.00rnSOURCE: <filename...>rnDATA: ");
<span style="color:Blue; for (<span style="color:Blue; int i = 0; i < averages.Count; i++)
{
w.WriteLine(averages);
}
w.Close();
<span style="color:Blue; this.progressBar1.Value = 0;

Start(<span style="color:Blue; true);
}
<span style="color:Blue; else
{
<span style="color:Blue; this.Text = <span style="color:#A31515; "Done";
<span style="color:Blue; this.button1.Enabled = <span style="color:Blue; true;
myTrackPanelss1.trackBar1.Enabled = <span style="color:Blue; true;
<span style="color:Blue; this.checkBox2.Enabled = <span style="color:Blue; true;
<span style="color:Blue; this.checkBox1.Enabled = <span style="color:Blue; true;
<span style="color:Green; //this.Enabled = true;
timer1.Stop();
<span style="color:Blue; this.progressBar1.Value = 0;
<span style="color:Blue; this.progressBar1.Enabled = <span style="color:Blue; false;

<span style="color:Blue; this.label2.Visible = <span style="color:Blue; false;
<span style="color:Blue; this.label4.Visible = <span style="color:Blue; false;
<span style="color:Blue; if (Directory.Exists(_outputDir))
{
_fi = <span style="color:Blue; new DirectoryInfo(_outputDir).GetFiles();
myTrackPanelss1.trackBar1.Maximum = _fi.Length - 1;

<span style="color:Blue; if ( myTrackPanelss1.trackBar1.Maximum > 0)
{
SetPicture(0);
myTrackPanelss1.trackBar1.Scroll += <span style="color:Blue; new EventHandler(trackBar1_Scroll);
}
}
label11.Visible = <span style="color:Blue; true;
label12.Text = f.FramesToSave.Count.ToString();
label12.Visible = <span style="color:Blue; true;
}
}
}

<span style="color:Blue; private <span style="color:Blue; void DoCheckResults(<span style="color:Blue; string outputDir, List<<span style="color:Blue; double> averages)
{
<span style="color:Blue; double max = averages.Max();
<span style="color:Blue; double min = averages.Min();

_fts = <span style="color:Blue; new List<<span style="color:Blue; int>();

<span style="color:Blue; if (Directory.Exists(outputDir))
{
FileInfo[] allFiles = <span style="color:Blue; new DirectoryInfo(outputDir).GetFiles();

<span style="color:Blue; double thershold = (<span style="color:Blue; double)numericUpDown1.Value;
<span style="color:Blue; double max_min_threshold = (thershold/100) * (max-min) + min;
<span style="color:Green; //label13.Text = max_min_threshold.ToString();
<span style="color:Blue; for (<span style="color:Blue; int i = 0; i < averages.Count; i++)
{
<span style="color:Blue; if (averages >= max_min_threshold)
{
_fts.Add(i);
}
}

}
}


<span style="color:Blue; void f_ProgressChanged(<span style="color:Blue; object sender, ProgressEventArgs e)
{
<span style="color:Blue; if (InvokeRequired)
{
<span style="color:Blue; this.Invoke(<span style="color:Blue; new del1(f_ProgressChanged), <span style="color:Blue; new <span style="color:Blue; object[] { <span style="color:Blue; null, e });
<span style="color:Blue; return;
}
<span style="color:Blue; else
{
<span style="color:Blue; if (e.FrameID < <span style="color:Blue; this.progressBar1.Maximum)
<span style="color:Blue; this.progressBar1.Value = e.FrameID;

<span style="color:Blue; this.label2.Text = e.FrameID.ToString();
}
}

<span style="color:Blue; void f_FrameCountAvailable(<span style="color:Blue; object sender, FrameCountEventArgs e)
{
<span style="color:Blue; if (InvokeRequired)
{
<span style="color:Blue; this.Invoke(<span style="color:Blue; new del3(f_FrameCountAvailable), <span style="color:Blue; new <span style="color:Blue; object[] { <span style="color:Blue; null, e });
<span style="color:Blue; return;
}
<span style="color:Blue; else
{
<span style="color:Blue; this.progressBar1.Maximum = (<span style="color:Blue; int)e.FrameCount;
<span style="color:Blue; this.label1.Visible = <span style="color:Blue; true;
<span style="color:Blue; this.label3.Text = e.FrameCount.ToString();
<span style="color:Blue; this.progressBar1.Enabled = <span style="color:Blue; true;
}
}

<span style="color:Blue; void trackBar1_Scroll(<span style="color:Blue; object sender, EventArgs e)
{
SetPicture( myTrackPanelss1.trackBar1.Value);
}

<span style="color:Blue; private <span style="color:Blue; void loadToolStripMenuItem_Click(<span style="color:Blue; object sender, EventArgs e)
{
<span style="color:Blue; string file1 = <span style="color:#A31515; "";
DialogResult result1; <span style="color:Gray; ///<span style="color:Green; // To fix problem with timer1 wich is stop when getting inside the debugmode after the first time \\\\\
result1 = <span style="color:Blue; new DialogResult();
openFileDialog1.Title = <span style="color:#A31515; "Select a vide ofile to load";
openFileDialog1.InitialDirectory = "c:\";
openFileDialog1.FileName = <span style="color:Blue; null;
openFileDialog1.Filter = <span style="color:#A31515; "Video File|*.mov;*.avi;*.mp4|Mov Avi Or MP4|*.mov;*.avi;*.mp4";
openFileDialog1.FilterIndex = 1;
openFileDialog1.RestoreDirectory = <span style="color:Blue; true;
result1 = openFileDialog1.ShowDialog();
<span style="color:Blue; if (result1 == DialogResult.OK)
{
file1 = openFileDialog1.FileName;
_videoFile = file1;
f = <span style="color:Blue; new WmvAdapter(_videoFile,
Path.Combine(_outputDir));
label3.Text = f.framesCounts().ToString();
label1.Visible = <span style="color:Blue; true;
label3.Visible = <span style="color:Blue; true;
button1.Enabled = <span style="color:Blue; true;
}
<span style="color:Blue; if (result1 == DialogResult.Cancel)
{
<span style="color:Blue; if (file1 == <span style="color:#A31515; "")
{

}
}
}

<span style="color:Blue; private <span style="color:Blue; void timer1_Tick(<span style="color:Blue; object sender, EventArgs e)
{
timeElapsed = timeElapsed + 1;
<span style="color:Green; //textBox2.Text = timeElapsed.ToString();
label10.Text = GetTime(timeElapsed);

}

<span style="color:Blue; public <span style="color:Blue; string GetTime(<span style="color:Blue; int Time)
{
<span style="color:Green; //Seconds
Sec = Time % 60;

<span style="color:Green; //Minutes
Min = ((Time - Sec) / 60) % 60;

<span style="color:Green; //Hours
Hrs = ((Time - (Sec + (Min * 60))) / 3600) % 60;

<span style="color:Blue; return Hrs.ToString(<span style="color:#A31515; "00") + <span style="color:#A31515; ":" +
Min.ToString(<span style="color:#A31515; "00") + <span style="color:#A31515; ":" +
Sec.ToString(<span style="color:#A31515; "00");
}

<span style="color:Blue; private <span style="color:Blue; void Form1_FormClosing(<span style="color:Blue; object sender, FormClosingEventArgs e)
{
<span style="color:Blue; if (MessageBox.Show(<span style="color:#A31515; "Are you Sure you want to Exit. Click Yes to Confirm and No to continue", <span style="color:#A31515; "WinForm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
e.Cancel = <span style="color:Blue; true;
}
<span style="color:Blue; else
{
e.Cancel = <span style="color:Blue; false;
Environment.Exit(0);
}
}

<span style="color:Blue; private <span style="color:Blue; void checkBox1_CheckedChanged(<span style="color:Blue; object sender, EventArgs e)
{
<span style="color:Blue; if (checkBox1.Checked)
{
numericUpDown1.Enabled = <span style="color:Blue; true;
}
}

<span style="color:Blue; private <span style="color:Blue; void numericUpDown1_ValueChanged(<span style="color:Blue; object sender, EventArgs e)
{
timer2.Start();
<span style="color:Blue; if (isNumericChanged == <span style="color:Blue; true)
{
counter = 0;
isNumericChanged = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void checkBox2_CheckedChanged(<span style="color:Blue; object sender, EventArgs e)
{
<span style="color:Blue; if (checkBox2.Checked)
{
myTrackPanelss1.panel1.Visible = <span style="color:Blue; true;
SetPicture(0);
myTrackPanelss1.trackBar1.Scroll += <span style="color:Blue; new EventHandler(myTrackPanless1_trackBar1_Scroll);
SetPicture( myTrackPanelss1.trackBar1.Value);
<span style="color:Green; //createAnimatedGif();
}
<span style="color:Blue; else
{
myTrackPanelss1.panel1.Visible = <span style="color:Blue; false;
SetPicture(myTrackPanelss1.trackBar1.Value);
}
}

<span style="color:Blue; private <span style="color:Blue; void myTrackPanless1_trackBar1_Scroll(<span style="color:Blue; object sender, EventArgs e)
{
SetPicture(myTrackPanelss1.trackBar1.Value);
}

<span style="color:Blue; private <span style="color:Blue; void createAnimatedGif()
{
UnFreezWrapper u = <span style="color:Blue; new UnFreezWrapper();
List<<span style="color:Blue; string> l = <span style="color:Blue; new List<<span style="color:Blue; string>();
<span style="color:Blue; for (<span style="color:Blue; int i = myTrackPanelss1.Start; i <= myTrackPanelss1.End; i++)
{
l.Add(String.Format(<span style="color:#A31515; "{0}{1}", <span style="color:#A31515; "picture", i));
}
u.MakeGIF(l, <span style="color:#A31515; @"d:anima.gif", 8, <span style="color:Blue; true);
}

<span style="color:Blue; private <span style="color:Blue; void timer2_Tick(<span style="color:Blue; object sender, EventArgs e)
{
counter = counter + 1;
<span style="color:Blue; if (counter > 7)
{
isNumericChanged = <span style="color:Blue; true;
}

}
}
}



[/code]
<br/>
Thanks
<hr class="sig danieli

View the full article
 
Back
Top