-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
48 lines (39 loc) · 1.5 KB
/
Program.cs
File metadata and controls
48 lines (39 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
namespace SharpFileDialog.Sample
{
class Program
{
[STAThread]
static void Main(string[] args)
{
using (var dirDialog = new DirectoryDialog("Select a directory"))
dirDialog.Open(result => OpenDirectory(result.FileName));
Console.ReadKey();
using (var openDialog = new OpenFileDialog("This is a test dialog"))
{
var filter = "Text files(*.txt) | *.txt | Png files(*.png) | *.png | All files(*.*) | *.*";
openDialog.Open(result => OpenFile(result.FileName), filter);
}
Console.ReadKey();
using (var saveDialog = new SaveFileDialog("Another test for saving"))
{
var filter = "Text files(*.txt) | *.txt | Png files(*.png) | *.png | All files(*.*) | *.*";
saveDialog.DefaultFileName = "filename.txt";
saveDialog.Save(result => SaveFile(result.FileName), filter);
}
Console.ReadKey();
}
private static void OpenDirectory(string filename)
{
Console.WriteLine("Opening directory: {0}", filename);
}
private static void OpenFile(string filename)
{
Console.WriteLine("Opening file: {0}", filename);
}
private static void SaveFile(string filename)
{
Console.WriteLine("Saving file: {0}", filename);
}
}
}