1
czw
2025-07-03 9dcc6fbbb575b1d365208defe34290640d4be887
2025Äê6ÔÂ12ÈÕ/AuxAllWCS/Build/Project/½çÃæ/View1.xaml.cs
@@ -28,6 +28,8 @@
using GZ.DB.Repository.OIDATABASE;
using GZ.DB.IRepository.OIDATABASE;
using GZ.DB.Entity.OIDATABASE;
using Microsoft.Web.WebView2.Wpf;
using System.Threading;
namespace GZ.Projects.AuxAllWCS
{
@@ -39,18 +41,36 @@
        public View1()
        {
            InitializeComponent();
         #region é™åˆ¶è¿è¡Œå®žä¾‹æ•°é‡
            #region é™åˆ¶è¿è¡Œå®žä¾‹æ•°é‡
            System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("AuxAllWCS");
            if (processes.Length > System.Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["InstanceLimit"]))
            {
                System.Windows.MessageBox.Show("运行失败:运行实例数量已超出限制");
                this.Close();
            }
         #endregion
            this.DataContext = ViewModel.CreateInstance(this,typeof(View1));
            #endregion
            this.DataContext = ViewModel.CreateInstance(this, typeof(View1));
            this.Loaded += (this.DataContext as ViewModel).View1_LoadEvent;
         this.Closing += (this.DataContext as ViewModel).View1_CloseEvent;
            this.Closing += (this.DataContext as ViewModel).View1_CloseEvent;
            commmd();
        }
        public async void commmd()
        {
            await webView.EnsureCoreWebView2Async();
        labbb:
            if (!string.IsNullOrEmpty(HttpServer._listenerPrefix))
                if (webView.Source != new Uri(HttpServer._listenerPrefix))
                {
                    webView.CoreWebView2.Navigate(HttpServer._listenerPrefix + "/index.html");
                    goto EndInit;
                }
            System.Threading.Thread.Sleep(2000);
            goto labbb;
        EndInit:
            Console.WriteLine("end");
        }
    }
}