This repository has been archived on 2024-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
CDSAE3/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs

50 lines
1.6 KiB
C#

using CDSAE3_Lian_Lian_Kan.Forms;
using CDSAE3_Lian_Lian_Kan.Properties;
using System.Text.Json;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using System.ComponentModel;
using CDSAE3_Lian_Lian_Kan.Forms.Interface;
namespace CDSAE3_Lian_Lian_Kan.Forms
{
public partial class LianLianKan : Form
{
public LianLianKan()
{
InitializeComponent();
Etcs.hunderd_millsecond_timer.Elapsed += StartFunc;
Etcs.form = this;
}
private void StartFunc(object? Sender, EventArgs e)
{
Etcs.hunderd_millsecond_timer.Elapsed -= StartFunc;
Form? menuForm = null;
Invoke(() => menuForm = new Leisure_Mode_MenuForm());
Invoke(() => change_form(menuForm!, false, null, null, false, null));
}
public async Task change_form(Form newForm, bool doAnimation, Color? begin, Color? end, bool haveImage, Image? image)
{
if (doAnimation)
{
bufferForm.SetEffect(begin!.Value, end!.Value, haveImage, image);
bufferForm.BringToFront();
bufferForm.Visible = true;
}
MainPanel.Controls.Clear();
newForm.TopLevel = false;
newForm.Dock = DockStyle.Fill;
(newForm as IThemeChangeable)?.SetTheme();
MainPanel.Controls.Add(newForm);
BeginInvoke(() => newForm.Show());
MainPanel.SendToBack();
if (doAnimation)
{
await bufferForm.EffectAsync();
bufferForm.Visible = false;
}
GC.Collect();
}
}
}