mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-01 02:40:24 +08:00
(FileExistsDialog): new modal window.
added FileErrorDialog logic to GarConvert.
This commit is contained in:
72
GUI/FileExistsDialog.xaml.cs
Normal file
72
GUI/FileExistsDialog.xaml.cs
Normal file
@@ -0,0 +1,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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user