123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using IntelligentControlForsx.MyControls;
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Threading;
- namespace IntelligentControlForsx.Code
- {
- public static class LableMessage
- {
- readonly static ConcurrentDictionary<string, WebfontLable> Labels = new ConcurrentDictionary<string, WebfontLable>();
- public static void AddLabel(WebfontLable lable)
- {
- Labels.TryAdd(lable.Name,lable);
- }
- public static void DeleteLabel(WebfontLable lable)
- {
- Labels.TryRemove(lable.Name,out lable);
- }
- public static void SetLabelTest()
- {
- Thread T = new Thread(SetLabelText);
- T.IsBackground = true;
- T.Start();
- }
- public static void SetLabelText()
- {
- while (true)
- {
- Console.WriteLine(Labels.Count);
- foreach (WebfontLable l in Labels.Values)
- {
- if (CommunalTarget.UdpDoubleMemory.ContainsKey(l.TestPointId))
- {
- Action action1 = () =>
- {
- l.LableText = CommunalTarget.UdpDoubleMemory[l.TestPointId].ToString("F2");
- };
- if (l.IsHandleCreated)
- l.Invoke(action1);
-
- }
- }
- }
- }
- }
- }
|