add-成品下线添加登录

main
liuwf 10 months ago
parent 22192b3ae9
commit 945d4eb807

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
26d6a9afb39c72117143a7eab0e8e5f7fb39f4a77dbea43fa75b3f2eafedfc9a
3c08b2a6f95957043123cba0d01dcd1675663fc7

@ -8,6 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Common
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Common\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.Common\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
f767de055f10a2c1e934fea6ee70f0611af5d29269e2db5801139a65e7e1ca7e
2af60005099f8dd0481f84ac0dfadb89cc4b6f1d

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.EventBus
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.EventBus\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.EventBus\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
1feccce0683e2531dc528f983ed4e425860f374c97d448334f2adea8191e58a6
790ffd47e6e46a3c8a83558ad3550154a5c81377

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Extensions
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.Extensions\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.Extensions\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b568e28193918582fd92ee1c0a62c0df9dd31679")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
7b1384c62bbab128c20dd65978d1c78fee190609613d3d271a0288f0b54de02a
7d60a94dd38c10522cbfe4a021ccb6e9c5da0354

@ -1,5 +1,3 @@
is_global = true
build_property.RootNamespace = Admin.Core.FrameWork
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.FrameWork\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.FrameWork\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
2ea4137f3e01fa73a652c473c344bfb7cb531dd6aba8f60afe9e70227846f2e0
80bb097f76aa594dc58289065a284d1acbd8bdff

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.IRepository
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.IRepository\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.IRepository\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
aefdf16c8cd5c88c9a3d622ce93aae825904bc76f06885ee1d291a51e95687da
51b8351ca3dc5fa8344fbf501d63c1eff37c8f9c

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.IService
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.IService\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.IService\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
416b6b9f193a7519f5a2a285ba6591dd8ab4d0b86d17c3902da37833779391a8
ef9752cf3f9e33d53832c154eeba975830dced91

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Model
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.Model\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.Model\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
8d424b8a3cc0af50a0e8a1a8273fddf2d364a5fb1bc4a328593ea8371a25426a
0868e6bde5b49a65a126b91d794e990427a11761

@ -8,6 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.RealTimeService
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.RealTimeService\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.RealTimeService\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
2db50a9279905049b7790b56feaa6ed638d4ba55223933d35f76b6d3dac4337c
046606c52f7e20e88e6dd5ffc01e33664c4b9ff8

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Repository
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.Repository\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.Repository\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
6a5664407711d594dee0bca82f7341b63f383b77025211b182f8b3160c886c81
dbec6c73777a8ebf7006f00f1928199755951ac1

@ -8,6 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Serilog.Es
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Serilog.Es\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.Serilog.Es\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
090e6de5d1313c3398be84182724b27024a5f9bef27979c09e017e70e7e74dc3
ff8a17c10bdbb7dcf5bd28c26639be5ea4bbf542

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Service
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.Service\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.Service\

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d3a41870c9cef865dddcbfb78c39605e8506652f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
f24d48b4b79ca532e24ee245999d6c746607b481373dad175c589d127da38ff1
da4240456d30e56fa6c5e71babf5565adb3e1436

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Tasks
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\new\Admin.Core.Tasks\
build_property.ProjectDir = E:\c#\AUCMA\最新代码整合\登录版\new\Admin.Core.Tasks\

@ -26,9 +26,26 @@ namespace Aucma.Core.PrintTo
var host = CreateHostBuilder(e.Args).Build();//生成宿主。
ServiceProvider = host.Services;
host.Services.GetRequiredService<MainWindow>()?.Show();
await host.StartAsync();
try
{
var loginWindow = host.Services.GetRequiredService<LoginPageView>();
if (loginWindow != null && !loginWindow.IsActive)
{
loginWindow.Show();
await host.StartAsync();
}
else
{
// 处理窗口已关闭的情况
// 可以选择重新创建主窗口或者退出应用程序
Application.Current.Shutdown();
}
}
catch (Exception ex)
{
Application.Current.Shutdown();
}
}
/// <summary>

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.PrintTo.Common
{
public class OSKHelper
{
#region 打开软盘
/// <summary>
/// 打开软盘
/// </summary>
public static void OpenOsk()
{
try
{
Process proc = new Process();
proc.StartInfo.FileName = @"C:\Windows\System32\osk.exe";
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.Verb = "runas";
proc.Start();
}
catch
{
}
}
#endregion
#region 关闭软盘
/// <summary>
/// 关闭软盘
/// </summary>
public static void CloseOsk()
{
try
{
// 查找并关闭 osk.exe 进程
foreach (Process proc in Process.GetProcessesByName("osk"))
{
proc.Kill();
}
}
catch
{
// 可以在这里处理异常情况
}
}
#endregion
}
}

