Пример #1
0
 internal void AddEventPublish(PublishEventArgs args)
 {
     if (args == null)
     {
         return;
     }
     if (args.EventAttachInfo == null && args.GetParams().Count == 0) //主要为事件通知  延迟执行
     {
         publisEvents3.Enqueue(args);
     }
     else
     {
         publisEvents.Enqueue(args);
     }
     //  return EventAggregator.EventPublish(args);
 }
Пример #2
0
        void Run3(object obj)
        {
            try
            {
                //int SingleInfoGroupAllNeedUpdate = 3100000 + 21 * 100 + 33;
                //bool has = false;
                while (publisEvents3.Count > 0)
                {
                    var dicexecd         = new Dictionary <Tuple <int, string>, bool>();
                    PublishEventArgs tmp = null;
                    if (publisEvents3.TryDequeue(out tmp))
                    {
                        //if (tmp.EventId == SingleInfoGroupAllNeedUpdate)
                        //{
                        //    if (has)
                        //        continue;
                        //    has = true;
                        //}

                        var tu = new Tuple <int, string>(tmp.EventId, tmp.EventType);
                        if (dicexecd.ContainsKey(tu))
                        {
                            continue;                           //执行过 就不再执行
                        }
                        dicexecd.Add(tu, true);

                        foreach (var f in Info)
                        {
                            if (f.Value.Item3(tmp))
                            {
                                _exEvent.Enqueue(
                                    new Tuple <Action <PublishEventArgs>, bool, PublishEventArgs>(f.Value.Item2,
                                                                                                  f.Value.Item4, tmp));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError("EventPublish Run Main Error:" + ex);
            }
        }
Пример #3
0
 void RunInUiThread(Action <PublishEventArgs> action, PublishEventArgs data)
 {
     Application.Current.Dispatcher.Invoke(
         System.Windows.Threading.DispatcherPriority.Normal, new DoTask(action), data);
 }