2021-09-27 12:42:46 +00:00
|
|
|
using System;
|
|
|
|
using System.Reactive.Disposables;
|
|
|
|
using Avalonia;
|
|
|
|
using Avalonia.Controls;
|
|
|
|
using Avalonia.ReactiveUI;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using ReactiveUI;
|
|
|
|
using Wabbajack.App.ViewModels;
|
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
namespace Wabbajack.App.Views;
|
|
|
|
|
|
|
|
public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
public MainWindow()
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
InitializeComponent();
|
|
|
|
DataContext = App.Services.GetService<MainWindowViewModel>()!;
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-11-04 13:01:48 +00:00
|
|
|
this.WhenActivated(disposables =>
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
CloseButton.Command = ReactiveCommand.Create(() => Environment.Exit(0))
|
2021-11-04 13:01:48 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-10-23 16:51:17 +00:00
|
|
|
MinimizeButton.Command = ReactiveCommand.Create(() => WindowState = WindowState.Minimized)
|
2021-11-04 13:01:48 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-10-23 16:51:17 +00:00
|
|
|
|
|
|
|
this.BindCommand(ViewModel, vm => vm.BackButton, view => view.BackButton)
|
2021-11-04 13:01:48 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-10-23 16:51:17 +00:00
|
|
|
|
|
|
|
this.BindCommand(ViewModel, vm => vm.SettingsButton, view => view.SettingsButton)
|
2021-11-04 13:01:48 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-10-23 16:51:17 +00:00
|
|
|
|
|
|
|
this.BindCommand(ViewModel, vm => vm.LogViewButton, view => view.LogButton)
|
2021-11-04 13:01:48 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-11-04 13:01:48 +00:00
|
|
|
this.OneWayBind(ViewModel, vm => vm.CurrentScreen, view => view.Contents.Content)
|
|
|
|
.DisposeWith(disposables);
|
2021-10-23 16:51:17 +00:00
|
|
|
|
2021-11-04 13:01:48 +00:00
|
|
|
this.OneWayBind(ViewModel, vm => vm.ResourceStatus, view => view.ResourceStatus.Text)
|
|
|
|
.DisposeWith(disposables);
|
|
|
|
|
|
|
|
this.OneWayBind(ViewModel, vm => vm.TitleText, view => view.TitleText.Text)
|
|
|
|
.DisposeWith(disposables);
|
2021-10-23 16:51:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Width = 1125;
|
|
|
|
Height = 900;
|
2021-09-27 12:42:46 +00:00
|
|
|
|
|
|
|
#if DEBUG
|
2021-10-23 16:51:17 +00:00
|
|
|
this.AttachDevTools();
|
2021-09-27 12:42:46 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|