添加相应接口

This commit is contained in:
ZouJin 2023-01-13 22:45:42 +08:00
parent 09e853677a
commit 03b47558fa
3 changed files with 11 additions and 5 deletions

View File

@ -70,7 +70,7 @@ namespace VPet_Simulator.Core
{
Core.Controller.MoveWindows(MoveTimerPoint.X, MoveTimerPoint.Y);
}
public Action DefaultClickAction;
bool isPress = false;
private void MainGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
@ -97,7 +97,7 @@ namespace VPet_Simulator.Core
if (act != null)
Dispatcher.Invoke(act.DoAction);
else
Dispatcher.Invoke(ToolBar.Show);
DefaultClickAction?.Invoke();
}
});
}

View File

@ -40,11 +40,14 @@ namespace VPet_Simulator.Core
EndTimer.Start();
}
}
public Action EndAction;
private void EndTimer_Elapsed(object sender, ElapsedEventArgs e)
{
if (--timeleft <= 0)
{
Dispatcher.Invoke(() => this.Visibility = Visibility.Collapsed);
EndAction?.Invoke();
}
}
public Timer EndTimer = new Timer() { Interval = 100 };
@ -75,6 +78,7 @@ namespace VPet_Simulator.Core
{
EndTimer.Stop(); ShowTimer.Stop();
this.Visibility = Visibility.Collapsed;
EndAction?.Invoke();
}
}
}

View File

@ -105,8 +105,10 @@ namespace VPet_Simulator.Windows
Dispatcher.Invoke(new Action(() => {
Core.Graph = Pets[0].Graph;
LoadingText.Visibility = Visibility.Collapsed;
winSetting = new winGameSetting(this);
DisplayGrid.Child = new Main(Core);
winSetting = new winGameSetting(this);
var main = new Main(Core) { };
main.DefaultClickAction = () => { Dispatcher.Invoke(() => { main.Say("你知道吗? 鼠标右键可以打开菜单栏"); }); };
DisplayGrid.Child = main;
}));
}