mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #229 from Noggog/fixes-and-err-handling
Fixes and err handling
This commit is contained in:
commit
4bc375e306
BIN
Branding/PNGs/Wabba_Ded.png
Normal file
BIN
Branding/PNGs/Wabba_Ded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 182 KiB |
BIN
Branding/Project files/Wabba_Ded.psd
Normal file
BIN
Branding/Project files/Wabba_Ded.psd
Normal file
Binary file not shown.
@ -18,7 +18,14 @@ namespace Wabbajack
|
||||
{
|
||||
if (Exception != null)
|
||||
{
|
||||
return Exception.ToString();
|
||||
if (string.IsNullOrWhiteSpace(_reason))
|
||||
{
|
||||
return Exception.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"{_reason}: {Exception.Message}";
|
||||
}
|
||||
}
|
||||
return _reason;
|
||||
}
|
||||
@ -53,9 +60,9 @@ namespace Wabbajack
|
||||
return new ErrorResponse(true, reason);
|
||||
}
|
||||
|
||||
public static ErrorResponse Fail(string reason)
|
||||
public static ErrorResponse Fail(string reason, Exception ex = null)
|
||||
{
|
||||
return new ErrorResponse(false, reason: reason);
|
||||
return new ErrorResponse(false, reason: reason, ex: ex);
|
||||
}
|
||||
|
||||
public static ErrorResponse Fail(Exception ex)
|
||||
|
@ -794,7 +794,7 @@ namespace Wabbajack.Common
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
return ErrorResponse.Fail("Path was empty.");
|
||||
return ErrorResponse.Fail("Path is empty.");
|
||||
}
|
||||
try
|
||||
{
|
||||
@ -819,7 +819,7 @@ namespace Wabbajack.Common
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
return ErrorResponse.Fail("Path was empty");
|
||||
return ErrorResponse.Fail("Path is empty");
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
@ -95,7 +96,6 @@ namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
}
|
||||
|
||||
;
|
||||
if (stream.IsFaulted || response.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
Utils.Log($"While downloading {Url} - {stream.Exception.ExceptionToString()}");
|
||||
@ -111,6 +111,11 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
var contentSize = headerVar != null ? long.Parse(headerVar) : 1;
|
||||
|
||||
FileInfo fileInfo = new FileInfo(destination);
|
||||
if (!fileInfo.Directory.Exists)
|
||||
{
|
||||
Directory.CreateDirectory(fileInfo.Directory.FullName);
|
||||
}
|
||||
|
||||
using (var webs = stream.Result)
|
||||
using (var fs = File.OpenWrite(destination))
|
||||
|
@ -14,19 +14,7 @@ namespace Wabbajack
|
||||
{
|
||||
public App()
|
||||
{
|
||||
// Wire any unhandled crashing exceptions to log before exiting
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||
{
|
||||
// Don't do any special logging side effects
|
||||
Utils.Log("Uncaught error:");
|
||||
Utils.Log(((Exception)e.ExceptionObject).ExceptionToString());
|
||||
};
|
||||
|
||||
var appPath = Assembly.GetExecutingAssembly().Location;
|
||||
if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
|
||||
{
|
||||
ExtensionManager.Associate(appPath);
|
||||
}
|
||||
// Initialization in MainWindow ctor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
Wabbajack/Resources/Wabba_Ded.png
Normal file
BIN
Wabbajack/Resources/Wabba_Ded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 182 KiB |
@ -24,11 +24,15 @@ namespace Wabbajack
|
||||
private Subject<Unit> _saveSignal = new Subject<Unit>();
|
||||
public IObservable<Unit> SaveSignal => _saveSignal;
|
||||
|
||||
public static MainSettings LoadSettings()
|
||||
public static bool TryLoadTypicalSettings(out MainSettings settings)
|
||||
{
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
if (!File.Exists(_filename) || args.Length > 1 && args[1] == "nosettings") return new MainSettings();
|
||||
return JsonConvert.DeserializeObject<MainSettings>(File.ReadAllText(_filename));
|
||||
if (!File.Exists(_filename))
|
||||
{
|
||||
settings = default;
|
||||
return false;
|
||||
}
|
||||
settings = JsonConvert.DeserializeObject<MainSettings>(File.ReadAllText(_filename));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void SaveSettings(MainSettings settings)
|
||||
|
@ -190,10 +190,10 @@ namespace Wabbajack
|
||||
{
|
||||
Title = PromptTitle,
|
||||
IsFolderPicker = PathType == PathTypeOptions.Folder,
|
||||
InitialDirectory = TargetPath,
|
||||
InitialDirectory = dirPath,
|
||||
AddToMostRecentlyUsedList = false,
|
||||
AllowNonFileSystemItems = false,
|
||||
DefaultDirectory = TargetPath,
|
||||
DefaultDirectory = dirPath,
|
||||
EnsureFileExists = true,
|
||||
EnsurePathExists = true,
|
||||
EnsureReadOnly = false,
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Syroot.Windows.IO;
|
||||
using Syroot.Windows.IO;
|
||||
using System;
|
||||
using ReactiveUI;
|
||||
using System.Diagnostics;
|
||||
@ -28,11 +28,12 @@ namespace Wabbajack
|
||||
public MainWindowVM MWVM { get; }
|
||||
|
||||
public BitmapImage WabbajackLogo { get; } = UIUtils.BitmapImageFromStream(Application.GetResourceStream(new Uri("pack://application:,,,/Wabbajack;component/Resources/Wabba_Mouth_No_Text.png")).Stream);
|
||||
public BitmapImage WabbajackErrLogo { get; } = UIUtils.BitmapImageFromStream(Application.GetResourceStream(new Uri("pack://application:,,,/Wabbajack;component/Resources/Wabba_Ded.png")).Stream);
|
||||
|
||||
private readonly ObservableAsPropertyHelper<ModListVM> _modList;
|
||||
public ModListVM ModList => _modList.Value;
|
||||
|
||||
public FilePickerVM ModListPath { get; }
|
||||
public FilePickerVM ModListLocation { get; }
|
||||
|
||||
private readonly ObservableAsPropertyHelper<ISubInstallerVM> _installer;
|
||||
public ISubInstallerVM Installer => _installer.Value;
|
||||
@ -97,7 +98,7 @@ namespace Wabbajack
|
||||
|
||||
MWVM = mainWindowVM;
|
||||
|
||||
ModListPath = new FilePickerVM()
|
||||
ModListLocation = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.On,
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
@ -133,19 +134,17 @@ namespace Wabbajack
|
||||
MWVM.Settings.SaveSignal
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
MWVM.Settings.Installer.LastInstalledListLocation = ModListPath.TargetPath;
|
||||
MWVM.Settings.Installer.LastInstalledListLocation = ModListLocation.TargetPath;
|
||||
})
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
_modList = this.WhenAny(x => x.ModListPath.TargetPath)
|
||||
_modList = this.WhenAny(x => x.ModListLocation.TargetPath)
|
||||
.ObserveOn(RxApp.TaskpoolScheduler)
|
||||
.Select(modListPath =>
|
||||
{
|
||||
if (modListPath == null) return default(ModListVM);
|
||||
if (!File.Exists(modListPath)) return default(ModListVM);
|
||||
var modList = AInstaller.LoadFromFile(modListPath);
|
||||
if (modList == null) return default(ModListVM);
|
||||
return new ModListVM(modList, modListPath);
|
||||
return new ModListVM(modListPath);
|
||||
})
|
||||
.ObserveOnGuiThread()
|
||||
.StartWith(default(ModListVM))
|
||||
@ -161,6 +160,15 @@ namespace Wabbajack
|
||||
.Select(modList => modList?.ModManager)
|
||||
.ToProperty(this, nameof(TargetManager));
|
||||
|
||||
// Add additional error check on modlist
|
||||
ModListLocation.AdditionalError = this.WhenAny(x => x.ModList)
|
||||
.Select<ModListVM, IErrorResponse>(modList =>
|
||||
{
|
||||
if (modList == null) return ErrorResponse.Fail("Modlist path resulted in a null object.");
|
||||
if (modList.Error != null) return ErrorResponse.Fail("Modlist is corrupt", modList.Error);
|
||||
return ErrorResponse.Success;
|
||||
});
|
||||
|
||||
BackCommand = ReactiveCommand.Create(
|
||||
execute: () => mainWindowVM.ActivePane = mainWindowVM.ModeSelectionVM,
|
||||
canExecute: this.WhenAny(x => x.Installing)
|
||||
@ -186,6 +194,7 @@ namespace Wabbajack
|
||||
// Set display items to modlist if configuring or complete,
|
||||
// or to the current slideshow data if installing
|
||||
_image = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModList.Error),
|
||||
this.WhenAny(x => x.ModList)
|
||||
.SelectMany(x => x?.ImageObservable ?? Observable.Empty<BitmapImage>())
|
||||
.NotNull()
|
||||
@ -193,7 +202,14 @@ namespace Wabbajack
|
||||
this.WhenAny(x => x.Slideshow.Image)
|
||||
.StartWith(default(BitmapImage)),
|
||||
this.WhenAny(x => x.Installing),
|
||||
resultSelector: (modList, slideshow, installing) => installing ? slideshow : modList)
|
||||
resultSelector: (err, modList, slideshow, installing) =>
|
||||
{
|
||||
if (err != null)
|
||||
{
|
||||
return WabbajackErrLogo;
|
||||
}
|
||||
return installing ? slideshow : modList;
|
||||
})
|
||||
.Select<BitmapImage, ImageSource>(x => x)
|
||||
.ToProperty(this, nameof(Image));
|
||||
_titleText = Observable.CombineLatest(
|
||||
@ -217,8 +233,16 @@ namespace Wabbajack
|
||||
this.WhenAny(x => x.Installing),
|
||||
resultSelector: (modList, mod, installing) => installing ? mod : modList)
|
||||
.ToProperty(this, nameof(Description));
|
||||
_modListName = this.WhenAny(x => x.ModList)
|
||||
.Select(x => x?.Name)
|
||||
_modListName = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModList.Error)
|
||||
.Select(x => x != null),
|
||||
this.WhenAny(x => x.ModList)
|
||||
.Select(x => x?.Name),
|
||||
resultSelector: (err, name) =>
|
||||
{
|
||||
if (err) return "Corrupted Modlist";
|
||||
return name;
|
||||
})
|
||||
.ToProperty(this, nameof(ModListName));
|
||||
|
||||
// Define commands
|
||||
@ -279,7 +303,7 @@ namespace Wabbajack
|
||||
private void OpenReadmeWindow()
|
||||
{
|
||||
if (string.IsNullOrEmpty(ModList.Readme)) return;
|
||||
using (var fs = new FileStream(ModListPath.TargetPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var fs = new FileStream(ModListLocation.TargetPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
|
@ -54,9 +54,10 @@ namespace Wabbajack
|
||||
canExecute: Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Location.InError),
|
||||
this.WhenAny(x => x.DownloadLocation.InError),
|
||||
resultSelector: (loc, download) =>
|
||||
installerVM.WhenAny(x => x.ModListLocation.InError),
|
||||
resultSelector: (loc, modlist, download) =>
|
||||
{
|
||||
return !loc && !download;
|
||||
return !loc && !download && !modlist;
|
||||
})
|
||||
.ObserveOnGuiThread(),
|
||||
execute: async () =>
|
||||
@ -66,7 +67,7 @@ namespace Wabbajack
|
||||
try
|
||||
{
|
||||
installer = new MO2Installer(
|
||||
archive: installerVM.ModListPath.TargetPath,
|
||||
archive: installerVM.ModListLocation.TargetPath,
|
||||
modList: installerVM.ModList.SourceModList,
|
||||
outputFolder: Location.TargetPath,
|
||||
downloadFolder: DownloadLocation.TargetPath);
|
||||
@ -119,7 +120,7 @@ namespace Wabbajack
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Load settings
|
||||
_CurrentSettings = installerVM.WhenAny(x => x.ModListPath.TargetPath)
|
||||
_CurrentSettings = installerVM.WhenAny(x => x.ModListLocation.TargetPath)
|
||||
.Select(path => path == null ? null : installerVM.MWVM.Settings.Installer.Mo2ModlistSettings.TryCreate(path))
|
||||
.ToProperty(this, nameof(CurrentSettings));
|
||||
this.WhenAny(x => x.CurrentSettings)
|
||||
@ -144,7 +145,7 @@ namespace Wabbajack
|
||||
|
||||
private void SaveSettings(Mo2ModlistInstallationSettings settings)
|
||||
{
|
||||
_installerVM.MWVM.Settings.Installer.LastInstalledListLocation = _installerVM.ModListPath.TargetPath;
|
||||
_installerVM.MWVM.Settings.Installer.LastInstalledListLocation = _installerVM.ModListLocation.TargetPath;
|
||||
if (settings == null) return;
|
||||
settings.InstallationLocation = Location.TargetPath;
|
||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||
|
@ -33,8 +33,11 @@ namespace Wabbajack
|
||||
.ToProperty(this, nameof(TargetGame));
|
||||
|
||||
BeginCommand = ReactiveCommand.CreateFromTask(
|
||||
canExecute: this.WhenAny(x => x.TargetGame)
|
||||
.Select(game => VortexCompiler.IsActiveVortexGame(game)),
|
||||
canExecute: Observable.CombineLatest(
|
||||
this.WhenAny(x => x.TargetGame)
|
||||
.Select(game => VortexCompiler.IsActiveVortexGame(game)),
|
||||
installerVM.WhenAny(x => x.ModListLocation.InError),
|
||||
resultSelector: (isVortexGame, modListErr) => isVortexGame && !modListErr),
|
||||
execute: async () =>
|
||||
{
|
||||
AInstaller installer;
|
||||
@ -44,7 +47,7 @@ namespace Wabbajack
|
||||
var download = VortexCompiler.RetrieveDownloadLocation(TargetGame);
|
||||
var staging = VortexCompiler.RetrieveStagingLocation(TargetGame);
|
||||
installer = new VortexInstaller(
|
||||
archive: installerVM.ModListPath.TargetPath,
|
||||
archive: installerVM.ModListLocation.TargetPath,
|
||||
modList: installerVM.ModList.SourceModList,
|
||||
outputFolder: staging,
|
||||
downloadFolder: download);
|
||||
|
@ -54,7 +54,7 @@ namespace Wabbajack
|
||||
|
||||
if (IsStartingFromModlist(out var path))
|
||||
{
|
||||
Installer.Value.ModListPath.TargetPath = path;
|
||||
Installer.Value.ModListLocation.TargetPath = path;
|
||||
ActivePane = Installer.Value;
|
||||
}
|
||||
else
|
||||
@ -83,7 +83,7 @@ namespace Wabbajack
|
||||
var installer = Installer.Value;
|
||||
Settings.Installer.LastInstalledListLocation = path;
|
||||
ActivePane = installer;
|
||||
installer.ModListPath.TargetPath = path;
|
||||
installer.ModListLocation.TargetPath = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,25 +12,33 @@ namespace Wabbajack
|
||||
public class ModListVM : ViewModel
|
||||
{
|
||||
public ModList SourceModList { get; }
|
||||
public Exception Error { get; }
|
||||
public string ModListPath { get; }
|
||||
public string Name => SourceModList.Name;
|
||||
public string ReportHTML => SourceModList.ReportHTML;
|
||||
public string Readme => SourceModList.Readme;
|
||||
public string ImageURL => SourceModList.Image;
|
||||
public string Author => SourceModList.Author;
|
||||
public string Description => SourceModList.Description;
|
||||
public string Website => SourceModList.Website;
|
||||
public ModManager ModManager => SourceModList.ModManager;
|
||||
public string Name => SourceModList?.Name;
|
||||
public string ReportHTML => SourceModList?.ReportHTML;
|
||||
public string Readme => SourceModList?.Readme;
|
||||
public string ImageURL => SourceModList?.Image;
|
||||
public string Author => SourceModList?.Author;
|
||||
public string Description => SourceModList?.Description;
|
||||
public string Website => SourceModList?.Website;
|
||||
public ModManager ModManager => SourceModList?.ModManager ?? ModManager.MO2;
|
||||
|
||||
// Image isn't exposed as a direct property, but as an observable.
|
||||
// This acts as a caching mechanism, as interested parties will trigger it to be created,
|
||||
// and the cached image will automatically be released when the last interested party is gone.
|
||||
public IObservable<BitmapImage> ImageObservable { get; }
|
||||
|
||||
public ModListVM(ModList sourceModList, string modListPath)
|
||||
public ModListVM(string modListPath)
|
||||
{
|
||||
ModListPath = modListPath;
|
||||
SourceModList = sourceModList;
|
||||
try
|
||||
{
|
||||
SourceModList = AInstaller.LoadFromFile(modListPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Error = ex;
|
||||
}
|
||||
|
||||
ImageObservable = Observable.Return(ImageURL)
|
||||
.ObserveOn(RxApp.TaskpoolScheduler)
|
||||
@ -39,13 +47,13 @@ namespace Wabbajack
|
||||
try
|
||||
{
|
||||
if (!File.Exists(url)) return default(MemoryStream);
|
||||
if (string.IsNullOrWhiteSpace(sourceModList.Image)) return default(MemoryStream);
|
||||
if (sourceModList.Image.Length != 36) return default(MemoryStream);
|
||||
if (string.IsNullOrWhiteSpace(ImageURL)) return default(MemoryStream);
|
||||
if (ImageURL.Length != 36) return default(MemoryStream);
|
||||
using (var fs = new FileStream(ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
{
|
||||
var ms = new MemoryStream();
|
||||
var entry = ar.GetEntry(sourceModList.Image);
|
||||
var entry = ar.GetEntry(ImageURL);
|
||||
using (var e = entry.Open())
|
||||
{
|
||||
e.CopyTo(ms);
|
||||
|
@ -1,4 +1,4 @@
|
||||
using DynamicData;
|
||||
using DynamicData;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System;
|
||||
@ -74,7 +74,7 @@ namespace Wabbajack
|
||||
// Whenever modlist changes, grab the list of its slides
|
||||
.Select(modList =>
|
||||
{
|
||||
if (modList == null)
|
||||
if (modList?.SourceModList?.Archives == null)
|
||||
{
|
||||
return Observable.Empty<ModVM>()
|
||||
.ToObservableChangeSet(x => x.ModID);
|
||||
|
@ -65,7 +65,7 @@
|
||||
x:Name="LargeProgressBar"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Background="Transparent"
|
||||
Background="#88121212"
|
||||
BorderThickness="0"
|
||||
Maximum="1"
|
||||
Opacity="{Binding ProgressOpacityPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
|
||||
|
@ -38,8 +38,8 @@
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<local:HeatedBackgroundView
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
PercentCompleted="{Binding PercentCompleted}" />
|
||||
<Grid
|
||||
x:Name="Slideshow"
|
||||
@ -312,7 +312,7 @@
|
||||
Grid.Column="2"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{Binding ModListPath}"
|
||||
DataContext="{Binding ModListLocation}"
|
||||
FontSize="14" />
|
||||
<ContentPresenter
|
||||
Grid.Row="2"
|
||||
|
@ -15,23 +15,82 @@ namespace Wabbajack
|
||||
private MainWindowVM _mwvm;
|
||||
private MainSettings _settings;
|
||||
|
||||
internal bool ExitWhenClosing = true;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
_settings = MainSettings.LoadSettings();
|
||||
Left = _settings.PosX;
|
||||
Top = _settings.PosY;
|
||||
_mwvm = new MainWindowVM(this, _settings);
|
||||
DataContext = _mwvm;
|
||||
// Wire any unhandled crashing exceptions to log before exiting
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||
{
|
||||
// Don't do any special logging side effects
|
||||
Wabbajack.Common.Utils.Log("Uncaught error:");
|
||||
Wabbajack.Common.Utils.Log(((Exception)e.ExceptionObject).ExceptionToString());
|
||||
};
|
||||
|
||||
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||
if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
|
||||
{
|
||||
ExtensionManager.Associate(appPath);
|
||||
}
|
||||
|
||||
Wabbajack.Common.Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
|
||||
|
||||
this.Loaded += (sender, e) =>
|
||||
// Load settings
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
if ((args.Length > 1 && args[1] == "nosettings")
|
||||
|| !MainSettings.TryLoadTypicalSettings(out var settings))
|
||||
{
|
||||
Width = _settings.Width;
|
||||
Height = _settings.Height;
|
||||
};
|
||||
_settings = new MainSettings();
|
||||
RunWhenLoaded(DefaultSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
_settings = settings;
|
||||
RunWhenLoaded(LoadSettings);
|
||||
}
|
||||
|
||||
// Set datacontext
|
||||
_mwvm = new MainWindowVM(this, _settings);
|
||||
DataContext = _mwvm;
|
||||
}
|
||||
|
||||
internal bool ExitWhenClosing = true;
|
||||
public void Init(MainWindowVM vm, MainSettings settings)
|
||||
{
|
||||
DataContext = vm;
|
||||
_mwvm = vm;
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
private void RunWhenLoaded(Action a)
|
||||
{
|
||||
if (IsLoaded)
|
||||
{
|
||||
a();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Loaded += (sender, e) =>
|
||||
{
|
||||
a();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
Width = _settings.Width;
|
||||
Height = _settings.Height;
|
||||
Left = _settings.PosX;
|
||||
Top = _settings.PosY;
|
||||
}
|
||||
|
||||
private void DefaultSettings()
|
||||
{
|
||||
Width = 1300;
|
||||
Height = 960;
|
||||
Left = 15;
|
||||
Top = 15;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
|
@ -510,5 +510,8 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Wabba_Mouth_No_Text.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Wabba_Ded.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user