mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Replace Window with ManagedWindow in GoToSectorDialog implementation
This commit is contained in:
@@ -26,27 +26,24 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Avalonia.Controls;
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Iciclecreek.Avalonia.WindowManager;
|
||||||
|
|
||||||
namespace Aaru.Tui.ViewModels.Dialogs;
|
namespace Aaru.Tui.ViewModels.Dialogs;
|
||||||
|
|
||||||
public sealed partial class GoToSectorDialogViewModel : ViewModelBase
|
public sealed partial class GoToSectorDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
readonly ulong _maxSector;
|
readonly ulong _maxSector;
|
||||||
internal Window _dialog = null!;
|
internal ManagedWindow _dialog = null!;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
string _errorMessage = string.Empty;
|
string _errorMessage = string.Empty;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
bool _hasError;
|
bool _hasError;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
string _sectorNumber = string.Empty;
|
string _sectorNumber = string.Empty;
|
||||||
|
|
||||||
public GoToSectorDialogViewModel(Window dialog, ulong maxSector)
|
public GoToSectorDialogViewModel(ManagedWindow dialog, ulong maxSector)
|
||||||
{
|
{
|
||||||
_dialog = dialog;
|
_dialog = dialog;
|
||||||
_maxSector = maxSector;
|
_maxSector = maxSector;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
<windowManager:ManagedWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:Aaru.Tui.ViewModels.Dialogs"
|
xmlns:vm="using:Aaru.Tui.ViewModels.Dialogs"
|
||||||
xmlns:brushes="https://github.com/jinek/consolonia"
|
xmlns:brushes="https://github.com/jinek/consolonia"
|
||||||
|
xmlns:windowManager="clr-namespace:Iciclecreek.Avalonia.WindowManager;assembly=Iciclecreek.Avalonia.WindowManager"
|
||||||
Width="40"
|
Width="40"
|
||||||
Height="8"
|
Height="8"
|
||||||
x:Class="Aaru.Tui.Views.Dialogs.GoToSectorDialog"
|
x:Class="Aaru.Tui.Views.Dialogs.GoToSectorDialog"
|
||||||
x:DataType="vm:GoToSectorDialogViewModel"
|
x:DataType="vm:GoToSectorDialogViewModel"
|
||||||
Title="Go to Sector"
|
Title="Go to Sector"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
RequestedThemeVariant="Dark"
|
|
||||||
CanResize="False">
|
CanResize="False">
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<vm:GoToSectorDialogViewModel />
|
<vm:GoToSectorDialogViewModel />
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</Border.BorderBrush>
|
</Border.BorderBrush>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Enter sector number:" />
|
<TextBlock Text="Enter sector number:" />
|
||||||
<TextBox Text="{Binding SectorNumber, Mode=OneWay}"
|
<TextBox Text="{Binding SectorNumber, Mode=TwoWay}"
|
||||||
Watermark="Sector number" />
|
Watermark="Sector number" />
|
||||||
<TextBlock Text="{Binding ErrorMessage, Mode=OneWay}"
|
<TextBlock Text="{Binding ErrorMessage, Mode=OneWay}"
|
||||||
Foreground="Red"
|
Foreground="Red"
|
||||||
@@ -35,4 +35,4 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Window>
|
</windowManager:ManagedWindow>
|
||||||
@@ -25,11 +25,11 @@
|
|||||||
// Copyright © 2011-2025 Natalia Portillo
|
// Copyright © 2011-2025 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using Avalonia.Controls;
|
using Iciclecreek.Avalonia.WindowManager;
|
||||||
|
|
||||||
namespace Aaru.Tui.Views.Dialogs;
|
namespace Aaru.Tui.Views.Dialogs;
|
||||||
|
|
||||||
public partial class GoToSectorDialog : Window
|
public partial class GoToSectorDialog : ManagedWindow
|
||||||
{
|
{
|
||||||
public GoToSectorDialog()
|
public GoToSectorDialog()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user