2023-06-01 08:16:45 +00:00
|
|
|
|
using VPet_Simulator.Core;
|
2022-12-13 07:10:18 +00:00
|
|
|
|
|
|
|
|
|
namespace VPet_Simulator.Windows
|
|
|
|
|
{
|
2022-12-14 18:17:13 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 窗体控制器实现
|
|
|
|
|
/// </summary>
|
2022-12-13 07:10:18 +00:00
|
|
|
|
public class MWController : IController
|
|
|
|
|
{
|
2022-12-14 18:17:13 +00:00
|
|
|
|
readonly MainWindow mw;
|
2022-12-13 07:10:18 +00:00
|
|
|
|
public MWController(MainWindow mw)
|
|
|
|
|
{
|
|
|
|
|
this.mw = mw;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-14 18:17:13 +00:00
|
|
|
|
public double GetWindowsDistanceDown()
|
2022-12-13 07:10:18 +00:00
|
|
|
|
{
|
2022-12-14 18:17:13 +00:00
|
|
|
|
return mw.Dispatcher.Invoke(() => System.Windows.SystemParameters.PrimaryScreenHeight - mw.Top - mw.Height);
|
2022-12-13 07:10:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-14 18:17:13 +00:00
|
|
|
|
public double GetWindowsDistanceLeft()
|
2022-12-13 07:10:18 +00:00
|
|
|
|
{
|
2022-12-14 18:17:13 +00:00
|
|
|
|
return mw.Dispatcher.Invoke(() => mw.Left);
|
2022-12-13 07:10:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-14 18:17:13 +00:00
|
|
|
|
public double GetWindowsDistanceRight()
|
2022-12-13 07:10:18 +00:00
|
|
|
|
{
|
2022-12-14 18:17:13 +00:00
|
|
|
|
return mw.Dispatcher.Invoke(() => System.Windows.SystemParameters.PrimaryScreenWidth - mw.Left - mw.Width);
|
2022-12-13 07:10:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-14 18:17:13 +00:00
|
|
|
|
public double GetWindowsDistanceUp()
|
2022-12-13 07:10:18 +00:00
|
|
|
|
{
|
2022-12-14 18:17:13 +00:00
|
|
|
|
return mw.Dispatcher.Invoke(() => mw.Top);
|
2022-12-13 07:10:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-14 18:17:13 +00:00
|
|
|
|
public void MoveWindows(double X, double Y)
|
2022-12-13 07:10:18 +00:00
|
|
|
|
{
|
2022-12-14 18:17:13 +00:00
|
|
|
|
mw.Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
mw.Left += X * ZoomRatio;
|
|
|
|
|
mw.Top += Y * ZoomRatio;
|
|
|
|
|
});
|
2022-12-13 07:10:18 +00:00
|
|
|
|
}
|
2022-12-28 10:24:38 +00:00
|
|
|
|
|
|
|
|
|
public void ShowSetting()
|
2023-01-03 04:18:21 +00:00
|
|
|
|
{
|
2023-01-11 13:44:16 +00:00
|
|
|
|
mw.Topmost = false;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
mw.winSetting.Show();
|
2022-12-28 10:24:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-08 02:59:54 +00:00
|
|
|
|
public void ShowPanel()
|
|
|
|
|
{
|
|
|
|
|
var panelWindow = new winCharacterPanel();
|
|
|
|
|
panelWindow.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 10:43:32 +00:00
|
|
|
|
public double ZoomRatio => mw.Set.ZoomLevel;
|
2023-01-08 16:57:10 +00:00
|
|
|
|
|
2023-01-24 06:56:16 +00:00
|
|
|
|
public int PressLength => mw.Set.PressLength;
|
|
|
|
|
|
2023-06-08 11:44:41 +00:00
|
|
|
|
public bool EnableFunction => mw.Set.EnableFunction;
|
2023-01-24 06:56:16 +00:00
|
|
|
|
|
|
|
|
|
public int InteractionCycle => mw.Set.InteractionCycle;
|
2023-01-21 14:16:13 +00:00
|
|
|
|
|
2022-12-13 07:10:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|