Files
CPXV2/CPXV2 PTS/SystemX.Product.CP.PTS/UI/SplashScreenSystemX.cs
2024-06-26 10:30:00 +09:00

97 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraSplashScreen;
namespace EV2WD_MCU_PM
{
public partial class SplashScreenSystemX : SplashScreen
{
List<PictureBox> PicCont;
bool Stop = false;
public SplashScreenSystemX()
{
InitializeComponent();
this.labelCopyright.Text = "Copyright © 1998-" + DateTime.Now.Year.ToString();
}
#region Overrides
public override void ProcessCommand(Enum cmd, object arg)
{
base.ProcessCommand(cmd, arg);
}
#endregion
public enum SplashScreenCommand
{
}
private void SplashScreenSystemX_Shown(object sender, EventArgs e)
{
List<PictureBox> vPic = new List<PictureBox>();
vPic.Add(pictureBoxF);
vPic.Add(pictureBoxR);
PicCont = vPic;
Task tsk = new Task(() => ExeUpdater());
tsk.Start();
}
void ExeUpdater()
{
int nIdx = 0;
while(!Stop)
{
nIdx++;
LogoViewUpdate(nIdx%2);
Thread.Sleep(100);
}
}
delegate void UpdateViewThread(int nIdx);
public void LogoViewUpdate(int nIdx)
{
try
{
if (InvokeRequired)
{
UpdateViewThread del = new UpdateViewThread(LogoViewUpdate);
Invoke(del, nIdx);
}
else
{
for(int i=0; i<PicCont.Count; i++)
{
if(nIdx == i)
PicCont[i].Visible = true;
else
PicCont[i].Visible = false;
}
}
}
catch (Exception)
{
}
}
private void SplashScreenSystemX_FormClosed(object sender, FormClosedEventArgs e)
{
Stop = true;
}
}
}