mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
性能优化
This commit is contained in:
parent
f986bf907f
commit
cc1e18735f
@ -65,7 +65,7 @@ namespace VPet_Simulator.Core
|
||||
/// <param name="img">用于显示的Image</param>
|
||||
/// <param name="EndAction">结束动画</param>
|
||||
/// <returns>准备好的线程</returns>
|
||||
public static Thread Run(this IGraph graph, Image img, Action EndAction = null)
|
||||
public static Task Run(this IGraph graph, Image img, Action EndAction = null)
|
||||
{
|
||||
if (graph is IImageRun iri)
|
||||
{
|
||||
|
@ -332,7 +332,7 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
if (parant.Tag == this)
|
||||
{
|
||||
new Thread(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, EndAction)).Start();
|
||||
Task.Run(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, EndAction));
|
||||
return;
|
||||
}
|
||||
System.Windows.Controls.Image img;
|
||||
@ -378,7 +378,7 @@ namespace VPet_Simulator.Core
|
||||
/// <param name="img">用于显示的Image</param>
|
||||
/// <param name="EndAction">结束动画</param>
|
||||
/// <returns>准备好的线程</returns>
|
||||
public Thread Run(System.Windows.Controls.Image img, Action EndAction = null)
|
||||
public Task Run(System.Windows.Controls.Image img, Action EndAction = null)
|
||||
{
|
||||
nowid = 0;
|
||||
PlayState = true;
|
||||
@ -387,12 +387,12 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
if (img.Tag == this)
|
||||
{
|
||||
return new Thread(() => Animations[0].Run(img, EndAction));
|
||||
return new Task(() => Animations[0].Run(img, EndAction));
|
||||
}
|
||||
img.Tag = this;
|
||||
img.Source = new BitmapImage(new Uri(Path));
|
||||
img.Width = Width;
|
||||
return new Thread(() => Animations[0].Run(img, EndAction));
|
||||
return new Task(() => Animations[0].Run(img, EndAction));
|
||||
});
|
||||
}
|
||||
public void Stop(bool StopEndAction = false)
|
||||
|
@ -139,7 +139,7 @@ namespace VPet_Simulator.Core
|
||||
PlayState = false;
|
||||
this.DoEndAction = !StopEndAction;
|
||||
}
|
||||
public Thread Run(System.Windows.Controls.Image img, Action EndAction = null)
|
||||
public Task Run(System.Windows.Controls.Image img, Action EndAction = null)
|
||||
{
|
||||
PlayState = true;
|
||||
DoEndAction = true;
|
||||
@ -147,7 +147,7 @@ namespace VPet_Simulator.Core
|
||||
{
|
||||
if (img.Tag == this)
|
||||
{
|
||||
return new Thread(() =>
|
||||
return new Task(() =>
|
||||
{
|
||||
Thread.Sleep(Length);
|
||||
if (IsLoop && PlayState)
|
||||
@ -165,7 +165,7 @@ namespace VPet_Simulator.Core
|
||||
img.Tag = this;
|
||||
img.Source = new BitmapImage(new Uri(Path));
|
||||
img.Width = 500;
|
||||
return new Thread(() =>
|
||||
return new Task(() =>
|
||||
{
|
||||
Thread.Sleep(Length);
|
||||
if (IsLoop && PlayState)
|
||||
@ -189,7 +189,7 @@ namespace VPet_Simulator.Core
|
||||
/// <param name="img">用于显示的Image</param>
|
||||
/// <param name="EndAction">结束动画</param>
|
||||
/// <returns>准备好的线程</returns>
|
||||
Thread Run(System.Windows.Controls.Image img, Action EndAction = null);
|
||||
Task Run(System.Windows.Controls.Image img, Action EndAction = null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -667,7 +667,7 @@ namespace VPet_Simulator.Windows
|
||||
private void Group_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (LocalizeCore.CurrentCulture.StartsWith("zh"))
|
||||
ExtensionSetting.StartURL("https://jq.qq.com/?_wv=1027&k=zmeWNHyI");
|
||||
ExtensionSetting.StartURL("https://tieba.baidu.com/f?kw=%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%92%AD%E6%A8%A1%E6%8B%9F%E5%99%A8");
|
||||
else
|
||||
ExtensionSetting.StartURL("https://github.com/LorisYounger/VPet");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user