mirror of
https://github.com/crskycode/GARbro.git
synced 2026-06-16 02:34:17 +08:00
added dialog popup on extraction errors.
looks like Ookii.Dialogs have to be replaced with manual progress dialog implementation, as i have no control over progress dialog window once extraction has begun. frankly, i just need to be able to call StopProgressDialog and StartProgressDialog from IProgressDialog interface, but Ookii does not provide such low-level access.
This commit is contained in:
76
GUI/FileErrorDialog.xaml.cs
Normal file
76
GUI/FileErrorDialog.xaml.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GARbro.GUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FileErrorDialog.xaml
|
||||
/// </summary>
|
||||
public partial class FileErrorDialog : Rnd.Windows.ModalWindow
|
||||
{
|
||||
public FileErrorDialog (string title, string error_text)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new ViewModel { Title = title, Text = error_text };
|
||||
}
|
||||
|
||||
private void ContinueButton_Click (object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = true;
|
||||
}
|
||||
|
||||
private void AbortButton_Click (object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
|
||||
private class ViewModel
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Text { get; set; }
|
||||
public ICommand CopyCommand { get; private set; }
|
||||
|
||||
public ViewModel ()
|
||||
{
|
||||
CopyCommand = new ActionCommand (CopyText);
|
||||
}
|
||||
|
||||
private void CopyText ()
|
||||
{
|
||||
try
|
||||
{
|
||||
Clipboard.SetText (Text);
|
||||
}
|
||||
catch (Exception X)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine (X.Message, "Clipboard error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionCommand : ICommand
|
||||
{
|
||||
readonly Action m_action;
|
||||
|
||||
public ActionCommand (Action action)
|
||||
{
|
||||
m_action = action;
|
||||
}
|
||||
|
||||
public void Execute (object parameter)
|
||||
{
|
||||
m_action();
|
||||
}
|
||||
|
||||
public bool CanExecute (object parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma warning disable 67
|
||||
public event EventHandler CanExecuteChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user