This commit is contained in:
xiang 2024-12-22 22:23:05 +08:00
parent b63d2b668f
commit 29830df36c
5 changed files with 48 additions and 21 deletions

14
Models/MainWindowModel.cs Normal file
View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VideoConcat.Models
{
internal class MainWindowModel
{
public string? UserName { get; set; }
public string? PassWord { get; set; }
}
}

View File

@ -28,9 +28,4 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
<Folder Include="ViewModels\" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VideoConcat.Models;
namespace VideoConcat.ViewModels
{
internal class MainWindowViewModel
{
public MainWindowModel MainWindowsModel { get; set; } = new MainWindowModel();
public void Login()
{
string userName = MainWindowsModel.UserName;
string passWord = MainWindowsModel.PassWord;
}
}
}

View File

@ -1,4 +1,4 @@
<Window x:Class="VideoConcat.MainWindow" <Window x:Class="VideoConcat.Views.MainWindow"
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:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -33,7 +33,7 @@
<materialDesign:PackIcon <materialDesign:PackIcon
Width="30" Height="30" Width="30" Height="30"
Kind="User" Margin="10,0,10,0"/> Kind="User" Margin="10,0,10,0"/>
<TextBox x:Name="txtUserName" Width="400" <TextBox Text="{Binding MainWindowModel.UserName}" Width="400"
Margin="10,0" BorderBrush="White" Margin="10,0" BorderBrush="White"
CaretBrush="#FFD94448" CaretBrush="#FFD94448"
SelectionBrush="#FFD94448" SelectionBrush="#FFD94448"
@ -43,17 +43,20 @@
<materialDesign:PackIcon <materialDesign:PackIcon
Width="30" Height="30" Width="30" Height="30"
Kind="Lock" Margin="10,0,10,0"/> Kind="Lock" Margin="10,0,10,0"/>
<PasswordBox x:Name="txtPassword" Width="400" <PasswordBox
Width="400"
Margin="10,0" BorderBrush="White" Margin="10,0" BorderBrush="White"
CaretBrush="#FFD94448" CaretBrush="#FFD94448"
SelectionBrush="#FFD94448" SelectionBrush="#FFD94448"
materialDesign:HintAssist.Hint="输入 密码" materialDesign:HintAssist.Hint="输入 密码"
/> local:MainWindowModel="{Binding MainWindowModel.Password}"
>
</PasswordBox>
</StackPanel> </StackPanel>
<StackPanel Margin="10" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Margin="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="btnLogin" Width="100" Height="40" <Button x:Name="btnLogin" Width="100" Height="40"
materialDesign:ButtonAssist.CornerRadius="10" materialDesign:ButtonAssist.CornerRadius="5"
Background="#D94448" BorderBrush="#D94448" BorderThickness="2" Background="#40568D" BorderBrush="#7F7F7F" BorderThickness="2"
Content="登录" ToolTip="登录" Content="登录" ToolTip="登录"
Style="{StaticResource MaterialDesignRaisedButton}" Click="BtnLogin_Click"/> Style="{StaticResource MaterialDesignRaisedButton}" Click="BtnLogin_Click"/>
</StackPanel> </StackPanel>

View File

@ -1,7 +1,8 @@
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using VideoConcat.Models;
namespace VideoConcat namespace VideoConcat.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for MainWindow.xaml /// Interaction logic for MainWindow.xaml
@ -11,6 +12,7 @@ namespace VideoConcat
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = new MainWindowModel();
} }
private void BtnExit_Click(object sender, RoutedEventArgs e) private void BtnExit_Click(object sender, RoutedEventArgs e)
@ -18,14 +20,6 @@ namespace VideoConcat
this.Close(); this.Close();
} }
private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
{
if (Mouse.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
}
private void BtnLogin_Click(object sender, RoutedEventArgs e) private void BtnLogin_Click(object sender, RoutedEventArgs e)
{ {
} }