Just add a reference to "System.Windows.Forms.dll" and show a form
inside your console application.
lovely, this does what I wanted, the bottom method is a bit on the ugly side
though.
using System;
using System.Windows.Forms;
namespace FileDialogConsole
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
Application.Run(new Form1());
}
}
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
static bool firstPass = true;
override protected void OnVisibleChanged(System.EventArgs e)
{
base.OnVisibleChanged(e);
if(firstPass == true)
{
firstPass = false;
FolderBrowserDialog dir = new FolderBrowserDialog();
this.Hide();
dir.ShowDialog(this);
System.Console.WriteLine(dir.SelectedPath);
Application.Exit();
}
}
#endregion
}
}