Bug fix
This commit is contained in:
+26
-22
@@ -10,12 +10,36 @@
|
||||
x:DataType="vm:EditPointDialogViewModel"
|
||||
Title="Редактирование/просмотр объекта"
|
||||
Icon="/Assets/ic_fluent_edit_24_filled (Custom).png"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Closing="Window_OnClosing"
|
||||
Closed="Window_OnClosed">
|
||||
<Design.DataContext>
|
||||
<vm:EditPointDialogViewModel/>
|
||||
</Design.DataContext>
|
||||
<Grid RowDefinitions="70,150,*,Auto" ColumnDefinitions="*,100,220" x:Name="Root">
|
||||
<Panel Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Center">
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" FontSize="28" Margin="20,4,0,4"
|
||||
Text="{Binding Name}"
|
||||
IsVisible="{Binding !IsNameEditing}"/>
|
||||
<TextBox Grid.Column="0" Grid.Row="0" Margin="12,12,0,4"
|
||||
Text="{Binding Name}"
|
||||
IsVisible="{Binding IsNameEditing}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" Margin="10"
|
||||
Command="{Binding EditNameCommand}">
|
||||
<Image Width="24" Height="24" Source="avares://GazpromApp/Assets/ic_fluent_edit_24_filled (Custom).png"/>
|
||||
</Button>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="1" Margin="20,4,0,4"
|
||||
Text="{Binding Description}"
|
||||
IsVisible="{Binding !IsDescriptionEditing}"/>
|
||||
<TextBox Grid.Column="0" Grid.Row="1" Margin="12,4,0,4"
|
||||
Text="{Binding Description}"
|
||||
IsVisible="{Binding IsDescriptionEditing}"/>
|
||||
<Button Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" Margin="10"
|
||||
Command="{Binding EditDescriptionCommand}">
|
||||
<Image Width="24" Height="24" Source="avares://GazpromApp/Assets/ic_fluent_edit_24_filled (Custom).png"/>
|
||||
</Button>
|
||||
|
||||
<Panel Grid.Row="0" Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Center">
|
||||
<ScrollViewer HorizontalAlignment="Center">
|
||||
<StackPanel>
|
||||
<ItemsRepeater HorizontalAlignment="Center"
|
||||
@@ -59,26 +83,6 @@
|
||||
</Button>
|
||||
</Panel>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" FontSize="28" Margin="20,4,0,4"
|
||||
Text="{Binding Name}"
|
||||
IsVisible="{Binding !IsNameEditing}"/>
|
||||
<TextBox Grid.Column="0" Grid.Row="0" Margin="12,12,0,4"
|
||||
Text="{Binding Name}"
|
||||
IsVisible="{Binding IsNameEditing}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" Margin="10"
|
||||
Command="{Binding EditNameCommand}">
|
||||
<Image Width="24" Height="24" Source="avares://GazpromApp/Assets/ic_fluent_edit_24_filled (Custom).png"/>
|
||||
</Button>
|
||||
<TextBlock Grid.Column="0" Grid.Row="1" Margin="20,4,0,4"
|
||||
Text="{Binding Description}"
|
||||
IsVisible="{Binding !IsDescriptionEditing}"/>
|
||||
<TextBox Grid.Column="0" Grid.Row="1" Margin="12,4,0,4"
|
||||
Text="{Binding Description}"
|
||||
IsVisible="{Binding IsDescriptionEditing}"/>
|
||||
<Button Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" Margin="10"
|
||||
Command="{Binding EditDescriptionCommand}">
|
||||
<Image Width="24" Height="24" Source="avares://GazpromApp/Assets/ic_fluent_edit_24_filled (Custom).png"/>
|
||||
</Button>
|
||||
<TabControl Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2">
|
||||
<TabItem Header="Оборудование">
|
||||
<ScrollViewer>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
using Avalonia.Controls;
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using GazpromApp.Messages;
|
||||
using GazpromApp.Models;
|
||||
using GazpromApp.ViewModels;
|
||||
|
||||
namespace GazpromApp.Views;
|
||||
|
||||
public partial class EditPointDialog : Window
|
||||
{
|
||||
public Point? Point;
|
||||
|
||||
public EditPointDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -14,6 +18,7 @@ public partial class EditPointDialog : Window
|
||||
if (Design.IsDesignMode)
|
||||
return;
|
||||
|
||||
// view image
|
||||
WeakReferenceMessenger.Default.Register<EditPointDialog, ViewImageMessage>(this, static (w, m) =>
|
||||
{
|
||||
ImageView dialog = new ImageView()
|
||||
@@ -28,4 +33,15 @@ public partial class EditPointDialog : Window
|
||||
w.Close(m.Point);
|
||||
});
|
||||
}
|
||||
|
||||
private void Window_OnClosing(object? sender, WindowClosingEventArgs e)
|
||||
{
|
||||
if (DataContext is EditPointDialogViewModel { IsClosed: false } vm)
|
||||
vm.CancelEditCommand.Execute(this);
|
||||
}
|
||||
|
||||
private void Window_OnClosed(object? sender, EventArgs e)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Unregister<ViewImageMessage>(this);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,8 @@ public partial class MainWindow : Window
|
||||
{
|
||||
EditPointDialog dialog = new EditPointDialog()
|
||||
{
|
||||
DataContext = new EditPointDialogViewModel(m.Point)
|
||||
DataContext = new EditPointDialogViewModel(m.Point),
|
||||
Point = m.Point.GetPoint()
|
||||
};
|
||||
m.Reply(dialog.ShowDialog<PointViewModel?>(w));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user