@ -27,7 +27,7 @@ namespace Aucma.Core.ProductOffLine.Config
}
/// <summary>
/// 条码系统账号
/// 班组代码
/// </summary>
public string TeamCode
{
@ -36,7 +36,7 @@ namespace Aucma.Core.ProductOffLine.Config
}
/// <summary>
/// 产线编号
/// 班组名称
/// </summary>
public string TeamName
{
@ -45,7 +45,7 @@ namespace Aucma.Core.ProductOffLine.Config
}
/// <summary>
/// 当前登录班组
/// 用户名
/// </summary>
public string Account
{

@ -65,10 +65,12 @@ namespace Aucma.Core.PrintTo.ViewModels
appConfig.Account = userName;
//跳转
var window = parameter as LoginPageView;
if (window == null) return;
window.Hide();
MainWindow indexPage = new MainWindow();
indexPage.Show();
window.Close();
}
else

@ -120,25 +120,10 @@ namespace Aucma.Core.PrintTo.ViewModels
string controlType = obj as string;
switch (controlType)
{
// 关闭当前窗口
case "Exit":
if (System.Windows.MessageBox.Show("确定要退出系统吗?", "系统提醒", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
appConfig.TeamCode ="";
appConfig.TeamName = "";
appConfig.Account = "";
Application.Current.MainWindow.Close();
//跳转到登录页
LoginPageView login=new LoginPageView();
login.ShowDialog();
//Application.Current.Shutdown();
//Environment.Exit(0);
}
break;
// 打开软盘
case "TabTip":
CommHelper.OpenOsk();
OSKHelper.OpenOsk();
break;
// 还原 或者 最大化当前窗口
case "Normal":

@ -18,7 +18,7 @@ namespace Aucma.Core.PrintTo.Views
private void queryParam_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
CommHelper.OpenOsk();
OSKHelper.OpenOsk();
}
}
}

@ -46,10 +46,12 @@
x:Name="txtUserName"
Width="300"
FontSize="18"
materialDesign:HintAssist.Hint="账号"
materialDesign:HintAssist.Hint="用户名"
BorderThickness="1"
BorderBrush="{StaticResource MaterialDesignDivider}"
Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
Style="{StaticResource MaterialDesignOutlinedTextBox}"
GotFocus="TextBox_GotFocus"
LostFocus="TextBox_LostFocus"/>
<PasswordBox
Margin="0 10 0 0"
x:Name="txtPassword"
@ -58,7 +60,9 @@
materialDesign:HintAssist.Hint="密码"
BorderThickness="1"
BorderBrush="{StaticResource MaterialDesignDivider}"
Style="{StaticResource MaterialDesignOutlinedPasswordBox}"/>
Style="{StaticResource MaterialDesignOutlinedPasswordBox}"
GotFocus="TextBox_GotFocus"
LostFocus="TextBox_LostFocus"/>
<Button Margin="0 20 0 0"
x:Name="loginBtn"
Style="{StaticResource MaterialDesignFlatMidBgButton}"

@ -1,4 +1,5 @@
using Admin.Core.Model.Model_New;
using Aucma.Core.PrintTo.Common;
using Aucma.Core.PrintTo.ViewModels;
using System;
using System.Collections.Generic;
@ -53,5 +54,19 @@ namespace Aucma.Core.PrintTo.Views
loginViewModel.Login(teamMembers,userName, passWord,this);
}
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
// 弹出系统键盘
OSKHelper.OpenOsk();
}
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
{
// 隐藏系统键盘
OSKHelper.CloseOsk();
}
}
}

