Imagara 2 年之前
父節點
當前提交
7586d46aa4

+ 1 - 1
RaspisKusach/MainWindow.xaml

@@ -8,7 +8,7 @@
         Title="Расписание"
         WindowStartupLocation="CenterScreen"
         WindowStyle="None"
-        ResizeMode="NoResize"
+        ResizeMode="CanResize"
         Height="450" 
         Width="800">
     <Grid>

+ 5 - 1
RaspisKusach/Pages/AdministrationPage.xaml

@@ -26,8 +26,12 @@
             
             <Button Width="120"
                     Height="40"
-                    Content="Маршруты"
+                    
                     Margin="10,0,10,0">
+                <StackPanel Orientation="Horizontal">
+                    <Image Width="15" Height="15" Source="/RaspisKusach;component/Resources/Train.png"></Image>
+                    <Label>Маршруты</Label>
+                </StackPanel>
             </Button>
             
             <Button Width="120"

+ 3 - 6
RaspisKusach/Pages/LoginPage.xaml

@@ -35,24 +35,21 @@
                         VerticalAlignment="Center"
                         HorizontalAlignment="Center">
                     <Label Content="Логин:" 
-                       Foreground="{StaticResource TextColor}"
+                       HorizontalContentAlignment="Left"
                        Height="40" 
                        Width="240"
                        FontSize="20"/>
                     <TextBox Name="LogBox" 
-                             Foreground="{StaticResource TextColor}"
-                             TextWrapping="Wrap" 
-                             VerticalAlignment="Top" 
+                             TextWrapping="Wrap"
                              Height="40" 
                              Width="240"
                              FontSize="20"/>
                     <Label Content="Пароль:"
-                           Foreground="{StaticResource TextColor}"
+                           HorizontalContentAlignment="Left"
                            Height="40" 
                            Width="240"
                            FontSize="20"/>
                     <PasswordBox Name="PassBox"
-                                 Foreground="{StaticResource TextColor}"
                                  Height="40" 
                                  Width="240"
                                  FontSize="20"/>

+ 2 - 5
RaspisKusach/Pages/RegisterPage.xaml

@@ -35,24 +35,21 @@
                         VerticalAlignment="Center"
                         HorizontalAlignment="Center">
                     <Label Content="Логин:" 
-                       Foreground="{StaticResource TextColor}"
+                       HorizontalContentAlignment="Left"
                        Height="40" 
                        Width="240"
                        FontSize="20"/>
                     <TextBox Name="LogBox" 
-                             Foreground="{StaticResource TextColor}"
                              TextWrapping="Wrap" 
-                             VerticalAlignment="Top" 
                              Height="40" 
                              Width="240"
                              FontSize="20"/>
                     <Label Content="Пароль:"
-                           Foreground="{StaticResource TextColor}"
+                           HorizontalContentAlignment="Left"
                            Height="40" 
                            Width="240"
                            FontSize="20"/>
                     <PasswordBox Name="PassBox"
-                                 Foreground="{StaticResource TextColor}"
                                  Height="40" 
                                  Width="240"
                                  FontSize="20"/>

+ 71 - 1
RaspisKusach/Pages/SchedulePage.xaml

@@ -9,6 +9,76 @@
       Title="SchedulePage">
 
     <Grid>
-        
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"/>
+            <RowDefinition Height="40"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Label Name="TimeNowLabel"
+               FontSize="20"
+               Content="Текущее время">
+        </Label>
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="0.6*"/>
+                <ColumnDefinition/>
+                <ColumnDefinition/>
+                <ColumnDefinition/>
+            </Grid.ColumnDefinitions>
+
+            <Label Grid.Column="0"
+                   FontSize="14"
+                   Content="№Рейса"/>
+            <Label Grid.Column="1"
+                   FontSize="14"
+                   Content="Направление"/>
+            <Label Grid.Column="2"
+                   FontSize="14"
+                   Content="Время прибытия"/>
+            <Label Grid.Column="3"
+                   FontSize="14"
+                   Content="Время отправления"/>
+        </Grid>
+
+        <ListBox Name="TripsListBox"
+                 Grid.Row="2"
+                 Margin="10,0,10,0"
+                 Background="White"
+                 BorderBrush="{x:Null}"
+                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                 ScrollViewer.VerticalScrollBarVisibility="Hidden">
+            <ScrollBar></ScrollBar>
+            <ListBox.ItemTemplate>
+                <DataTemplate>
+                    <Border Width="{Binding Path=ActualWidth, ElementName=TripsListBox}"
+                            Height="70"
+                            CornerRadius="15"
+                            Background="{StaticResource Color2}">
+                        <Grid>
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="0.53*"/>
+                                <ColumnDefinition/>
+                                <ColumnDefinition/>
+                                <ColumnDefinition/>
+                            </Grid.ColumnDefinitions>
+                            
+                            <Label Grid.Column="0"
+                                   FontSize="14"
+                                   Content="{Binding Trip.Routes.Name}"/>
+                            <Label Grid.Column="1"
+                                   FontSize="14"
+                                   Content="{Binding StationDirection}"/>
+                            <Label Grid.Column="2"
+                                   FontSize="14"
+                                   Content="{Binding TimeArrival}"/>
+                            <Label Grid.Column="3"
+                                   FontSize="14"
+                                   Content="{Binding TimeDeparture}"/>
+                        </Grid>
+                    </Border>
+                </DataTemplate>
+            </ListBox.ItemTemplate>
+        </ListBox>
+
     </Grid>
 </Page>

