wabbajack/Wabbajack/ModlistPropertiesWindow.xaml.cs

77 lines
2.4 KiB
C#
Raw Normal View History

2019-10-07 12:02:31 +00:00
using System;
using System.Collections.Generic;
2019-10-07 12:13:53 +00:00
using System.ComponentModel;
2019-10-07 12:02:31 +00:00
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
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();
2019-10-07 12:40:19 +00:00
var bannerImage = UIUtils.BitmapImageFromResource("Wabbajack.banner.png");
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");
if(file != null)
{
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;
}
string modListName = ModlistNameProperty.Text;
string modListAuthor = ModlistAuthorProperty.Text;
string modListDescription = ModlistDescriptionProperty.Text;
string modListWebsite = ModlistWebsiteProperty.Text;
state.SplashScreenModName = modListName;
state.SplashScreenSummary = modListDescription;
state.SplashScreenAuthorName = modListAuthor;
state._nexusSiteURL = modListWebsite;
state.ChangedProperties = true;
Hide();
}
}
2019-10-07 12:02:31 +00:00
}
}