protected override void Init() { int index = (int)Math.Ceiling(All.Class.Num.GetRandom(0.001f, flushlist.Length - 1)) - 1; All.Class.Reflex <Player.FlushMethod> r = new Class.Reflex <Player.FlushMethod>("All", string.Format("All.Control.Player.{0}", (FlushList)Enum.Parse(typeof(FlushList), flushlist.GetValue(index).ToString()))); f = (Player.FlushMethod)r.Get(); f.Init(Hwnd, Pic1, Pic2, Back, DelayTime, TickTime); f.FlushOver += f_FlushOver; }
/// <summary> /// 从xml中解析出设备,并初始化设备 /// </summary> /// <param name="buff">xml字符</param> /// <returns></returns> public static Meter Parse(Dictionary <string, string> buff) { if (!buff.ContainsKey("Class")) { All.Class.Error.Add("初始化通讯错误,初始化字符串不包含反射类", Environment.StackTrace); return(null); } All.Class.Reflex <Meter> tmpReflex = new Class.Reflex <Meter>("All", buff["Class"]); Meter result = (Meter)tmpReflex.Get(); if (result == null) { All.Class.Error.Add(string.Format("从命令空间反射类失败,请检查反射名称:{0}是否正确", buff["Class"])); return(null); } result.InitParm = buff; return(result); }
/// <summary> /// 从xml中解析出通讯类 /// </summary> /// <param name="buff"></param> /// <returns></returns> public static Communicate Parse(Dictionary <string, string> buff) { if (!buff.ContainsKey("Class")) { All.Class.Error.Add("初始化通讯错误,初始化字符串不包含反射类", Environment.StackTrace); return(null); } All.Class.Reflex <Communicate> tmpReflex = new Class.Reflex <Communicate>("All", buff["Class"]); Communicate result = (Communicate)tmpReflex.Get(); if (result == null) { All.Class.Error.Add(string.Format("从命令空间反射类失败,请检查反射名称:{0}是否正确", buff["Class"])); return(null); } result.Init(buff); if (!buff.ContainsKey("Run") || buff["Run"].ToBool()) { result.Open(); } return(result); }
/// <summary> /// 设置图片 /// </summary> /// <returns></returns> private bool SetPic() { bool result = false; if (backImage == null) { backImage = new Bitmap(Width, Height); } if (filePath == null || filePath.Count <= 0)//无图片,则显示背景色 { using (Graphics g = Graphics.FromImage(backImage)) { g.Clear(BackColor); } this.Invalidate(); if (PlayOver != null) { PlayOver(); } return(false); } else if (filePath.Count == 1)//单张图片,直接显示图片 { using (Graphics g = Graphics.FromImage(backImage)) { g.SmoothingMode = SmoothingMode.HighQuality; g.CompositingQuality = CompositingQuality.HighQuality; g.DrawImage(filePath[0], new Rectangle(0, 0, Width, Height), new Rectangle(0, 0, filePath[0].Width, filePath[0].Height), GraphicsUnit.Pixel); if (PlayOver != null) { PlayOver(); return(false); } } } else if (filePath.Count >= 2)//多张图片,开始轮播 { picPlayIndex++; if (picPlayIndex == filePath.Count) { if (PlayOver != null) { PlayOver(); return(false); } } picPlayIndex = (picPlayIndex % filePath.Count); Image1 = filePath[picPlayIndex]; int tmpPicPlayIndex = picPlayIndex; tmpPicPlayIndex++; tmpPicPlayIndex = (tmpPicPlayIndex % filePath.Count); Image2 = filePath[tmpPicPlayIndex]; if (flushMethod != null) { flushMethod.FlushOver -= flushMethod_FlushOver; flushMethod = null; } All.Class.Reflex <Player.FlushMethod> r = new Class.Reflex <Player.FlushMethod>("All", string.Format("All.Control.Player.{0}", flushList)); flushMethod = (Player.FlushMethod)r.Get(); flushMethod.Init(this.Handle, Image1, Image2, backImage, changeTime, TickTime); flushMethod.FlushOver += flushMethod_FlushOver; result = true; } this.Invalidate(); return(result); }