cloudflight
2023-12-02 c0f9915265878e56e91ee97f7f8d925db1e12626
TestForm/Form1.cs
@@ -1,4 +1,6 @@
using CloudWaterNetwork;
using CommonBase;
using Hydro.MapUI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -6,6 +8,7 @@
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -29,5 +32,47 @@
        
        }
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            //var list=map._Template.network.Calc();
            //if (_selectTemp == null) return;
            var _selectTemp = map._Template;
            map.toolStripButton_save_ButtonClick(1, null);
            ProgressForm_计算 progressForm = null;
            progressForm = new ProgressForm_计算();
            progressForm.StartPosition = FormStartPosition.Manual;
            progressForm.Location = new Point(this.Left + this.Width / 2 - progressForm.Width / 2, this.Top + this.Height / 2 - progressForm.Height / 2); // 计算新窗口的位置
            new Thread(() =>
            {
                progressForm.ShowDialog();
            }).Start();
            lock (GlobalProgress.Instance)
            {
                GlobalProgress.stateText = "计算中";
                GlobalProgress.MaxNum = 1;
                GlobalProgress.CurrentNum = 0;
                GlobalProgress.Hide = false;
                GlobalProgress.NeedStop = false;
                GlobalProgress.ChildMaxNum = 100;
                GlobalProgress.ChildCurrentNum = 0;
            }
            var net = _selectTemp.network;
            net.Calc(_selectTemp.FullPath);
            lock (GlobalProgress.Instance)
            {
                GlobalProgress.NeedStop = true;
            }
        }
    }
}