* UIWaitFormService:更新线程终止为窗体关闭后关闭线程
This commit is contained in:
parent
b15b14087f
commit
4016c68776
Binary file not shown.
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
@ -11,7 +11,6 @@ namespace Sunny.UI.Demo
|
|||||||
public FMain()
|
public FMain()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
int pageIndex = 1000;
|
int pageIndex = 1000;
|
||||||
Header.SetNodePageIndex(Header.Nodes[0], pageIndex);
|
Header.SetNodePageIndex(Header.Nodes[0], pageIndex);
|
||||||
Header.SetNodeSymbol(Header.Nodes[0], 61451);
|
Header.SetNodeSymbol(Header.Nodes[0], 61451);
|
||||||
|
@ -29,7 +29,7 @@ namespace Sunny.UI
|
|||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
public sealed class UIWaitingBar : UIControl
|
public sealed class UIWaitingBar : UIControl
|
||||||
{
|
{
|
||||||
private System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
|
private readonly Timer timer = new Timer();
|
||||||
|
|
||||||
public UIWaitingBar()
|
public UIWaitingBar()
|
||||||
{
|
{
|
||||||
@ -66,6 +66,8 @@ namespace Sunny.UI
|
|||||||
set => blockCount = Math.Max(10, value);
|
set => blockCount = Math.Max(10, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event EventHandler Tick;
|
||||||
|
|
||||||
private void Timer_Tick(object sender, EventArgs e)
|
private void Timer_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//移动距离要减去滑块本身的宽度
|
//移动距离要减去滑块本身的宽度
|
||||||
@ -86,6 +88,8 @@ namespace Sunny.UI
|
|||||||
dz = dMoveDistance * (1 + Math.Sin((d - 90) * Math.PI / 180)) / 2;
|
dz = dMoveDistance * (1 + Math.Sin((d - 90) * Math.PI / 180)) / 2;
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|
||||||
|
Tick?.Invoke(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DefaultValue(200)]
|
[DefaultValue(200)]
|
||||||
|
@ -63,14 +63,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private void CloseForm()
|
private void CloseForm()
|
||||||
{
|
{
|
||||||
try
|
if (form != null) form.NeedClose = true;
|
||||||
{
|
|
||||||
thread?.Abort();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFormDescription(string desc)
|
private void SetFormDescription(string desc)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace Sunny.UI
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public partial class UIWaitForm : UIForm
|
public partial class UIWaitForm : UIForm
|
||||||
{
|
{
|
||||||
@ -30,5 +32,13 @@
|
|||||||
labelDescription.Invalidate();
|
labelDescription.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DefaultValue(false), Browsable(false)]
|
||||||
|
public bool NeedClose { get; set; }
|
||||||
|
|
||||||
|
private void Bar_Tick(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if (NeedClose) Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
SunnyUI/Forms/UIWaitForm.designer.cs
generated
1
SunnyUI/Forms/UIWaitForm.designer.cs
generated
@ -53,6 +53,7 @@
|
|||||||
this.Bar.Size = new System.Drawing.Size(409, 29);
|
this.Bar.Size = new System.Drawing.Size(409, 29);
|
||||||
this.Bar.TabIndex = 6;
|
this.Bar.TabIndex = 6;
|
||||||
this.Bar.Text = "uiWaitingBar1";
|
this.Bar.Text = "uiWaitingBar1";
|
||||||
|
this.Bar.Tick += new System.EventHandler(this.Bar_Tick);
|
||||||
//
|
//
|
||||||
// UIWaitForm
|
// UIWaitForm
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user