2019-11-02 20:55:14 +00:00
|
|
|
|
using System;
|
2019-08-04 22:08:03 +00:00
|
|
|
|
using System.ComponentModel;
|
2019-07-22 22:17:46 +00:00
|
|
|
|
using System.Windows;
|
|
|
|
|
using Wabbajack.Common;
|
2019-09-27 04:07:54 +00:00
|
|
|
|
using Application = System.Windows.Application;
|
2019-07-22 22:17:46 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
2019-07-22 22:17:46 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
2019-10-23 04:15:42 +00:00
|
|
|
|
private MainWindowVM _mwvm;
|
2019-11-06 03:22:38 +00:00
|
|
|
|
private MainSettings _settings;
|
2019-09-14 04:35:42 +00:00
|
|
|
|
|
2019-11-02 20:55:14 +00:00
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
string[] args = Environment.GetCommandLineArgs();
|
|
|
|
|
|
|
|
|
|
if (args.Length != 3) return;
|
|
|
|
|
var modlistPath = args[2];
|
2019-11-21 15:04:33 +00:00
|
|
|
|
_settings = MainSettings.LoadSettings();
|
|
|
|
|
Initialize(RunMode.Install, modlistPath, _settings);
|
2019-11-02 20:55:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-06 03:22:38 +00:00
|
|
|
|
public MainWindow(RunMode mode, string source, MainSettings settings)
|
2019-11-02 20:55:14 +00:00
|
|
|
|
{
|
2019-11-06 03:22:38 +00:00
|
|
|
|
Initialize(mode, source, settings);
|
2019-11-02 20:55:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-06 03:22:38 +00:00
|
|
|
|
private void Initialize(RunMode mode, string source, MainSettings settings)
|
2019-07-22 22:17:46 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2019-11-21 15:04:33 +00:00
|
|
|
|
_settings = settings;
|
2019-11-06 03:22:38 +00:00
|
|
|
|
_mwvm = new MainWindowVM(mode, source, this, settings);
|
2019-10-23 04:15:42 +00:00
|
|
|
|
Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
|
2019-11-21 15:04:33 +00:00
|
|
|
|
DataContext = _mwvm;
|
2019-07-22 22:17:46 +00:00
|
|
|
|
}
|
2019-08-04 22:08:03 +00:00
|
|
|
|
|
2019-09-27 04:07:54 +00:00
|
|
|
|
internal bool ExitWhenClosing = true;
|
|
|
|
|
|
2019-08-04 22:08:03 +00:00
|
|
|
|
private void Window_Closing(object sender, CancelEventArgs e)
|
|
|
|
|
{
|
2019-10-23 04:15:42 +00:00
|
|
|
|
_mwvm.Dispose();
|
2019-11-21 15:04:33 +00:00
|
|
|
|
MainSettings.SaveSettings(_settings);
|
2019-09-27 04:07:54 +00:00
|
|
|
|
if (ExitWhenClosing)
|
2019-10-23 04:15:42 +00:00
|
|
|
|
{
|
2019-09-27 04:07:54 +00:00
|
|
|
|
Application.Current.Shutdown();
|
2019-10-23 04:15:42 +00:00
|
|
|
|
}
|
2019-08-04 22:08:03 +00:00
|
|
|
|
}
|
2019-07-22 22:17:46 +00:00
|
|
|
|
}
|
2019-11-21 15:04:33 +00:00
|
|
|
|
}
|