Tidak Ada Deskripsi

Капралов Александр Викторович 32556e954b Обновить 'readme.md' 2 bulan lalu
bin 00834c466f lab 2 bulan lalu
img 00834c466f lab 2 bulan lalu
logo 00834c466f lab 2 bulan lalu
obj 00834c466f lab 2 bulan lalu
res 00834c466f lab 2 bulan lalu
App.xaml 00834c466f lab 2 bulan lalu
App.xaml.cs 00834c466f lab 2 bulan lalu
AssemblyInfo.cs 00834c466f lab 2 bulan lalu
MainWindow.xaml 00834c466f lab 2 bulan lalu
MainWindow.xaml.cs 00834c466f lab 2 bulan lalu
mysql_connector2.csproj 00834c466f lab 2 bulan lalu
mysql_connector2.csproj.user 00834c466f lab 2 bulan lalu
readme.md 32556e954b Обновить 'readme.md' 2 bulan lalu

readme.md

Создание подключения к БД MySQL. Получение данных с сервера.

MainWindow.xaml.cs

namespace mysql_connector2
{
    public partial class MainWindow : Window
    {
        public List<Product> productList { get; set; }
        private void ExitButton_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();

        }
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
            Globals.dataProvider = new DBDataProvider();
            productList = (List<Product>)Globals.dataProvider.getProduct();
        }

    }
}

MainWindow.xaml

    <Grid ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition />
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>


        <ListBox 
Grid.Row="1"
Grid.Column="1"
Background="White"
ItemsSource="{Binding productList}" 
            ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="3,3,0,0"  RenderTransformOrigin="0.5,0.5">

            <ListBox.ItemContainerStyle>
                <Style 
            TargetType="ListBoxItem">
                    <Setter 
                Property="HorizontalContentAlignment"
                Value="Stretch" />
                </Style>
            </ListBox.ItemContainerStyle>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border 
        BorderThickness="1" 
        BorderBrush="Black" 
        CornerRadius="5">

                        <Grid 
Margin="10" 
HorizontalAlignment="Stretch">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="64"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>

                            <Image
                            Width="64" 
                            Height="64"
                            Source="{Binding ImageBitmap}" HorizontalAlignment="Center"/>

                            <StackPanel
                            Grid.Column="1"
                            Margin="5"
                            Orientation="Vertical">

                                <TextBlock
                                Text="{Binding Title}"/>
                                <TextBlock
                                Text="{Binding ArticleNumber}"/>
                            </StackPanel>

                            <TextBlock
                            Grid.Column="2"
                        Text="{Binding ProductTypeID}"/>

                        </Grid>

                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>

        <Image 
        Source="/logo/Logo.jpg" 
        Grid.RowSpan="2"/>
        <StackPanel 
        Orientation="Vertical"
        Grid.RowSpan="3"
        VerticalAlignment="Bottom">
            <Button 
            x:Name="ExitButton"
            Content="Выход" 
            Click="ExitButton_Click"
            Height="54"/>
        </StackPanel>

        <WrapPanel
        Orientation="Horizontal"
        Grid.Column="1"
        MinHeight="50">
        </WrapPanel>

    </Grid>
</Window>