forked from morkt/GARbro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileExistsDialog.xaml.cs
72 lines (63 loc) · 1.9 KB
/
FileExistsDialog.xaml.cs
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace GARbro.GUI
{
/// <summary>
/// Interaction logic for FileExistsDialog.xaml
/// </summary>
public partial class FileExistsDialog : Rnd.Windows.ModalWindow
{
public FileExistsDialog (string title, string text)
{
InitializeComponent ();
this.Title = title;
this.Notice.Text = text;
}
new public FileExistsDialogResult ShowDialog ()
{
bool dialog_result = base.ShowDialog() ?? false;
if (!dialog_result)
FileAction = ExistingFileAction.Abort;
return new FileExistsDialogResult
{
Action = FileAction,
ApplyToAll = ApplyToAll.IsChecked ?? false
};
}
public ExistingFileAction FileAction { get; set; }
private void SkipButton_Click (object sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.FileAction = ExistingFileAction.Skip;
}
private void OverwriteButton_Click (object sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.FileAction = ExistingFileAction.Overwrite;
}
private void RenameButton_Click (object sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.FileAction = ExistingFileAction.Rename;
}
private void AbortButton_Click (object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.FileAction = ExistingFileAction.Abort;
}
}
public enum ExistingFileAction
{
Skip,
Overwrite,
Rename,
Abort
}
public struct FileExistsDialogResult
{
public ExistingFileAction Action;
public bool ApplyToAll;
}
}