public MyLoIndexerAppForm() { InitializeComponent(); button1.Enabled = false; progressBar1.Visible = false; _userId = 0; _pl = new PhotoLoader(); }
private void loadPhotosButton_Click(object sender, EventArgs e) { if (_userId != 0) { PhotoLoader photoLoader = new PhotoLoader(); photoLoader.UserLogin(_userId); FolderBrowserDialog openFolderDialog1 = new FolderBrowserDialog(); openFolderDialog1.RootFolder = Environment.SpecialFolder.MyComputer; openFolderDialog1.Description = "Select the photo directory that you want to load"; if (openFolderDialog1.ShowDialog() == DialogResult.OK) { string folderName = openFolderDialog1.SelectedPath; Cursor.Current = Cursors.WaitCursor; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); try { int count = photoLoader.StartLoading(folderName); TimeSpan ts = stopWatch.Elapsed; string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); textBox3.Text = String.Format("Finished Loading {0}; Time: {1}; Number: {2}", folderName, elapsedTime, count); PopulateTimePeriodList(); Cursor.Current = Cursors.Default; } catch (Exception ex) { textBox3.Text = String.Format(ex.Message); } } } }