forked from amkovkov/GranuSightSoftware2
refactor: MainWindow View and ViewModel
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
xmlns:vm="using:GSS2.UI.Core.ViewModels"
|
||||
Title="{Binding Title}"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
SystemDecorations="{Binding SystemDecorations}"
|
||||
WindowDecorations="{Binding WindowDecorations}"
|
||||
Topmost="{Binding Topmost}"
|
||||
WindowState="{Binding WindowState}">
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@ public partial class MainWindow : Window
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
// #if DEBUG
|
||||
// this.AttachDevTools();
|
||||
// #endif
|
||||
}
|
||||
|
||||
public void SetControl(UserControl control)
|
||||
public void SetControl(Control control)
|
||||
{
|
||||
MainContent.Content = control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,26 +2,17 @@ using Avalonia.Controls;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace GSS2.UI.Core.ViewModels;
|
||||
|
||||
public partial class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ILogger<MainWindowViewModel> _logger;
|
||||
[ObservableProperty] public partial string Title { get; set; }
|
||||
[ObservableProperty] public partial WindowDecorations WindowDecorations { get; set; }
|
||||
[ObservableProperty] public partial bool Topmost { get; set; }
|
||||
[ObservableProperty] public partial WindowState WindowState { get; set; }
|
||||
|
||||
[ObservableProperty] private string _title;
|
||||
[ObservableProperty] private SystemDecorations _systemDecorations;
|
||||
[ObservableProperty] private bool _topmost;
|
||||
[ObservableProperty] private WindowState _windowState;
|
||||
|
||||
public MainWindowViewModel(ILogger<MainWindowViewModel> logger)
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
_logger = logger;
|
||||
_logger.LogInformation("Initialization");
|
||||
|
||||
Title = "GranuSight Software 2";
|
||||
|
||||
_logger.LogInformation("Initialized");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user