@ -1,5 +1,6 @@
using Aucma.Core.PrintTo.ViewModels;
using Aucma.Core.ProductOffLine.Config;
using System;
using System.Windows;
namespace Aucma.Core.PrintTo.Views
@ -12,10 +13,42 @@ namespace Aucma.Core.PrintTo.Views
private AppConfig appConfig = AppConfig.Instance;
public MainWindow()
{
InitializeComponent();
LoginInit();
this.DataContext = new MainWindowViewModel();
try
{
bool loginResult = LoginInit();
if (loginResult)
{
MainWindow_Loaded();
}
else
{
this.Hide(); // 登录校验失败,关闭主窗体
LoginPageView indexPage = new LoginPageView();
indexPage.ShowDialog();
this.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private void MainWindow_Loaded()
{
try
{
// 主窗体加载完成后执行其他逻辑
InitializeComponent();
this.DataContext = new MainWindowViewModel();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
}
#region 登录验证
@ -25,8 +58,7 @@ namespace Aucma.Core.PrintTo.Views
if (string.IsNullOrWhiteSpace(appConfig.Account))
{
// this.Hide();
LoginPageView indexPage = new LoginPageView();
indexPage.ShowDialog();
//this.Close();
return false;
}

@ -29,7 +29,7 @@ namespace Aucma.Core.PrintTo.Views
private void TextBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
CommHelper.OpenOsk();
OSKHelper.OpenOsk();
}
}
}

@ -33,7 +33,7 @@ namespace Aucma.Core.PrintTo.Views
private void queryParam_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
CommHelper.OpenOsk();
OSKHelper.OpenOsk();
}
}
}

@ -25,8 +25,26 @@ namespace Aucma.Core.ProductOffLine
var host = CreateHostBuilder(e.Args).Build();//生成宿主。
ServiceProvider = host.Services;
host.Services.GetRequiredService<MainWindow>()?.Show();
await host.StartAsync();
try
{
var loginWindow = host.Services.GetRequiredService<LoginPageView>();
if (loginWindow != null && !loginWindow.IsActive)
{
loginWindow.Show();
await host.StartAsync();
}
else
{
// 处理窗口已关闭的情况
// 可以选择重新创建主窗口或者退出应用程序
Application.Current.Shutdown();
}
}
catch (Exception ex)
{
Application.Current.Shutdown();
}
}
/// <summary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

@ -29,6 +29,7 @@
<None Remove="Assets\Images\background.jpg" />
<None Remove="Assets\Images\Green.png" />
<None Remove="Assets\Images\Icon.png" />
<None Remove="Assets\Images\login-background.png" />
<None Remove="Assets\Images\logo.png" />
<None Remove="Assets\Images\Newlog.png" />
<None Remove="Assets\Images\Red.png" />
@ -55,6 +56,9 @@
<ItemGroup>
<Resource Include="Assets\Images\background.jpg" />
<Resource Include="Assets\Images\Icon.png" />
<Resource Include="Assets\Images\login-background.png">
<CopyToOutputDirectory></CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\Newlog.png" />
</ItemGroup>

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.ProductOffLine.Common
{
public class OSKHelper
{
#region 打开软盘
/// <summary>
/// 打开软盘
/// </summary>
public static void OpenOsk()
{
try
{
Process proc = new Process();
proc.StartInfo.FileName = @"C:\Windows\System32\osk.exe";
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.Verb = "runas";
proc.Start();
}
catch
{
}
}
#endregion
#region 关闭软盘
/// <summary>
/// 关闭软盘
/// </summary>
public static void CloseOsk()
{
try
{
// 查找并关闭 osk.exe 进程
foreach (Process proc in Process.GetProcessesByName("osk"))
{
proc.Kill();
}
}
catch
{
// 可以在这里处理异常情况
}
}
#endregion
}
}

