221 lines
12 KiB
XML
221 lines
12 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:vm="using:GazpromApp.ViewModels"
|
|
x:Name="Window"
|
|
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="600"
|
|
Width="1000" Height="600"
|
|
x:Class="GazpromApp.Views.EditPointDialog"
|
|
x:DataType="vm:EditPointDialogViewModel"
|
|
Title="Редактирование/просмотр объекта"
|
|
Icon="/Assets/ic_fluent_edit_24_filled (Custom).png"
|
|
WindowStartupLocation="CenterOwner"
|
|
Closing="Window_OnClosing"
|
|
Closed="Window_OnClosed">
|
|
<Design.DataContext>
|
|
<vm:EditPointDialogViewModel/>
|
|
</Design.DataContext>
|
|
<Window.Resources>
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.ThemeDictionaries>
|
|
<ResourceDictionary x:Key="Light">
|
|
<SolidColorBrush x:Key="BackgroundBrush" Color="#f0f0f0"/>
|
|
<SolidColorBrush x:Key="BorderBrush" Color="#d3d3d3"/>
|
|
</ResourceDictionary>
|
|
<ResourceDictionary x:Key="Dark">
|
|
<!-- ReSharper disable once Xaml.RedundantResource -->
|
|
<SolidColorBrush x:Key="BackgroundBrush" Color="#101010"/>
|
|
<!-- ReSharper disable once Xaml.RedundantResource -->
|
|
<SolidColorBrush x:Key="BorderBrush" Color="#303030"/>
|
|
</ResourceDictionary>
|
|
</ResourceDictionary.ThemeDictionaries>
|
|
</ResourceDictionary>
|
|
</Window.Resources>
|
|
<Grid RowDefinitions="70,150,*,Auto" ColumnDefinitions="*,100,220" x:Name="Root">
|
|
<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"
|
|
ItemsSource="{Binding Images}">
|
|
<ItemsRepeater.Layout>
|
|
<UniformGridLayout Orientation="Horizontal" MaximumRowsOrColumns="1"/>
|
|
</ItemsRepeater.Layout>
|
|
<ItemsRepeater.ItemTemplate>
|
|
<DataTemplate DataType="vm:ImageViewModel">
|
|
<Border Margin="4" CornerRadius="4" Background="LightGray">
|
|
<Grid Margin="2" Width="200" Height="200" Background="LightGray"
|
|
ColumnDefinitions="*,20,4,20,8" RowDefinitions="8,20,*">
|
|
<Image Stretch="Uniform" Width="200" Height="200" Grid.RowSpan="3" Grid.ColumnSpan="5"
|
|
Source="{Binding FileName}" />
|
|
<Button Grid.Row="1" Grid.Column="1" Width="20" Height="20"
|
|
Command="{Binding #Root.((vm:EditPointDialogViewModel)DataContext).ViewImageCommand}"
|
|
CommandParameter="{Binding .}">
|
|
<Image Width="16" Height="16" Source="avares://GazpromApp/Assets/ic_fluent_eye_show_24_filled (Custom) 16.png"/>
|
|
</Button>
|
|
<Button Grid.Row="1" Grid.Column="3" Width="20" Height="20"
|
|
Command="{Binding #Root.((vm:EditPointDialogViewModel)DataContext).DeleteImageCommand}"
|
|
CommandParameter="{Binding .}">
|
|
<Image Width="16" Height="16" Source="avares://GazpromApp/Assets/ic_fluent_delete_24_filled (Custom) 16.png"/>
|
|
</Button>
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsRepeater.ItemTemplate>
|
|
</ItemsRepeater>
|
|
<Button HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding !IsImagesEmpty}"
|
|
Command="{Binding AddImageCommand}"
|
|
CommandParameter="{Binding #Window}">
|
|
<Image Width="24" Source="avares://GazpromApp/Assets/ic_fluent_camera_add_24_filled (Custom).png"/>
|
|
</Button>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
<Button HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
IsVisible="{Binding IsImagesEmpty}"
|
|
Command="{Binding AddImageCommand}"
|
|
CommandParameter="{Binding #Window}">
|
|
<Image Width="24" Source="avares://GazpromApp/Assets/ic_fluent_camera_add_24_filled (Custom).png"/>
|
|
</Button>
|
|
</Panel>
|
|
|
|
<TabControl Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2">
|
|
<TabItem Header="Оборудование">
|
|
<ScrollViewer>
|
|
<StackPanel>
|
|
<ItemsRepeater
|
|
ItemsSource="{Binding Equipment}">
|
|
<ItemsRepeater.Layout>
|
|
<StackLayout Orientation="Vertical"/>
|
|
</ItemsRepeater.Layout>
|
|
<ItemsRepeater.ItemTemplate>
|
|
<DataTemplate DataType="vm:EquipmentViewModel">
|
|
<Expander HorizontalAlignment="Stretch" Margin="0,4,0,4"
|
|
Background="{DynamicResource BackgroundBrush}"
|
|
BorderBrush="{DynamicResource BorderBrush}">
|
|
<Expander.Header>
|
|
<Grid Height="54" HorizontalAlignment="Stretch"
|
|
ColumnDefinitions="52, 300, *, Auto">
|
|
<Image Height="50" Width="50" Margin="0,2,2,2" HorizontalAlignment="Center" Stretch="Uniform"
|
|
Source="{Binding Images[0].FileName, FallbackValue=null}"/>
|
|
<TextBlock Grid.Column="1" FontSize="20" VerticalAlignment="Center" Margin="4,0,0,0"
|
|
Text="{Binding Name}"/>
|
|
<TextBlock Grid.Column="2" FontSize="15" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
|
Text="{Binding Description}"/>
|
|
</Grid>
|
|
</Expander.Header>
|
|
<Grid ColumnDefinitions="Auto, *, Auto, Auto">
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
|
<TextBlock FontSize="18" Text="Ближайший ТО: "/>
|
|
<TextBlock FontSize="18" Text="{Binding NearestInspection}"/>
|
|
<TextBlock FontSize="18" Text="Свойств: " Margin="18, 0,0,0"/>
|
|
<TextBlock FontSize="18" Text="{Binding Properties.Count}"/>
|
|
</StackPanel>
|
|
<Button Grid.Column="2"
|
|
Command="{Binding #Root.((vm:EditPointDialogViewModel)DataContext).EditEquipmentCommand}"
|
|
CommandParameter="{Binding .}"
|
|
Margin="4,0,4,0">
|
|
<Image Source="avares://GazpromApp/Assets/ic_fluent_edit_24_filled (Custom).png"/>
|
|
</Button>
|
|
<Button Grid.Column="3"
|
|
Command="{Binding #Root.((vm:EditPointDialogViewModel)DataContext).DeleteEquipmentCommand}"
|
|
CommandParameter="{Binding .}"
|
|
Margin="4,0,4,0">
|
|
<Image Source="avares://GazpromApp/Assets/ic_fluent_delete_24_filled (Custom).png"/>
|
|
</Button>
|
|
</Grid>
|
|
</Expander>
|
|
</DataTemplate>
|
|
</ItemsRepeater.ItemTemplate>
|
|
</ItemsRepeater>
|
|
<Button Height="30" Width="30" HorizontalAlignment="Center" Margin="0,20,0,0"
|
|
Command="{Binding AddEquipmentCommand}">
|
|
<Image Height="24" Width="24" Source="avares://GazpromApp/Assets/ic_fluent_add_24_filled (Custom).png"/>
|
|
</Button>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
<TabItem Header="Свойства">
|
|
<ScrollViewer>
|
|
<StackPanel>
|
|
<TreeView ItemsSource="{Binding Properties}">
|
|
<TreeView.DataTemplates>
|
|
<TreeDataTemplate DataType="{x:Type vm:PropertyViewModel}"
|
|
ItemsSource="{Binding Properties}">
|
|
<Grid ColumnDefinitions="150,*,Auto,Auto,Auto">
|
|
<TextBlock Grid.Column="0" FontSize="18" VerticalAlignment="Center"
|
|
IsVisible="{Binding !IsEditing}"
|
|
Text="{Binding Name}"/>
|
|
<TextBox Grid.Column="0"
|
|
IsVisible="{Binding IsEditing}"
|
|
Text="{Binding Name}"/>
|
|
|
|
<TextBlock Grid.Column="1" FontSize="18" VerticalAlignment="Center"
|
|
IsVisible="{Binding !IsEditing}"
|
|
Text="{Binding Value}"/>
|
|
<TextBox Grid.Column="1"
|
|
IsVisible="{Binding IsEditing}"
|
|
Text="{Binding Value}"/>
|
|
|
|
<Button Grid.Column="2" Width="30" Height="30" Margin="4" VerticalAlignment="Center"
|
|
Command="{Binding #Root.((vm:EditPointDialogViewModel)DataContext).AddPropertyCommand}"
|
|
CommandParameter="{Binding .}">
|
|
<Image Width="24" Height="24" Source="avares://GazpromApp/Assets/ic_fluent_add_24_filled (Custom).png"/>
|
|
</Button>
|
|
<Button Grid.Column="3" Width="30" Height="30" Margin="4" VerticalAlignment="Center"
|
|
Command="{Binding #Root.((vm:EditPointDialogViewModel)DataContext).EditPropertyCommand}"
|
|
CommandParameter="{Binding .}">
|
|
<Panel>
|
|
<Image Width="24" Height="24" Source="avares://GazpromApp/Assets/ic_fluent_edit_24_filled (Custom).png"
|
|
IsVisible="{Binding !IsEditing}"/>
|
|
<Image Width="24" Height="24" Source="avares://GazpromApp/Assets/ic_fluent_save_24_filled (Custom).png"
|
|
IsVisible="{Binding IsEditing}"/>
|
|
</Panel>
|
|
</Button>
|
|
<Button Grid.Column="4" Width="30" Height="30" Margin="4" VerticalAlignment="Center"
|
|
Command="{Binding #Root.((vm:EditPointDialogViewModel)DataContext).DeletePropertyCommand}"
|
|
CommandParameter="{Binding .}">
|
|
<Image Height="24" Width="24" Source="avares://GazpromApp/Assets/ic_fluent_delete_24_filled (Custom).png"/>
|
|
</Button>
|
|
</Grid>
|
|
</TreeDataTemplate>
|
|
</TreeView.DataTemplates>
|
|
</TreeView>
|
|
<Button HorizontalAlignment="Center" Margin="10" Width="30" Height="30"
|
|
Command="{Binding AddPropertySimpleCommand}">
|
|
<Image Height="24" Width="24" Source="avares://GazpromApp/Assets/ic_fluent_add_24_filled (Custom).png"/>
|
|
</Button>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
</TabControl>
|
|
|
|
<Button Grid.Column="0" Grid.Row="3" Margin="8" Content="Отменить"
|
|
Command="{Binding CancelEditCommand}"
|
|
CommandParameter="{Binding #Window}"/>
|
|
<Button Grid.Column="2" Grid.Row="3" Margin="8" Content="Сохранить" HorizontalAlignment="Right"
|
|
Command="{Binding CompleteEditCommand}"/>
|
|
</Grid>
|
|
</Window>
|