/// <summary> /// Download all files, that were checked in treeview /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDownloadCheckedFiles_Click(object sender, EventArgs e) { Dictionary<string, string> downloadlist = GetCheckedFiles(); //Do we have files checked? if (downloadlist.Count == 0) { MessageBox.Show("No files where checked", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //Where do we want to store our files folderBrowserDialog1.SelectedPath = Properties.Settings.Default.LastImageSaveDir; DialogResult res = folderBrowserDialog1.ShowDialog(); if (res == DialogResult.OK) { Properties.Settings.Default.LastImageSaveDir = folderBrowserDialog1.SelectedPath; tsslMessage.Text = string.Format("...downloading {0} files to '{1}'", downloadlist.Count, folderBrowserDialog1.SelectedPath); foreach (string key in downloadlist.Keys.ToList()) { string filedownloadpath = folderBrowserDialog1.SelectedPath + '\\' + key.Replace('/', '\\'); downloadlist[key] = filedownloadpath; } if (Properties.Settings.Default.SimulateCamera) { downloadthread = new Download(string.Format("", Properties.Settings.Default.IPAdressCamera), downloadlist); } else { downloadthread = new Download(string.Format("http://{0}/v1/photos", Properties.Settings.Default.IPAdressCamera), downloadlist); } downloadthread.DownloadNotify += downloadthread_DownloadNotify; downloadthread.Start(); } }
/// <summary> /// Closing MainForm /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { //Stopping threads if (downloadthread != null) { downloadthread.Stop(); downloadthread = null; } if (thumbnailthread != null) { thumbnailthread.Stop(); thumbnailthread = null; } if (mjsource != null) { mjsource.Stop(); mjsource = null; } Properties.Settings.Default.WindowSize = this.Size; Properties.Settings.Default.WindowLocation = this.Location; Properties.Settings.Default.splitContainerDebugPosition = splitContainerDebug.SplitterDistance; Properties.Settings.Default.splitContainerPictureviewPosition = splitContainerPictureview.SplitterDistance; Properties.Settings.Default.Save(); log.Debug("Application closing"); }