Артем Гавриленко před 3 roky
rodič
revize
c6206f49cb

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 3 - 1
Kusach/App.config


+ 1 - 1
Kusach/App.xaml

@@ -2,7 +2,7 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:local="clr-namespace:Kusach"
              xmlns:local="clr-namespace:Kusach"
-             StartupUri="LogWindow.xaml">
+             StartupUri="TestWindow.xaml">
     <Application.Resources>
     <Application.Resources>
          
          
     </Application.Resources>
     </Application.Resources>

+ 14 - 0
Kusach/Kusach.csproj

@@ -132,6 +132,12 @@
     <Compile Include="Routes.cs">
     <Compile Include="Routes.cs">
       <DependentUpon>EDM.tt</DependentUpon>
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="TestRouteEditWindow.xaml.cs">
+      <DependentUpon>TestRouteEditWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="TestWindow.xaml.cs">
+      <DependentUpon>TestWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Transport.cs">
     <Compile Include="Transport.cs">
       <DependentUpon>EDM.tt</DependentUpon>
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
     </Compile>
@@ -175,6 +181,14 @@
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
     </Page>
     </Page>
+    <Page Include="TestRouteEditWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="TestWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs">
     <Compile Include="Properties\AssemblyInfo.cs">

+ 57 - 0
Kusach/TestRouteEditWindow.xaml

@@ -0,0 +1,57 @@
+<Window x:Class="Kusach.TestRouteEditWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        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:local="clr-namespace:Kusach"
+        mc:Ignorable="d"
+        Title="TestRouteEditWindow" Height="450" Width="800">
+    <Grid>
+        <Button
+            Content="Button" 
+            HorizontalAlignment="Left" 
+            Margin="10,10,0,0" 
+            VerticalAlignment="Top" 
+            Width="91" 
+            Height="50" Click="Button_Click"/>
+        <TextBox
+            Name="RouteNameBox"
+            Height="50"
+            Margin="129,10,548,359"
+            Text="Маршрут: #0"
+            />
+
+        <DataGrid 
+            Name="PointsListDataGrid" 
+            AutoGenerateColumns="False" 
+            Height="344" 
+            VerticalAlignment="Top" 
+            HorizontalAlignment="Center" 
+            Width="772" Margin="10,65,10,0">
+            <DataGrid.ItemContainerStyle>
+                <Style TargetType="DataGridRow">
+                    <EventSetter 
+                        Event="MouseDoubleClick" 
+                        Handler="DataGridRow_MouseDoubleClick"/>
+                </Style>
+            </DataGrid.ItemContainerStyle>
+            <DataGrid.Columns>
+                <DataGridTextColumn 
+                    Binding="{Binding Points.IdPoint}" 
+                    Header="IdPoint"  
+                    Width="100" 
+                    IsReadOnly="True"/>
+                <DataGridTextColumn 
+                    Binding="{Binding Points.Name}" 
+                    Header="Name" 
+                    Width="100" 
+                    IsReadOnly="True"/>
+                <DataGridTextColumn 
+                    Binding="{Binding Points.location}" 
+                    Header="location" 
+                    Width="100"
+                    IsReadOnly="True"/>
+            </DataGrid.Columns>
+        </DataGrid>
+    </Grid>
+</Window>

+ 43 - 0
Kusach/TestRouteEditWindow.xaml.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для TestRouteEditWindow.xaml
+    /// </summary>
+    public partial class TestRouteEditWindow : Window
+    {
+        Routes route;
+        public TestRouteEditWindow(int id)
+        {
+            InitializeComponent();
+            RouteNameBox.Text = cnt.db.Routes.Where(item => item.IdRoute == id).Select(item => item.Name).FirstOrDefault();
+            
+            
+            PointsListDataGrid.ItemsSource = cnt.db.PointsList.Where(item => item.IdRoute == id).ToList();
+        }
+        private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+        {
+            MessageBox.Show("cell: " + ((PointsList)PointsListDataGrid.SelectedItem).IdPoint);
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            TestWindow tw = new TestWindow();
+            tw.Show();
+            this.Close();
+        }
+    }
+}

+ 64 - 0
Kusach/TestWindow.xaml

@@ -0,0 +1,64 @@
+<Window x:Class="Kusach.TestWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        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:local="clr-namespace:Kusach"
+        mc:Ignorable="d"
+        Title="TestWindow" Height="450" Width="800">
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="137*"/>
+            <ColumnDefinition Width="655*"/>
+        </Grid.ColumnDefinitions>
+        <Grid Grid.Column="0">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="189*"/>
+                <RowDefinition Height="230*"/>
+            </Grid.RowDefinitions>
+            <TextBox
+                Name="SearchBox"
+                Grid.Row="0"
+                Text="">
+            </TextBox>
+            <Button
+                Content="Найти"
+                Grid.Row="1" 
+                Click="Find_Click">
+            </Button>
+        </Grid>
+        <DataGrid 
+            Name="RoutesList" 
+            Grid.Column="1"
+            AutoGenerateColumns="False" 
+            Height="419" 
+            VerticalAlignment="Top" 
+            HorizontalAlignment="Center" 
+            Width="655" Grid.RowSpan="2">
+            <DataGrid.ItemContainerStyle>
+                <Style TargetType="DataGridRow">
+                    <EventSetter 
+                        Event="MouseDoubleClick" 
+                        Handler="DataGridRow_MouseDoubleClick"/>
+                </Style>
+            </DataGrid.ItemContainerStyle>
+            <DataGrid.Columns>
+                <DataGridTextColumn 
+                    Binding="{Binding IdRoute}" 
+                    Header="IdRoute"  
+                    Width="100" 
+                    IsReadOnly="True"/>
+                <DataGridTextColumn 
+                    Binding="{Binding IdDriver}" 
+                    Header="IdDriver" 
+                    Width="100" 
+                    IsReadOnly="True"/>
+                <DataGridTextColumn 
+                    Binding="{Binding Name}" 
+                    Header="Name" 
+                    Width="100"
+                    IsReadOnly="True"/>
+            </DataGrid.Columns>
+        </DataGrid>
+    </Grid>
+</Window>

+ 43 - 0
Kusach/TestWindow.xaml.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Kusach
+{
+    /// <summary>
+    /// Логика взаимодействия для TestWindow.xaml
+    /// </summary>
+    public partial class TestWindow : Window
+    {
+        public TestWindow()
+        {
+            InitializeComponent();
+            RoutesList.ItemsSource = cnt.db.Routes.ToList();
+        }
+
+        private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+        {
+            TestRouteEditWindow trew = new TestRouteEditWindow(((Routes)RoutesList.SelectedItem).IdRoute);
+            trew.Show();
+            this.Close();
+        }
+
+        private void Find_Click(object sender, RoutedEventArgs e)
+        {
+            if(SearchBox.Text != "")
+                RoutesList.ItemsSource = cnt.db.Routes.Where(item => (item.IdRoute + " " + item.IdDriver + " " + item.Name).Contains(SearchBox.Text)).ToList();
+            else
+                RoutesList.ItemsSource = cnt.db.Routes.ToList();
+        }
+    }
+}