mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-04-05 17:37:51 +08:00
1
This commit is contained in:
parent
313f8fd79b
commit
40efe5292f
@ -66,11 +66,6 @@ namespace CPF.Toolkit.Demo
|
||||
Commands = { { nameof(Button.Click),(s,e) => vm.Test() } }
|
||||
},
|
||||
new Button
|
||||
{
|
||||
Content = "关闭窗体",
|
||||
Commands = { { nameof(Button.Click),(s,e) => vm.Test() } }
|
||||
},
|
||||
new Button
|
||||
{
|
||||
Content = "loading",
|
||||
Commands = { { nameof(Button.Click),(s,e) => vm.LoadingTest() } }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using CPF.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -27,7 +28,16 @@ namespace CPF.Toolkit.Demo
|
||||
|
||||
public async void LoadingTest()
|
||||
{
|
||||
await this.ShowLoading(Task.Delay(3000));
|
||||
await this.ShowLoading(async () =>
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
Debug.WriteLine(1);
|
||||
await Task.Delay(1000);
|
||||
Debug.WriteLine(2);
|
||||
await Task.Delay(1000);
|
||||
Debug.WriteLine(3);
|
||||
});
|
||||
//await this.ShowLoading(Task.Delay(3000));
|
||||
this.Dialog.Sucess("test");
|
||||
|
||||
//var result = await this.ShowLoading(async () =>
|
||||
|
@ -14,7 +14,7 @@ using System.Text;
|
||||
|
||||
namespace CPF.Toolkit.Dialogs
|
||||
{
|
||||
public class DialogView : Window
|
||||
internal class DialogView : Window
|
||||
{
|
||||
public DialogView(string text, string title, DialogType dialogType, string defaultButton, params string[] buttons)
|
||||
{
|
||||
@ -112,7 +112,7 @@ namespace CPF.Toolkit.Dialogs
|
||||
BorderFill = "236,236,236",
|
||||
Height = "95%",
|
||||
MarginRight = 5,
|
||||
Commands = { { nameof(Button.Click),(s,e) => this.DialogResult = i } }
|
||||
Commands = { { nameof(Button.Click),(s,e) => this.DialogResult = this.Buttons[i] } }
|
||||
}),
|
||||
}
|
||||
}));
|
||||
|
@ -22,10 +22,7 @@ namespace CPF.Toolkit
|
||||
|
||||
protected void Close(object dialogResult = null)
|
||||
{
|
||||
if (this._close == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
if (this._close == null) throw new ArgumentNullException();
|
||||
this._close.Invoke(this, dialogResult);
|
||||
}
|
||||
|
||||
@ -37,6 +34,12 @@ namespace CPF.Toolkit
|
||||
await this._showLading.Invoke("加载中……", task);
|
||||
}
|
||||
|
||||
protected async Task ShowLoading(Func<Task> task)
|
||||
{
|
||||
if (this._showLoadingFunc == null) throw new ArgumentNullException();
|
||||
await this._showLading.Invoke("加载中……", task.Invoke());
|
||||
}
|
||||
|
||||
protected async Task<T> ShowLoading<T>(Func<Task<T>> task)
|
||||
{
|
||||
if (this._showLoadingFunc == null) throw new ArgumentNullException();
|
||||
|
Loading…
Reference in New Issue
Block a user