@ -99,6 +99,34 @@ namespace Aucma.Core.ProductOffLine.Config
set { iniHelper.IniWriteValue("system", "PalletizDirection", value); }
}
/// <summary>
/// 班组代码
/// </summary>
public string TeamCode
{
get { return iniHelper.IniReadValue("system", "TeamCode"); }
set { iniHelper.IniWriteValue("system", "TeamCode", value); }
}
/// <summary>
/// 班组名称
/// </summary>
public string TeamName
{
get { return iniHelper.IniReadValue("system", "TeamName"); }
set { iniHelper.IniWriteValue("system", "TeamName", value); }
}
/// <summary>
/// 用户名
/// </summary>
public string Account
{
get { return iniHelper.IniReadValue("system", "Account"); }
set { iniHelper.IniWriteValue("system", "Account", value); }
}
}
}

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.ProductOffLine.Models
{
/**
*
* */
public class Result
{
/// <summary>
/// 返回结果
/// </summary>
public string msg { get; set; }
/// <summary>
/// 返回状态
/// </summary>
public int code { get; set; }
/// <summary>
/// 返回令牌
/// </summary>
public string token { get; set; }
}
}

@ -28,5 +28,27 @@ namespace Aucma.Core.PrintTo.Common
}
}
#endregion
#region 关闭软盘
/// <summary>
/// 关闭软盘
/// </summary>
public static void CloseOsk()
{
try
{
// 查找并关闭 osk.exe 进程
foreach (Process proc in Process.GetProcessesByName("osk"))
{
proc.Kill();
}
}
catch
{
// 可以在这里处理异常情况
}
}
#endregion
}
}

@ -0,0 +1,137 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using log4net;
using System.Windows;
using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Service;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.ObjectModel;
using Admin.Core.Model.Model_New;
using StackExchange.Profiling.Internal;
using System;
using System.Text.Json;
using System.Windows.Input;
using MaterialDesignThemes.Wpf;
using NPOI.Util.Collections;
using Aucma.Core.ProductOffLine.Config;
using Aucma.Core.ProductOffLine;
using Aucma.Core.ProductOffLine.Models;
using Aucma.Core.ProductOffLine.Views;
namespace Aucma.Core.PrintTo.ViewModels
{
public partial class LoginPageViewModel : ObservableObject
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(LoginPageViewModel));
protected readonly IBaseTeamMembersServices _baseTeamMembersServices;
private AppConfig appConfig = AppConfig.Instance;
public LoginPageViewModel() {
_baseTeamMembersServices = App.ServiceProvider.GetService<IBaseTeamMembersServices>();
AddTeamData();
}
#region 登录
/// <summary>
/// 登录
/// </summary>
/// <param name="team">选择的班组信息</param>
/// <param name="userName">用户名</param>
/// <param name="passWord">密码</param>
public void Login(BaseTeamMembers team, string userName, string passWord,object parameter)
{
try
{
//获取Token
string url = $"http://10.100.72.10:8080/login";
var content = new
{
username = userName,
password = passWord
};
var loginResult = HttpHelper.Post(url, content.ToJson());//发送用户名密码给API
Result result = JsonSerializer.Deserialize<Result>(loginResult);
if (result == null)
{
MessageBox.Show("登录失败!", "系统提醒");
return;
}
if (result.code == 200)
{
// 存储账号信息
appConfig.TeamCode = team.TeamCode;
appConfig.TeamName = team.TeamName;
appConfig.Account = userName;
//跳转
var window = parameter as LoginPageView;
if (window == null) return;
window.Hide();
MainWindow indexPage = new MainWindow();
indexPage.Show();
window.Close();
}
else
{
MessageBox.Show($"登录失败!{result.msg}", "系统提醒");
return;
}
}
catch (Exception ex)
{
log.Error($"登录异常:{ex.Message}");
}
}
#endregion
#region 关闭当前界面
/// <summary>
/// 关闭当前界面
/// </summary>
/// <param name="parameter"></param>
public void CloseWindow(object parameter)
{
var window = parameter as Window;
if (window == null) return;
window.Close();
}
#endregion
#region 班组数据
/// <summary>
/// 班组数据
/// </summary>
private ObservableCollection<BaseTeamMembers> _teamMembersList = new ObservableCollection<BaseTeamMembers>();
public ObservableCollection<BaseTeamMembers> TeamMembersList
{
get
{
return this._teamMembersList;
}
set
{
SetProperty(ref _teamMembersList, value);
}
}
#endregion
#region 班组添加到集合中
public void AddTeamData()
{
var baseTeamMembersList = _baseTeamMembersServices.QueryAsync(d => d.ProductLineCode.Contains("CX_02")).Result;
if (baseTeamMembersList == null) return;
foreach (var item in baseTeamMembersList)
{
TeamMembersList.Add(item);
}
}
#endregion
}
}

