202 lines
11 KiB
XML
202 lines
11 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"
|
|
xmlns:enums="using:GazpromApp.Enums"
|
|
x:Name="Window"
|
|
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="600"
|
|
Width="1000" Height="600"
|
|
x:Class="GazpromApp.Views.EditEquipmentDialog"
|
|
x:DataType="vm:EditEquipmentDialogViewModel"
|
|
Title="Редактирование/просмотр оборудования"
|
|
Icon="/Assets/ic_fluent_table_edit_24_filled (Custom).png"
|
|
WindowStartupLocation="CenterOwner"
|
|
Closing="Window_OnClosing"
|
|
Closed="Window_OnClosed">
|
|
<Design.DataContext>
|
|
<vm:EditEquipmentDialogViewModel/>
|
|
</Design.DataContext>
|
|
<Window.Resources>
|
|
<!-- ReSharper disable once Xaml.RedundantResource -->
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.ThemeDictionaries>
|
|
<ResourceDictionary x:Key="Light">
|
|
<SolidColorBrush x:Key="BackgroundBrush" Color="#f0f0f0"/>
|
|
<SolidColorBrush x:Key="BorderBrush" Color="#d3d3d3"/>
|
|
</ResourceDictionary>
|
|
<ResourceDictionary x:Key="Dark">
|
|
<SolidColorBrush x:Key="BackgroundBrush" Color="#101010"/>
|
|
<SolidColorBrush x:Key="BorderBrush" Color="#303030"/>
|
|
</ResourceDictionary>
|
|
</ResourceDictionary.ThemeDictionaries>
|
|
</ResourceDictionary>
|
|
<enums:PeriodConverter x:Key="PeriodConverter"/>
|
|
</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>
|
|
|
|
<Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column="2"
|
|
ColumnDefinitions="*,20,4,20,8" RowDefinitions="8,20,*"
|
|
IsVisible="{Binding IsImageSelected}">
|
|
|
|
<Image Grid.ColumnSpan="5" Grid.RowSpan="3"
|
|
Source="{Binding Image.FileName, FallbackValue=null}"/>
|
|
<Button Grid.Row="1" Grid.Column="1" Width="20" Height="20"
|
|
Command="{Binding ViewImageCommand}">
|
|
<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 DeleteImageCommand}">
|
|
<Image Width="16" Height="16" Source="avares://GazpromApp/Assets/ic_fluent_delete_24_filled (Custom) 16.png"/>
|
|
</Button>
|
|
</Grid>
|
|
<Button Grid.Row="0" Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Center"
|
|
IsVisible="{Binding !IsImageSelected}"
|
|
Command="{Binding AddImageCommand}"
|
|
CommandParameter="{Binding #Window}">
|
|
<Image Width="24" Height="24"
|
|
Source="avares://GazpromApp/Assets/ic_fluent_camera_add_24_filled (Custom).png"/>
|
|
</Button>
|
|
|
|
<TabControl Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2">
|
|
<TabItem Header="Тех. осмотры">
|
|
<ScrollViewer>
|
|
<StackPanel>
|
|
<ItemsRepeater HorizontalAlignment="Stretch"
|
|
ItemsSource="{Binding Inspections}">
|
|
<ItemsRepeater.Layout>
|
|
<StackLayout Orientation="Vertical" Spacing="8"/>
|
|
</ItemsRepeater.Layout>
|
|
<ItemsRepeater.ItemTemplate>
|
|
<DataTemplate DataType="vm:InspectionViewModel">
|
|
<Border CornerRadius="4" BorderThickness="1"
|
|
Background="{DynamicResource BackgroundBrush}"
|
|
BorderBrush="{DynamicResource BorderBrush}">
|
|
<StackPanel Orientation="Vertical">
|
|
<Panel>
|
|
<TextBlock Margin="12,6,6,6" VerticalAlignment="Center"
|
|
IsVisible="{Binding !IsEditing}"
|
|
Text="{Binding Name}" FontSize="22"/>
|
|
<TextBox Height="35" Margin="12,14,84,6" FontSize="18"
|
|
IsVisible="{Binding IsEditing}"
|
|
Text="{Binding Name}"/>
|
|
<Button HorizontalAlignment="Right" Margin="0,8,20,0"
|
|
Command="{Binding #Root.((vm:EditEquipmentDialogViewModel)DataContext).EditInspectionCommand}"
|
|
CommandParameter="{Binding .}">
|
|
<Image Width="24" Source="avares://GazpromApp/Assets/ic_fluent_edit_24_filled (Custom).png"/>
|
|
</Button>
|
|
</Panel>
|
|
<Grid ColumnDefinitions="Auto, Auto, Auto, Auto, Auto, *" Margin="8">
|
|
<TextBlock Margin="10,0,0,0" Text="Дата проведения: " FontSize="18" VerticalAlignment="Center"/>
|
|
<DatePicker Grid.Column="1" VerticalAlignment="Center"
|
|
SelectedDate="{Binding InspectionDate}"/>
|
|
|
|
<TextBlock Grid.Column="2" Margin="16,0,0,0" Text="Период: " FontSize="18" VerticalAlignment="Center"/>
|
|
<NumericUpDown Grid.Column="3" AllowSpin="True" Width="120" VerticalAlignment="Center"
|
|
Value="{Binding PeriodValue}"/>
|
|
<ComboBox Grid.Column="4" Width="100" VerticalAlignment="Center" Margin="4,0,0,0"
|
|
ItemsSource="{Binding #Root.((vm:EditEquipmentDialogViewModel)DataContext).AllPeriods}"
|
|
SelectedItem="{Binding PeriodType, Mode=TwoWay}"
|
|
DisplayMemberBinding="{Binding ., Converter={StaticResource PeriodConverter}}"/>
|
|
<Button Grid.Column="5" Margin="0,0,12,0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
|
Command="{Binding #Root.((vm:EditEquipmentDialogViewModel)DataContext).DeleteInspectionCommand}"
|
|
CommandParameter="{Binding .}">
|
|
<Image Width="24" Source="avares://GazpromApp/Assets/ic_fluent_delete_24_filled (Custom).png"/>
|
|
</Button>
|
|
</Grid>
|
|
</StackPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsRepeater.ItemTemplate>
|
|
</ItemsRepeater>
|
|
<Button HorizontalAlignment="Center" Margin="10" Width="30" Height="30"
|
|
Command="{Binding AddInspectionCommand}">
|
|
<Image Width="24" Height="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:EditEquipmentDialogViewModel)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:EditEquipmentDialogViewModel)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:EditEquipmentDialogViewModel)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>
|