+ 52 - 3
RaspisKusach/Pages/SchedulePage.xaml.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
@@ -15,14 +16,62 @@ using System.Windows.Shapes;
 
 namespace RaspisKusach.Pages
 {
-    /// <summary>
-    /// Логика взаимодействия для SchedulePage.xaml
-    /// </summary>
     public partial class SchedulePage : Page
     {
         public SchedulePage()
         {
             InitializeComponent();
+            TripsListBox.Items.Clear(); // temp
+            Thread th = new Thread(ThreadUpdate);
+            th.Start();
+        }
+        public void ThreadUpdate()
+        {
+            while (true)
+            {
+                this.Dispatcher.BeginInvoke(new Action(() =>
+                {
+                    TimeUpdate();
+                    TripsUpdate();
+                }));
+                Thread.Sleep(1000);
+            }
+        }
+        void TimeUpdate()
+        {
+            TimeNowLabel.Content = DateTime.Now.ToString(new System.Globalization.CultureInfo("ru-RU"));
+        }
+        void TripsUpdate()
+        {
+
+            List<TripClass> routeList = new List<TripClass>();
+
+            foreach (Trips trip in cnt.db.Trips)
+            {
+                TripClass rt = new TripClass();
+                rt.Trip = trip;
+                rt.StationDirection = "direction";
+
+                //rt.timeArrival = cnt.db.RoutesStations.
+                //    Where(item => item.IdRoute == trip.Routes.IdRoute && item.Station.Location == StationArrivalComboBox.Text).
+                //    Select(item => item.DateTime).FirstOrDefault();
+                //rt.timeDeparture = cnt.db.RoutesStations.
+                //    Where(item => item.IdRoute == trip.Routes.IdRoute && item.Station.Location == StationDepartureComboBox.Text).
+                //    Select(item => item.DateTime).FirstOrDefault();
+                //rt.timeBetween = rt.timeDeparture - rt.timeArrival;
+
+                routeList.Add(rt);
+            }
+
+            TripsListBox.ItemsSource = routeList;
+
+        }
+        public class TripClass
+        {
+            public Trips Trip { get; set; }
+            public string StationDirection { get; set; }
+            public DateTime TimeDeparture { get; set; }
+            public DateTime TimeArrival { get; set; }
         }
     }
 }

+ 14 - 0
RaspisKusach/Pages/TripInfoPage.xaml

@@ -0,0 +1,14 @@
+<Page x:Class="RaspisKusach.Pages.TripInfoPage"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:RaspisKusach.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="TripInfoPage">
+
+    <Grid>
+        
+    </Grid>
+</Page>

+ 28 - 0
RaspisKusach/Pages/TripInfoPage.xaml.cs

@@ -0,0 +1,28 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace RaspisKusach.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для TripInfoPage.xaml
+    /// </summary>
+    public partial class TripInfoPage : Page
+    {
+        public TripInfoPage()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 7 - 0
RaspisKusach/RaspisKusach.csproj

@@ -109,6 +109,9 @@
     <Compile Include="Pages\SearchForTicketsPage.xaml.cs">
       <DependentUpon>SearchForTicketsPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\TripInfoPage.xaml.cs">
+      <DependentUpon>TripInfoPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Routes.cs">
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
@@ -179,6 +182,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\TripInfoPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\Style.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 2 - 1
RaspisKusach/Styles/Style.xaml

@@ -35,9 +35,10 @@
         <Setter Property="Background" Value="White"/>
     </Style>
 
-    <Style x:Key="TextCenter" TargetType="Label">
+    <Style TargetType="Label">
         <Setter Property="HorizontalContentAlignment" Value="Center"/>
         <Setter Property="VerticalContentAlignment" Value="Center"/>
+        <Setter Property="Foreground" Value="Black"/>
     </Style>
 
     <Style TargetType="Button">