Exemple #1
0
 private void OnUserDataOutgoing(object sender, UserDataOutgoingEventArgs args)
 {
     try
     {
         _productCache.AddTail(args);
     }
     catch (System.Exception)
     {
     }
 }
Exemple #2
0
        private void NotityfyOutgoingUserDataEvent(OutgoingPackage package)
        {
            if (this.UserDataOutgoing != null)
            {
                var args = new UserDataOutgoingEventArgs(package);

                this.UserDataOutgoing.GetInvocationList().ToList().ForEach(handler =>
                {
                    try
                    {
                        handler.DynamicInvoke(null, args);
                    }
                    catch (System.Exception)
                    {
                    }
                });
            }
        }
Exemple #3
0
        private void ShowOutgoingUserDataEvent(UserDataOutgoingEventArgs args)
        {
            try
            {
                if (this.OutgoingStreamVisable)
                {
                    this.Invoke(new Action(() =>
                    {
                        #region "当前选择的设备是否为指定的目标设备之一"
                        bool selected = false;

                        foreach (var item in args.Package.DestID)
                        {
                            var fixedName = this.DecorateDeviceID(item);
                            selected      = (_selectedDeviceName.CompareTo(fixedName) == 0);

                            if (selected)
                            {
                                break;
                            }
                        }
                        #endregion

                        if (selected && _filterControl.Filter(args.Package.UserData))
                        {
                            // clear
                            if (treeViewDataSummary.Nodes.Count > 100)
                            {
                                treeViewDataSummary.Nodes.RemoveAt(0);
                            }

                            // add
                            var node = new TreeNode();
                            node.Tag = args;

                            // 获取自定义标签
                            if (UserDataResolver != null)
                            {
                                node.Text = string.Format("{0},{1}",
                                                          UserDataResolver.GetLabel(args.Package.UserData, false),
                                                          DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                            }
                            else
                            {
                                node.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
                            }

                            node.ForeColor = Color.Blue;

                            // set node image.
                            node.ImageKey         = "OutputStream";
                            node.SelectedImageKey = node.ImageKey;

                            // Add Node
                            treeViewDataSummary.Nodes.Add(node);
                        }
                    }));
                }
            }
            catch (System.Exception ex)
            {
                this.ShowLog(ex.Message);
            }
        }