wabbajack/Wabbajack/UI/ModlistPropertiesWindow.xaml.cs

80 lines
2.4 KiB
C#
Raw Normal View History

2019-10-07 12:02:31 +00:00
using System;
2019-10-07 12:13:53 +00:00
using System.ComponentModel;
2019-10-07 12:02:31 +00:00
using System.Windows;
using System.Windows.Media.Imaging;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for ModlistPropertiesWindow.xaml
/// </summary>
public partial class ModlistPropertiesWindow : Window
{
internal string newBannerFile;
internal readonly AppState state;
internal ModlistPropertiesWindow(AppState _state)
2019-10-07 12:02:31 +00:00
{
InitializeComponent();
var bannerImage = UIUtils.BitmapImageFromResource("Wabbajack.UI.banner.png");
2019-10-07 12:40:19 +00:00
SplashScreenProperty.Source = bannerImage;
newBannerFile = null;
state = _state;
2019-10-07 12:02:31 +00:00
}
2019-10-07 12:13:53 +00:00
private void Window_Closing(object sender, CancelEventArgs e)
{
//Hide();
}
2019-10-07 12:40:19 +00:00
private void SetSplashScreen_Click(object sender, RoutedEventArgs e)
{
var file = UIUtils.OpenFileDialog("Banner image|*.png");
2019-10-07 17:33:34 +00:00
if (file != null)
2019-10-07 12:40:19 +00:00
{
newBannerFile = file;
2019-10-07 12:40:19 +00:00
SplashScreenProperty.Source = new BitmapImage(new Uri(file));
}
}
private void SaveProperties_Click(object sender, RoutedEventArgs e)
{
if (state.UIReady)
{
if (newBannerFile != null)
{
BitmapImage splashScreen = new BitmapImage(new Uri(newBannerFile));
state.newImagePath = newBannerFile;
state.SplashScreenImage = splashScreen;
}
2019-10-11 12:57:42 +00:00
state.SplashScreenModName = ModlistNameProperty.Text;
state.SplashScreenSummary = ModlistDescriptionProperty.Text;
state.SplashScreenAuthorName = ModlistAuthorProperty.Text;
state._nexusSiteURL = ModlistWebsiteProperty.Text;
state.readmePath = ModlistReadmeProperty.Text;
state.ChangedProperties = true;
Hide();
}
}
public bool IsClosed { get; private set; }
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
IsClosed = true;
}
2019-10-11 12:57:42 +00:00
private void ChooseReadme_Click(object sender, RoutedEventArgs e)
{
var file = UIUtils.OpenFileDialog("Readme|*.txt");
if (file != null)
{
ModlistReadmeProperty.Text = file;
}
}
2019-10-07 12:02:31 +00:00
}
}