- Why the animation is working when i have 3 images and more on hard disk but when i have 2 images on hard disk it dosent work good?
- private void button3_Click(object sender, EventArgs e)
- {
- try
- {
- wichButtonAnimationClickedForward = false;
- wichButtonAnimationClickedBackwards = true;
- button5.Text = "Pause Animation";
- file_array_check = Directory.GetFiles(sf, "radar*.png");
- if (file_array_check.Length == 0)
- {
- file_array_satellite = Directory.GetFiles(satellite_dir, "satellite*.png");
- DateTime[] creationTimes2 = new DateTime[file_array_satellite.Length];
- for (int i = 0; i < file_array_satellite.Length; i++)
- creationTimes2[i] = new FileInfo(file_array_satellite[i]).CreationTime;
- Array.Sort(creationTimes2, file_array_satellite);
- file_indxs_satellite = file_array_satellite.Length;
- file_indxs_satellite = file_array_satellite.Length - 1;
- timer3.Enabled = false;
- timer2.Enabled = true;
- }
- else
- {
- wichButtonAnimationClickedForward = false;
- wichButtonAnimationClickedBackwards = true;
- file_array = Directory.GetFiles(sf, "radar*.png");
- DateTime[] creationTimes3 = new DateTime[file_array.Length];
- for (int i = 0; i < file_array.Length; i++)
- creationTimes3[i] = new FileInfo(file_array[i]).CreationTime;
- Array.Sort(creationTimes3, file_array);
- file_indexs = file_array.Length;
- file_indexs = file_array.Length - 1;
- timer2.Enabled = true;
- timer3.Enabled = false;
- }
- }
- catch
- {
- }
- try
- {
- wichButtonAnimationClickedForward = false;
- wichButtonAnimationClickedBackwards = true;
- file_array_check = Directory.GetFiles(satellite_dir, "satellite*.png");
- if (file_array_check.Length == 0)
- {
- file_array = Directory.GetFiles(sf, "radar*.png");
- DateTime[] creationTimes5 = new DateTime[file_array.Length];
- for (int i = 0; i < file_array.Length; i++)
- creationTimes5[i] = new FileInfo(file_array[i]).CreationTime;
- Array.Sort(creationTimes5, file_array);
- file_indexs = file_array.Length;
- file_indexs = file_array.Length - 1;
- timer2.Enabled = true;
- timer3.Enabled = false;
- }
- else
- {
- wichButtonAnimationClickedForward = false;
- wichButtonAnimationClickedBackwards = true;
- file_array_satellite = Directory.GetFiles(satellite_dir, "satellite*.png");
- DateTime[] creationTimes6 = new DateTime[file_array_satellite.Length];
- for (int i = 0; i < file_array_satellite.Length; i++)
- creationTimes6[i] = new FileInfo(file_array_satellite[i]).CreationTime;
- Array.Sort(creationTimes6, file_array_satellite);
- file_indxs_satellite = file_array_satellite.Length;
- file_indxs_satellite = file_array_satellite.Length - 1;
- timer3.Enabled = false;
- timer2.Enabled = true;
- // לבדוק כפתור
- // Pause שממשיכים עושה רק קדימה
- // לעשות SORT גם לקבצים של הראדר והלוויין ביתר המקומות
- }
- }
- catch (Exception AnimationError)
- {
- Logger.Write("Animation Error: " + AnimationError);
- }
- }
- private void timer2_Tick(object sender, EventArgs e)
- {
- try
- {
- // לבדוק גם מדוע הוא מדי פעם אחורה ואולי גם קדימה אבל כרגע בספירה אחורה מראה מדי פעם תאריכים אחרים מחודש 11 קופץ ל 10 פתאום וחזרה ל 11.
- // לבדוק אנימציה קדימה לא עובד. לבדוק כשאחד מהספריות שהוא מראה תקבצים וסופר אחורה או קדימה הוא נעצר בקובץ האחרון במקום להתאפס ולהמשיך שוב ושוב ללכת אחורה או קדימה עד שעוצרים.
- // לבדוק עכשיו רק את הכפתור 5 של ה PAUSE
- // לבדוק את הכפתור ה 5 כשעושיפ עצירה וממשיכים הוא תמיד ממשיך קדימה באנימציה לבדוק שאם עוצרים וממשיכים כשהאנימציה אחורה הייתה פועלת שימשיך אחורה ואם קדימה אז קדימה! יתר הדברים באנימציה נפתרו!
- pictureBox2.Load(file_array_satellite[file_indxs_satellite]);
- label12.Visible = true;
- label12.Text = "Satellite files date and time: " + File.GetCreationTime(file_array_satellite[file_indxs_satellite]);
- file_indxs_satellite = file_indxs_satellite - 1;
- /* trackBar2_satellite_images.Minimum = 0;
- trackBar2_satellite_images.Maximum = file_array_satellite.Length;
- trackBar2_satellite_images.Value = file_indxs_satellite;*/
- pictureBox1.Load(file_array[file_indexs]);
- label10.Visible = true;
- label10.Text = "Radar files date and time: " + File.GetCreationTime(file_array[file_indexs]);
- file_indexs = file_indexs - 1;
- /* trackBar1_radar_images.Minimum = 0;
- trackBar1_radar_images.Maximum = file_array.Length;
- trackBar1_radar_images.Value = file_indexs;*/
- if (file_indxs_satellite < 0)
- {
- file_indxs_satellite = file_array_satellite.Length - 1;
- }
- if (file_indexs < 0)
- {
- file_indexs = file_array.Length - 1;
- }
- }
- catch
- {
- timer2.Enabled = false;
- }
- }
- private void button4_Click(object sender, EventArgs e)
- {
- try
- {
- wichButtonAnimationClickedForward = true;
- wichButtonAnimationClickedBackwards = false;
- button5.Text = "Pause Animation";
- file_array_check = Directory.GetFiles(sf, "radar*.png");
- if (file_array_check.Length == 0)
- {
- file_array_satellite = Directory.GetFiles(satellite_dir, "satellite*.png");
- DateTime[] creationTimes8 = new DateTime[file_array_satellite.Length];
- for (int i = 0; i < file_array_satellite.Length; i++)
- creationTimes8[i] = new FileInfo(file_array_satellite[i]).CreationTime;
- Array.Sort(creationTimes8, file_array_satellite);
- file_indxs_satellite = 0;
- file_indxs_satellite = file_array_satellite.Length - 1;
- timer3.Enabled = true;
- timer2.Enabled = false;
- }
- else
- {
- wichButtonAnimationClickedForward = true;
- wichButtonAnimationClickedBackwards = false;
- file_array = Directory.GetFiles(sf, "radar*.png");
- DateTime[] creationTimes9 = new DateTime[file_array.Length];
- for (int i = 0; i < file_array.Length; i++)
- creationTimes9[i] = new FileInfo(file_array[i]).CreationTime;
- Array.Sort(creationTimes9, file_array);
- file_indexs = 0;
- file_indexs = file_array.Length - 1;
- timer3.Enabled = true;
- timer2.Enabled = false;
- }
- }
- catch (Exception AnimationError)
- {
- Logger.Write("Animation Error: " + AnimationError);
- }
- try
- {
- wichButtonAnimationClickedForward = true;
- wichButtonAnimationClickedBackwards = false;
- file_array_check = Directory.GetFiles(satellite_dir, "satellite*.png");
- if (file_array_check.Length == 0)
- {
- file_array = Directory.GetFiles(sf, "radar*.png");
- DateTime[] creationTimes11 = new DateTime[file_array.Length];
- for (int i = 0; i < file_array.Length; i++)
- creationTimes11[i] = new FileInfo(file_array[i]).CreationTime;
- Array.Sort(creationTimes11, file_array);
- file_indexs = 0;
- file_indexs = file_array.Length - 1;
- timer3.Enabled = true;
- timer2.Enabled = false;
- }
- else
- {
- wichButtonAnimationClickedForward = true;
- wichButtonAnimationClickedBackwards = false;
- file_array_satellite = Directory.GetFiles(satellite_dir, "satellite*.png");
- DateTime[] creationTimes12 = new DateTime[file_array_satellite.Length];
- for (int i = 0; i < file_array_satellite.Length; i++)
- creationTimes12[i] = new FileInfo(file_array_satellite[i]).CreationTime;
- Array.Sort(creationTimes12, file_array_satellite);
- file_indxs_satellite = 0;
- file_indxs_satellite = file_array_satellite.Length - 1;
- timer3.Enabled = true;
- timer2.Enabled = false;
- }
- }
- catch (Exception AnimationError)
- {
- Logger.Write("Animation Error: " + AnimationError);
- }
- }
- private void timer3_Tick(object sender, EventArgs e)
- {
- try
- {
- pictureBox2.Load(file_array_satellite[file_indxs_satellite]);
- label12.Visible = true;
- label12.Text = "Satellite files date and time: " + File.GetCreationTime(file_array_satellite[file_indxs_satellite]);
- file_indxs_satellite = file_indxs_satellite + 1;
- /* trackBar2_satellite_images.Minimum = 0;
- trackBar2_satellite_images.Maximum = file_array_satellite.Length;
- trackBar2_satellite_images.Value = file_indxs_satellite;*/
- pictureBox1.Load(file_array[file_indexs]);
- label10.Visible = true;
- label10.Text = "Radar files date and time: " + File.GetCreationTime(file_array[file_indexs]);
- file_indexs = file_indexs + 1;
- /* trackBar1_radar_images.Minimum = 0;
- trackBar1_radar_images.Maximum = file_array.Length;
- trackBar1_radar_images.Value = file_indexs;*/
- if (file_indxs_satellite == file_array_satellite.Length)
- {
- file_indxs_satellite = 0;
- }
- if (file_indexs == file_array.Length)
- {
- file_indexs = 0;
- }
- }
- catch (Exception timer3Error)
- {
- Logger.Write("Timer3 Error: " + timer3Error);
- timer3.Enabled = false;
- }
- }