/// <summary> /// 刷新整个Led屏幕 /// 由于API不支持更新某个逻辑窗口,因此需要刷新整个屏幕:让未更新的窗口立即显示以前的内容,让其他窗口更新信息(动态效果) /// </summary> /// <param name="activeWindowId"></param> private void RefreshWholeScreen(int activeWindowId) { var win = windows[activeWindowId]; List<Window> wins = new List<Window>(); foreach (var w in windows.Values) { if (w.LedIndex == win.LedIndex) { wins.Add(w); } } LedAPI.User_DelAllProgram(win.LedIndex); var programId = LedAPI.User_AddProgram(win.LedIndex, true, 0); foreach (var w in wins) { var text = new User_Text(); if (w.Text == null) { text.chContent = null; } else { text.chContent = string.Join("\r\n", w.Text.ToArray()); } text.FontInfo = w.Font; text.MoveSet = w.Movement; if (w.Id != activeWindowId) { text.MoveSet.iActionType = 1; // 除了当前窗,其他窗的文字都马上出现 } else { if (text.MoveSet.iActionSpeed == 3) { var list = new List<string>(); var count = int.Parse(ConfigurationManager.AppSettings["SpaceCount"]); for (var i = 0; i < count; i++) { list.Add(" "); } text.chContent = string.Join(string.Join(string.Empty, list.ToArray()), w.Text.ToArray()); } } text.PartInfo = w.Frame; LedAPI.User_AddText(win.LedIndex, ref text, programId); } LedAPI.User_SendToScreen(win.LedIndex); }
public static extern int User_AddText(int CardNum, ref User_Text pText, int iProgramIndex);
/// <summary> /// 刷新整个Led屏幕 /// 由于API不支持更新某个逻辑窗口,因此需要刷新整个屏幕:让未更新的窗口立即显示以前的内容,让其他窗口更新信息(动态效果) /// </summary> /// <param name="activeWindowId"></param> private void RefreshWholeScreen(int activeWindowId) { return; var win = windows[activeWindowId]; var wins = windows.Values.Where(x=>x.LedIndex == win.LedIndex); LedAPI.User_DelAllProgram(win.LedIndex); var programId = LedAPI.User_AddProgram(win.LedIndex, true, 0); foreach(var w in wins) { var text = new User_Text(); text.chContent = w.Text; text.FontInfo = w.Font; text.MoveSet = w.Movement; if(w.Id != activeWindowId) text.MoveSet.iActionType = 1; // 除了当前窗,其他窗的文字都马上出现 text.PartInfo = w.Frame; LedAPI.User_AddText(win.LedIndex, ref text, programId); } LedAPI.User_SendToScreen(win.LedIndex); }