Лабарторная 4 Измененная

This commit is contained in:
IlyasValiulov 2024-10-04 14:33:22 +04:00
parent 2ff58a9910
commit b3f98cc173
2 changed files with 51 additions and 7 deletions

View File

@ -8,11 +8,21 @@
Title="MainWindow" Height="500" Width="800" MinHeight="450" MinWidth="600" Background="LightYellow">
<Window.Resources>
<SolidColorBrush x:Key="BrushBlack" Color="Black"/>
<SolidColorBrush x:Key="BrushWheat" Color="Wheat"/>
<Style x:Key="buttonDesicion" TargetType="Button">
<Setter Property="Background" Value="Wheat"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Margin" Value="20"/>
</Style>
<Style x:Key="checkboxStyle" TargetType="CheckBox">
<Setter Property="FontSize" Value="14"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="Green"/>
<Setter Property="FontWeight" Value="Bold"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="checkboxStyle" TargetType="CheckBox">
<Setter Property="FontSize" Value="14"/>
@ -25,7 +35,7 @@
</Style>
</Window.Resources>
<Grid ShowGridLines="True">
<Grid ShowGridLines="True" Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
@ -44,8 +54,8 @@
<CheckBox Style="{StaticResource checkboxStyle}" Margin="10" Content="Я согласен на обработку данных"/>
</StackPanel>
<Button Style="{StaticResource buttonDesicion}" MinHeight="50" MinWidth="50" Margin="20" Grid.Row="3" Grid.Column="1">Принять</Button>
<Button Style="{StaticResource buttonDesicion}" MinHeight="50" MinWidth="50" Margin="20" Grid.Row="3" Grid.Column="2">Отмена</Button>
<Button Style="{StaticResource buttonDesicion}" Background="{StaticResource BrushWheat}" MinHeight="50" MinWidth="50" Grid.Row="3" Grid.Column="1">Принять</Button>
<Button Style="{StaticResource buttonDesicion}" Background="{StaticResource BrushWheat}" MinHeight="50" MinWidth="50" Grid.Row="3" Grid.Column="2">Отмена</Button>
<Label Content="Установка" Grid.Row="0" Grid.Column="0" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
@ -55,7 +65,7 @@
<Run>Путь установки: C:\Users\Ilyas\AppData\Local\hgv</Run>
</Paragraph>
<Paragraph>
<Run>Требуемого места: 148Т </Run>
<Run>Требуемого места: 148Т</Run>
</Paragraph>
</FlowDocument>
</RichTextBox>

View File

@ -16,9 +16,43 @@ namespace WPF
/// </summary>
public partial class MainWindow : Window
{
public ICommand ShowMessageBox { get; set; }
public MainWindow()
{
InitializeComponent();
ShowMessageBox = new RelayCommand(LoginShowBox);
DataContext = this;
}
private void LoginShowBox(object parameter)
{
MessageBox.Show("Вход");
}
}
public class RelayCommand : ICommand
{
private readonly Action<object> _execute;
private readonly Func<object, bool> _canExecute;
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
{
_execute = execute;
_canExecute = canExecute;
}
public bool CanExecute(object parameter)
{
return _canExecute == null || _canExecute(parameter);
}
public void Execute(object parameter)
{
_execute(parameter);
}
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
}
}