@ -239,15 +239,8 @@ namespace Aucma.Core.ProductOffLine.ViewModels
string controlType = obj as string;
switch (controlType)
{
// 关闭当前窗口
case "Exit":
if (System.Windows.MessageBox.Show("确定要退出系统吗?", "系统提醒", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
Application.Current.Shutdown();
Environment.Exit(0);
}
break;
// 打开软盘
case "TabTip":
@ -283,6 +276,35 @@ namespace Aucma.Core.ProductOffLine.ViewModels
}
#endregion
#region 关闭当前界面
/// <summary>
/// 关闭当前界面
/// </summary>
/// <param name="parameter"></param>
[RelayCommand]
public void CloseWindow(object parameter)
{
var window = parameter as Window;
if (window == null) return;
if (MessageBox.Show("确定要退出系统吗?", "系统提醒", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
appConfig.TeamCode = "";
appConfig.TeamName = "";
appConfig.Account = "";
window.Hide();
//跳转到登录页
LoginPageView login = new LoginPageView();
login.Show();
window.Close();
}
}
#endregion
#region 打开软盘
/// <summary>
/// 打开软盘

@ -0,0 +1,81 @@
<Window x:Class="Aucma.Core.ProductOffLine.Views.LoginPageView"
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="登录"
x:Name="MainWindow"
FontFamily="Microsoft YaHei"
WindowStartupLocation="CenterScreen"
WindowState="Maximized" d:DesignWidth="1200" d:DesignHeight="900"
>
<Window.Background>
<ImageBrush ImageSource="/Assets/Images/login-background.png" />
</Window.Background>
<Border Margin="5" Background="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="2*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<UniformGrid Grid.Row="0">
<StackPanel HorizontalAlignment="Left">
<Image Source="/Assets/Images/Newlog.png" Width="100" />
</StackPanel>
</UniformGrid>
<UniformGrid Grid.Row="1" Margin="0 10">
<Border BorderThickness="4" CornerRadius="5" x:Name="DialogHost" Width="400" Height="350" VerticalAlignment="Center" HorizontalAlignment="Center" >
<StackPanel Background="White">
<ComboBox Margin="0 50 0 0"
x:Name="selectTeamComboBox"
Width="300"
BorderThickness="1"
BorderBrush="{StaticResource MaterialDesignDivider}"
materialDesign:HintAssist.Hint="班组"
SelectedValuePath="TeamCode"
DisplayMemberPath="TeamName"
ItemsSource="{Binding TeamMembersList}"
Style="{StaticResource MaterialDesignOutlinedComboBox}" />
<TextBox Margin="0 10 0 0"
x:Name="txtUserName"
Width="300"
materialDesign:HintAssist.Hint="用户名"
BorderThickness="1"
BorderBrush="{StaticResource MaterialDesignDivider}"
Style="{StaticResource MaterialDesignOutlinedTextBox}"
GotFocus="TextBox_GotFocus"
LostFocus="TextBox_LostFocus"/>
<PasswordBox
Margin="0 10 0 0"
x:Name="txtPassword"
Width="300"
FontSize="12"
materialDesign:HintAssist.Hint="密码"
BorderThickness="1"
BorderBrush="{StaticResource MaterialDesignDivider}"
Style="{StaticResource MaterialDesignOutlinedPasswordBox}"
GotFocus="TextBox_GotFocus"
LostFocus="TextBox_LostFocus"/>
<Button Margin="0 20 0 0"
x:Name="loginBtn"
Style="{StaticResource MaterialDesignFlatMidBgButton}"
Width="300"
Height="53"
Command="{Binding LoginCommand}"
materialDesign:ButtonAssist.CornerRadius="10"
Content="登录" Click="loginBtn_Click"/>
</StackPanel>
</Border>
</UniformGrid>
<UniformGrid Grid.Row="2">
</UniformGrid>
</Grid>
</Border>
</Window>

@ -0,0 +1,73 @@
using Admin.Core.Model.Model_New;
using Aucma.Core.PrintTo.Common;
using Aucma.Core.PrintTo.ViewModels;
using Aucma.Core.ProductOffLine.Common;
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 Aucma.Core.ProductOffLine.Views
{
/// <summary>
/// LoginPageView.xaml 的交互逻辑
/// </summary>
public partial class LoginPageView : Window
{
LoginPageViewModel loginViewModel = new LoginPageViewModel();
public LoginPageView()
{
InitializeComponent();
this.DataContext = loginViewModel;
}
private void loginBtn_Click(object sender, RoutedEventArgs e)
{
string userName = txtUserName.Text;
string passWord = txtPassword.Password;
BaseTeamMembers teamMembers = (BaseTeamMembers)this.selectTeamComboBox.SelectedItem;
if (teamMembers==null)
{
MessageBox.Show("请选择班组!","系统提醒");
return;
}
// 非空校验,账号密码正则校验
if (string.IsNullOrWhiteSpace(userName))
{
MessageBox.Show("用户名不可为空!", "系统提醒");
return;
}
if (string.IsNullOrWhiteSpace(passWord))
{
MessageBox.Show("密码不可为空!", "系统提醒");
return;
}
// 登录校验
loginViewModel.Login(teamMembers,userName, passWord,this);
}
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
// 弹出系统键盘
OSKHelper.OpenOsk();
}
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
{
// 隐藏系统键盘
OSKHelper.CloseOsk();
}
}
}

@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Name="window"
Title="SCADA" Height="1080" Width="1920" Icon="/Assets/images/Icon.png" FontFamily="Microsoft YaHei"
WindowStartupLocation="CenterScreen"
WindowState="Maximized" WindowStyle="SingleBorderWindow" ResizeMode="CanResize">
@ -75,7 +76,7 @@
<Button Content="质检分垛" x:Name="QualityPage" Margin="5 0" Height="40" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=QualityPage}" />
<Button Content="键盘" x:Name="TabTip" Margin="5 0" Height="40" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=TabTip}" />
<Button Content="最小化" x:Name="Minimized" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Width="100" Margin="5 0" Height="40" Background="#FF9900" BorderBrush="#FF9900" />
<Button Content="退 出" x:Name="Exit" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Exit}" Width="100" Margin="5 0" Height="40" Background="#FF0033" BorderBrush="#FF0033"/>
<Button Content="退 出" x:Name="Exit" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding ElementName=window}" Width="100" Margin="5 0" Height="40" Background="#FF0033" BorderBrush="#FF0033"/>
</StackPanel>
<StackPanel Height="50" Orientation="Horizontal" HorizontalAlignment="Right">
<Border Width="30" Height="30" CornerRadius="15">

