Imagara 3 年之前
父节点
当前提交
57665bb93b
共有 3 个文件被更改,包括 82 次插入80 次删除
  1. 2 0
      Kusach/Functions.cs
  2. 31 25
      Kusach/Windows/LogWindow.xaml
  3. 49 55
      Kusach/Windows/RegWindow.xaml

+ 2 - 0
Kusach/Functions.cs

@@ -15,6 +15,8 @@ namespace Kusach
             foreach (char c in phoneNumber)
                 if (!char.IsDigit(c))
                     return false;
+            if (phoneNumber.Length != 10)
+                return false;
             return true;
         }
         // Валидация электронной почты

+ 31 - 25
Kusach/Windows/LogWindow.xaml

@@ -11,53 +11,59 @@
         Height="350" Width="600" 
         WindowStartupLocation="CenterScreen">
     <Grid>
-        <Label 
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition Height="99"/>
+        </Grid.RowDefinitions>
+        <StackPanel
+            Grid.Row="0"
+            Orientation="Vertical"
+            VerticalAlignment="Center"
+            HorizontalAlignment="Center">
+            <Label 
             Content="Логин:" 
             HorizontalAlignment="Left" 
-            Margin="180,45,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             Name="logbox" 
             HorizontalAlignment="Left" 
-            Margin="179,85,0,0" 
             TextWrapping="Wrap" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Label 
+            <Label 
             Content="Пароль:" 
             HorizontalAlignment="Left" 
-            Margin="180,125,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <PasswordBox 
+            <PasswordBox 
             Name="passbox" 
             HorizontalAlignment="Left" 
-            Margin="179,165,0,0"
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Button 
-            x:Name="LogButton" 
-            Content="Вход" 
-            HorizontalAlignment="Left" 
-            Margin="324,228,0,0" 
-            VerticalAlignment="Top" 
-            Width="150" 
-            Click="LogButton_Click" 
-            IsDefault="True"
-            Height="40"/>
-        <Button 
+        </StackPanel>
+        <StackPanel
+            Orientation="Horizontal"
+            Grid.Row="1"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Center">
+            <Button 
             x:Name="RegButton" 
-            Content="Регистрация" 
-            HorizontalAlignment="Left"
-            Margin="123,228,0,0" 
-            VerticalAlignment="Top" 
+            Content="Регистрация"
+            Height="40" 
+            Width="150" 
+            Margin="0,0,30,0"
+            Click="RegButton_Click"/>
+            <Button 
+            x:Name="LogButton" 
+            Content="Вход"
+            Height="40" 
             Width="150" 
-            Click="RegButton_Click" 
-            Height="40"/>
+            Click="LogButton_Click"/>
+        </StackPanel>
     </Grid>
 </Window>

+ 49 - 55
Kusach/Windows/RegWindow.xaml

@@ -6,140 +6,134 @@
         xmlns:local="clr-namespace:Kusach"
         mc:Ignorable="d"
         ResizeMode="NoResize"
-        Title="Окно регистрации" Height="803.5" Width="600" WindowStartupLocation="CenterScreen">
+        Title="Окно регистрации" Height="800" Width="600" WindowStartupLocation="CenterScreen">
     <Grid>
-        <Label 
+        <Grid.RowDefinitions>
+            <RowDefinition Height="27*"/>
+            <RowDefinition Height="4*"/>
+        </Grid.RowDefinitions>
+        <StackPanel
+            Grid.Row="0"
+            Orientation="Vertical"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Center">
+            <Label
             Content="Логин:" 
             HorizontalAlignment="Left" 
-            Margin="143,35,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             x:Name="logbox" 
-            HorizontalAlignment="Left" 
-            Margin="142,75,0,0" 
+            HorizontalAlignment="Left"  
             TextWrapping="Wrap" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"
-            Text="{Binding Login}"/>
-        <Label 
+            Width="240"/>
+            <Label 
             Content="Пароль:" 
             HorizontalAlignment="Left" 
-            Margin="143,115,0,0"
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             x:Name="passbox" 
             HorizontalAlignment="Left" 
-            Margin="142,155,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Button 
-            x:Name="RegButton" 
-            Content="Регистрация" 
-            HorizontalAlignment="Left"
-            Margin="298,715,0,0" 
-            VerticalAlignment="Top" 
-            Height="40" 
-            Width="150" 
-            Click="RegButton_Click"/>
-        <Button 
-            x:Name="BackButton" 
-            Content="Назад" 
-            HorizontalAlignment="Left" 
-            Margin="121,715,0,0" 
-            VerticalAlignment="Top" 
-            Height="40" 
-            Width="150" 
-            Click="BackButton_Click"/>
-        <Label 
+            <Label 
             Content="Имя:" 
             HorizontalAlignment="Left" 
-            Margin="143,195,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             x:Name="FNameBox" 
-            HorizontalAlignment="Left" 
-            Margin="142,235,0,0" 
+            HorizontalAlignment="Left"  
             TextWrapping="Wrap" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Label 
+            <Label 
             Content="Фамилия:" 
             HorizontalAlignment="Left" 
-            Margin="143,275,0,0"
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             x:Name="LNameBox" 
             HorizontalAlignment="Left" 
-            Margin="142,315,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Label 
+            <Label 
             Content="Отчество:" 
             HorizontalAlignment="Left" 
-            Margin="143,356,0,0"
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             x:Name="MNameBox" 
             HorizontalAlignment="Left" 
-            Margin="142,396,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Label 
+            <Label 
             Content="День рождения:" 
             HorizontalAlignment="Left" 
-            Margin="144,436,0,0"
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <DatePicker
             x:Name="BirthdayBox" 
             HorizontalAlignment="Left" 
-            Margin="143,476,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Label 
+            <Label 
             Content="Телефон:" 
             HorizontalAlignment="Left" 
-            Margin="143,516,0,0"
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             x:Name="PhoneBox" 
             HorizontalAlignment="Left" 
-            Margin="142,556,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <Label 
+            <Label 
             Content="Email:" 
             HorizontalAlignment="Left" 
-            Margin="143,596,0,0"
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
-        <TextBox 
+            <TextBox 
             x:Name="EmailBox" 
             HorizontalAlignment="Left" 
-            Margin="142,636,0,0" 
             VerticalAlignment="Top" 
             Height="40" 
             Width="240"/>
+        </StackPanel>
+        <StackPanel
+            Grid.Row="1"
+            Orientation="Horizontal"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Center">
+            <Button 
+            x:Name="BackButton" 
+            Content="Назад"
+            Margin="0,0,30,0"
+            Height="40" 
+            Width="150" 
+            Click="BackButton_Click"/>
+            <Button 
+            x:Name="RegButton" 
+            Content="Регистрация"
+            Height="40" 
+            Width="150" 
+            Click="RegButton_Click"/>
+        </StackPanel>
     </Grid>
 </Window>