예제 #1
1
		private void OnProcessFileDialog(Object sender, FileDialogEventArgs e)
		{
			switch (e.Mode)
			{
				case FileDialogMode.Save:
					using (var saveDialog = new SaveFileDialog())
					{
						saveDialog.Title = e.Title;
						saveDialog.Filter = e.Filter;
						saveDialog.FileName = e.DefaultFileName;
						if (saveDialog.ShowDialog() != DialogResult.Cancel)
						{
							FormProgress.ShowProgress();
							FormProgress.SetTitle("Downloading…", true);
							FormProgress.SetDetails(Path.GetFileName(saveDialog.FileName));
							TabControl.Enabled = false;
							Application.DoEvents();
							e.Continue(saveDialog.FileName);
						}
						else
							e.Cancel();
					}
					break;
			}
			e.Handled = true;
		}
예제 #2
0
 private void OnProcessFileDialog(Object sender, FileDialogEventArgs e)
 {
     switch (e.Mode)
     {
     case FileDialogMode.Save:
         using (var saveDialog = new SaveFileDialog())
         {
             saveDialog.Title    = e.Title;
             saveDialog.Filter   = e.Filter;
             saveDialog.FileName = e.DefaultFileName;
             if (saveDialog.ShowDialog() != DialogResult.Cancel)
             {
                 FormProgress.ShowProgress();
                 FormProgress.SetTitle("Downloading…", true);
                 FormProgress.SetDetails(Path.GetFileName(saveDialog.FileName));
                 Application.DoEvents();
                 e.Continue(saveDialog.FileName);
             }
             else
             {
                 e.Cancel();
             }
         }
         break;
     }
     e.Handled = true;
 }
 private void OnProcessFileDialog(object sender, FileDialogEventArgs e)
 {
     switch (e.Mode)
     {
     case FileDialogMode.Save:
         using (var saveDialog = new SaveFileDialog())
         {
             saveDialog.Title            = e.Title;
             saveDialog.Filter           = e.Filter;
             saveDialog.FileName         = Path.GetFileName(e.DefaultFileName);
             saveDialog.InitialDirectory = Path.Combine(
                 Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
                 "Downloads");
             if (saveDialog.ShowDialog(_siteContainer.ParentBundle.MainForm) != DialogResult.Cancel)
             {
                 FormDownloadProgress.ShowProgress(_siteContainer.ParentBundle.MainForm);
                 Application.DoEvents();
                 FormDownloadProgress.SetTitle("Downloading…");
                 Application.DoEvents();
                 FormDownloadProgress.SetDetails(Path.GetFileName(saveDialog.FileName));
                 Application.DoEvents();
                 _siteContainer.SuspendPages();
                 Application.DoEvents();
                 e.Continue(saveDialog.FileName);
             }
             else
             {
                 e.Cancel();
             }
         }
         break;
     }
     e.Handled = true;
 }
예제 #4
0
		private void OnProcessFileDialog(object sender, FileDialogEventArgs e)
		{
			switch (e.Mode)
			{
				case FileDialogMode.Save:
					using (var saveDialog = new SaveFileDialog())
					{
						saveDialog.Title = e.Title;
						saveDialog.Filter = e.Filter;
						saveDialog.FileName = Path.GetFileName(e.DefaultFileName);
						saveDialog.InitialDirectory = Path.Combine(
							Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
							"Downloads");
						if (saveDialog.ShowDialog(FormMain.Instance) != DialogResult.Cancel)
						{
							FormDownloadProgress.ShowProgress(FormMain.Instance);
							FormDownloadProgress.SetTitle("Downloading…");
							FormDownloadProgress.SetDetails(Path.GetFileName(saveDialog.FileName));
							FormMain.Instance.SuspendPages();
							Application.DoEvents();
							e.Continue(saveDialog.FileName);
						}
						else
							e.Cancel();
					}
					break;
			}
			e.Handled = true;
		}