瀏覽代碼

修复钟摆阀界面打开报错bug

lixiang 1 年之前
父節點
當前提交
f9e665093f

+ 2 - 2
Venus/Venus_MainPages/Views/LoginView.xaml

@@ -31,7 +31,7 @@
                 <TextBlock Grid.Row="1" Text="Login"                                       FontSize="42" FontFamily="D-DIN" Foreground="#222222" FontWeight="Bold"/>
                 <TextBlock Grid.Row="2" Text="Welcome back! Please login to your account." FontSize="16" FontFamily="D-DIN" Foreground="#999999"/>
                 <TextBlock Grid.Row="3" Text="UserName"                                    FontSize="16" FontFamily="D-DIN" Foreground="#666666"/>
-                <TextBox  x:Name="UserTextBox" Grid.Row="4" Height="40" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center"  FontSize="16" VerticalContentAlignment="Center" Padding="20 0 0 0" Foreground="Gray" Text="admin">
+                <TextBox  x:Name="UserTextBox" Grid.Row="4" Height="40" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center"  FontSize="16" VerticalContentAlignment="Center" Padding="20 0 0 0" Foreground="Gray" Text="admin" KeyDown="UserTextBox_KeyDown">
                     <TextBox.Resources>
                         <VisualBrush x:Key="WaterText" TileMode="None" Opacity="0.3" Stretch="None" AlignmentX="Center" AlignmentY="Center">
                             <VisualBrush.Visual>
@@ -59,7 +59,7 @@
                     </TextBox.Style>
                 </TextBox>
                 <TextBlock Grid.Row="5" Text="Password"                                    FontSize="16" FontFamily="D-DIN" Foreground="#666666"/>
-                <customControls:CustomPasswordBox  x:Name="PassWordTextBox" Grid.Row="6" Height="40" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center"  FontSize="16" VerticalContentAlignment="Center" Padding="20 5 0 0" Foreground="Gray">
+                <customControls:CustomPasswordBox  x:Name="PassWordTextBox" Grid.Row="6" Height="40" Width="400" HorizontalAlignment="Left" VerticalAlignment="Center"  FontSize="16" VerticalContentAlignment="Center" Padding="20 5 0 0" Foreground="Gray" KeyDown="PassWordTextBox_KeyDown">
                     <customControls:CustomPasswordBox.Resources>
                         <VisualBrush x:Key="WaterText" TileMode="None" Opacity="0.3" Stretch="None" AlignmentX="Center" AlignmentY="Center">
                             <VisualBrush.Visual>

+ 22 - 16
Venus/Venus_MainPages/Views/LoginView.xaml.cs

@@ -1,21 +1,7 @@
-using Aitex.Core.Account;
-using MECF.Framework.UI.Core.Accounts;
-using Prism.Ioc;
-using Prism.Regions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System;
 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;
 using Venus_MainPages.Roles;
 using WPF.Themes.UserControls;
 
@@ -41,6 +27,25 @@ namespace Venus_MainPages.Views
         }
         private void Login_Click(object sender, RoutedEventArgs e)
         {
+            Login();
+        }
+
+        private void PassWordTextBox_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Return)
+            {
+                Login();
+            }          
+        }
+        private void UserTextBox_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Return)
+            {
+                PassWordTextBox.Focus();
+            }
+        }
+        private void Login()
+        {
             IsLoginSuccess = true;
             if (UserTextBox.Text != "admin")
             {
@@ -55,7 +60,8 @@ namespace Venus_MainPages.Views
                 return;
             }
             CurrentUser = new User(UserTextBox.Text, PassWordTextBox.Password, (Role)Enum.Parse(typeof(Role), (MangerComboBox.SelectedItem as ComboBoxItem).Content.ToString(), true));
-            this.Close();
+            this.Visibility = Visibility.Hidden;
+            //this.Close();
         }
     }
 }

+ 2 - 2
Venus/Venus_UI/App.xaml.cs

@@ -20,7 +20,7 @@ namespace Venus_UI
     public partial class App : PrismApplication
     {
         System.Threading.Mutex mutex;
-        public static User CurrentUser;
+        public static User CurrentUser=new User ("admin","admin",Role.Manager);
         protected override void OnStartup(StartupEventArgs e)
         {
             bool ret;
@@ -36,7 +36,7 @@ namespace Venus_UI
             Singleton<LogManager>.Instance.Initialize();
 
 
-            ShellView shellView = new ShellView();
+            //ShellView shellView = new ShellView();
 
             LoginView loginView = new LoginView();
             loginView.ShowDialog();

+ 2 - 2
Venus/Venus_UI/Views/ShellView.xaml

@@ -151,10 +151,10 @@
             <RowDefinition Height="50"/>
         </Grid.RowDefinitions>
 
-        <ContentControl x:Name="Top_Frame" Grid.Row="0"  prism:RegionManager.RegionName="TopRegion"/>
+        <ContentControl x:Name="Top_Frame"  Grid.Row="0"  prism:RegionManager.RegionName="TopRegion"/>
 
         <ContentControl x:Name="Main_Frame" Grid.Row="1" prism:RegionManager.RegionName="MainRegion" MouseDoubleClick="Window_MouseDoubleClick"/>
 
-        <StackPanel x:Name="Bottom_Frame" Grid.Row="2" Background="White" Orientation="Horizontal"/>
+        <StackPanel x:Name="Bottom_Frame"   Grid.Row="2" Background="White" Orientation="Horizontal"/>
     </Grid>
 </Window>