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