C3204
2026-01-04 2337f47091dbcc1a681f63fc18d9b8d28ab22296
优化登录界面。
已修改3个文件
已添加12个文件
已删除1个文件
81 ■■■■ 文件已修改
LB_SmartVision/Program.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/01.JPG 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/02.png 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/03.png 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/04.png 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/05.png 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/06.png 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/07.png 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/favicon.ico 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/lanbao.jpg 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/logo.ico 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/logo_h.png 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/images/键盘.ico 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVisionLoginUI/App.config 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVisionLoginUI/App.xaml.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVisionLoginUI/LB_SmartVisionLoginUI.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Program.cs
@@ -1,3 +1,6 @@
using LB_SmartVisionLoginUI;
using System.Text;
namespace LB_SmartVision
{
    internal static class Program
@@ -8,10 +11,71 @@
        [STAThread]
        static void Main()
        {
            // To customize application configuration such as set high DPI settings or default font,
            // see https://aka.ms/applicationconfiguration.
            ApplicationConfiguration.Initialize();
            Application.Run(new VisionForm());
            try
            {
                string halconDir = Environment.GetEnvironmentVariable("HALCONROOT");
                if (string.IsNullOrEmpty(halconDir) || !Directory.Exists(halconDir))
                {
                    System.Windows.Forms.MessageBox.Show("环境变量缺少HALCONROOT,请确认是否安装正确!");
                }
                else
                {
                    bool ret;
                    System.Threading.Mutex mutex = new System.Threading.Mutex(true, System.Windows.Forms.Application.ProductName, out ret);
                    if (ret)
                    {
                        MainWindow.InstanceLoginandConfirmation().ShowDialog();
                        if (!MainWindow.InstanceLoginandConfirmation().isQuit && MainWindow.InstanceLoginandConfirmation().correctUser)
                        {
                            MainWindow.InstanceLoginandConfirmation().closeLoginFrm();
                            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
                            System.Windows.Forms.Application.EnableVisualStyles();
                            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
                            System.Windows.Forms.Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                            System.Windows.Forms.Application.ThreadException += (sender, e) => HandleException(e.Exception);
                            AppDomain.CurrentDomain.UnhandledException += (sender, e) => HandleException(e.ExceptionObject as Exception);
                            // To customize application configuration such as set high DPI settings or default font,
                            // see https://aka.ms/applicationconfiguration.
                            System.Windows.Forms.Application.Run(new VisionForm());
                        }
                        //   Main   ä¸ºä½ ç¨‹åºçš„主窗体,如果是控制台程序不用这句
                        mutex.ReleaseMutex();
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("有一个和本程序相同的应用程序已经在运行,请不要同时运行多个本程序。\r\n这个程序即将退出。", System.Windows.Forms.Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //   æç¤ºä¿¡æ¯ï¼Œå¯ä»¥åˆ é™¤ã€‚
                        System.Windows.Forms.Application.Exit();//退出程序
                    }
                }
            }
            catch (Exception ex)
            {
                if (null != ex)
                {
                    string strMsg = "InitControl failed. Error Code: " + ex.Message;
                    System.Windows.Forms.MessageBox.Show(strMsg);
                }
                else
                {
                    return;
                }
            }
        }
        static void HandleException(Exception ex)
        {
            // è®°å½•异常信息
            string logPath = @"\Logs\app_crash.log";
            Directory.CreateDirectory(Path.GetDirectoryName(logPath));
            File.AppendAllText(logPath, $"{DateTime.Now}: {ex}\n");
            // æ˜¾ç¤ºé”™è¯¯ä¿¡æ¯ï¼ˆå¯é€‰ï¼‰
            System.Windows.Forms.MessageBox.Show($"程序发生错误: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            // é€€å‡ºç¨‹åº
            Environment.Exit(1);
        }
    }
}
LB_SmartVision/images/01.JPG
LB_SmartVision/images/02.png
LB_SmartVision/images/03.png
LB_SmartVision/images/04.png
LB_SmartVision/images/05.png
LB_SmartVision/images/06.png
LB_SmartVision/images/07.png
LB_SmartVision/images/favicon.ico
LB_SmartVision/images/lanbao.jpg
LB_SmartVision/images/logo.ico
LB_SmartVision/images/logo_h.png
LB_SmartVision/images/¼üÅÌ.ico
LB_SmartVisionLoginUI/App.config
ÎļþÒÑɾ³ý
LB_SmartVisionLoginUI/App.xaml.cs
@@ -11,7 +11,7 @@
    /// <summary>
    /// App.xaml çš„交互逻辑
    /// </summary>
    public partial class App : Application
    public partial class App : System.Windows.Application
    {
    }
}
LB_SmartVisionLoginUI/LB_SmartVisionLoginUI.csproj
@@ -6,6 +6,7 @@
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <UseWPF>true</UseWPF>
    <UseWindowsForms>True</UseWindowsForms>
  </PropertyGroup>
  <ItemGroup>