From a93c957142940b4ba36369ad76a3c3d40b48ecb1 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期一, 09 十二月 2024 14:25:50 +0800 Subject: [PATCH] 1 --- DevApp/Gs.DevApp/TestForm/XtraForm1.cs | 114 +++++--------------------------------------------------- 1 files changed, 11 insertions(+), 103 deletions(-) diff --git a/DevApp/Gs.DevApp/TestForm/XtraForm1.cs b/DevApp/Gs.DevApp/TestForm/XtraForm1.cs index 01a727d..0daa8ba 100644 --- a/DevApp/Gs.DevApp/TestForm/XtraForm1.cs +++ b/DevApp/Gs.DevApp/TestForm/XtraForm1.cs @@ -15,6 +15,7 @@ using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; using Newtonsoft.Json; +using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames; namespace Gs.DevApp.TestForm { @@ -25,118 +26,25 @@ public XtraForm1() { InitializeComponent(); - //dddddddd(); - - //await Task.Run(() => - //{ - - //}); - } - - private async void dddddddd() { - - UcLoading _loading = new UcLoading(); - var pgq = new PageQueryModel(1, 999999, "item_name", "asc", "", - " and fforbidstatus='A'"); - var json = JsonConvert.SerializeObject(pgq); - try - { - //var strReturn = await UtilityHelper.HttpPostAsync("", - // "MesItemsManager/GetListPageByLook", json); - //var rtn = UtilityHelper.ReturnToList(strReturn); - //var dt = rtn.rtnData; - - await csd(); - - } - catch (Exception ex) - { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - _loading.Stop(); } - private async Task<int> csd() + private void simpleButton1_Click(object sender, EventArgs e) { - int c = 0; - //await Task.Delay(1000); - await Task.Run(() => - { - for (int i = 0; i < 10000; i++) - { - c = c + i; - if (richTextBox1.InvokeRequired) - { - richTextBox1.BeginInvoke(new Action(() => - { - richTextBox1.Text = c.ToString(); - })); - } - else - { - richTextBox1.Text = c.ToString(); - } - } - - }); - return c; + Random random = new Random(); + int randomValue = 0; + //杩涘害鏉� + DevExpress.Utils.WaitDialogForm wdf = new DevExpress.Utils.WaitDialogForm("鎻愮ず", "姝e湪瀵煎叆鏁版嵁......"); - } - private void simpleButton1_Click_1(object sender, EventArgs e) - { - dddddddd(); - } + randomValue = (int)random.Next(1, 38); + wdf.SetCaption("鎵ц杩涘害锛�" + randomValue + "%锛�"); - - private async void simpleButton2_Click(object sender, EventArgs e) - { - UcLoading _loading = new UcLoading(); - string url = "http://localhost:5263/"; - try - { - string result = await GetHttpResponseAsync(url); - Console.WriteLine(result); - richTextBox1.Text = result; - } - catch (WebException ex) - { - richTextBox1.Text = ex.Message; - } - _loading.Stop(); - } + randomValue = (int)random.Next(randomValue, 80); - private static async Task<string> GetHttpResponseAsync(string url) - { - string param = "{}"; - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - - request.Method = "POST"; - request.ContentType = "application/json"; - //request.Headers.Add("token", GetBasicAuthTicket()); - request.Accept = "*/*"; - request.Timeout = 15000; - request.AllowAutoRedirect = false; + wdf.SetCaption("鎵ц杩涘害锛�" + randomValue + "%锛�"); - - //StreamWriter requestStream = null; - //requestStream = new StreamWriter(request.GetRequestStream()); - //requestStream.Write(param); - //requestStream.Close(); - - using (Stream requestStream = await request.GetRequestStreamAsync()) - { - byte[] dataBytes = Encoding.UTF8.GetBytes(param); - await requestStream.WriteAsync(dataBytes, 0, dataBytes.Length); - } + wdf.Close(); - - using (WebResponse response = await request.GetResponseAsync()) - using (Stream responseStream = response.GetResponseStream()) - using (StreamReader reader = new StreamReader(responseStream, Encoding.UTF8)) - { - return await reader.ReadToEndAsync(); - } } } } \ No newline at end of file -- Gitblit v1.9.3