@ -1,4 +1,6 @@
using Aucma.Core.ProductOffLine.ViewModels;
using Aucma.Core.ProductOffLine.Config;
using Aucma.Core.ProductOffLine.ViewModels;
using System;
using System.Windows;
namespace Aucma.Core.ProductOffLine.Views
@ -8,10 +10,30 @@ namespace Aucma.Core.ProductOffLine.Views
/// </summary>
public partial class MainWindow : Window
{
private AppConfig appConfig = AppConfig.Instance;
public MainWindow()
{
InitializeComponent();
this.DataContext = new MainWindowViewModel();
try
{
bool loginResult = LoginInit();
if (loginResult)
{
MainWindow_Loaded();
}
else
{
this.Hide(); // 登录校验失败,关闭主窗体
LoginPageView indexPage = new LoginPageView();
indexPage.ShowDialog();
this.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private void Button_Click(object sender, RoutedEventArgs e)
@ -24,5 +46,41 @@ namespace Aucma.Core.ProductOffLine.Views
{
}
private void MainWindow_Loaded()
{
try
{
// 主窗体加载完成后执行其他逻辑
InitializeComponent();
this.DataContext = new MainWindowViewModel();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
}
#region 登录验证
public bool LoginInit()
{
//账号名称不存在,跳转
if (string.IsNullOrWhiteSpace(appConfig.Account))
{
// this.Hide();
//this.Close();
return false;
}
else
{
// this.Account.Text = appConfig.Account;
//this.Team.Text = appConfig.TeamName;
return true;
}
}
#endregion
}
}

Loading…
Cancel
Save