GARbro-mirror/GUI/ConvertMedia.xaml.cs

53 lines
1.5 KiB
C#
Raw Normal View History

using System.Linq;
using System.Windows;
using System.Windows.Input;
using GameRes;
using GARbro.GUI.Strings;
using Microsoft.WindowsAPICodePack.Dialogs;
2014-08-22 14:16:11 +08:00
namespace GARbro.GUI
{
/// <summary>
/// Interaction logic for ConvertMedia.xaml
2014-08-22 14:16:11 +08:00
/// </summary>
public partial class ConvertMedia : Window
2014-08-22 14:16:11 +08:00
{
public ConvertMedia ()
2014-08-22 14:16:11 +08:00
{
InitializeComponent ();
ImageConversionFormat.ItemsSource = FormatCatalog.Instance.ImageFormats.Where (f => f.CanWrite);
2014-08-22 14:16:11 +08:00
}
private void BrowseExec (object sender, ExecutedRoutedEventArgs e)
{
var dlg = new CommonOpenFileDialog
{
Title = guiStrings.TextChooseDestDir,
IsFolderPicker = true,
InitialDirectory = DestinationDir.Text,
AddToMostRecentlyUsedList = false,
AllowNonFileSystemItems = false,
EnsureFileExists = true,
EnsurePathExists = true,
EnsureReadOnly = false,
EnsureValidNames = true,
Multiselect = false,
ShowPlacesList = true,
};
if (dlg.ShowDialog (this) == CommonFileDialogResult.Ok)
DestinationDir.Text = dlg.FileName;
}
public void CanExecuteAlways (object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
2014-08-22 14:16:11 +08:00
private void ConvertButton_Click (object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
}
}