Example #1
0
        protected override void RunItem(NetworkMessageInfo message)
        {
            var test = NetworkMapService.GetNetworkMessagesBySourceLine(message.SourceItem);

            var targetPath           = string.Empty;
            var targetNetworkMessage = string.Empty;
            var targetDateTime       = new DateTime();
            var targetiLine          = 0;

            if (test.Targets.Count == 1)
            {
                targetPath           = test.Targets[0].Item.Source.FilePath;
                targetNetworkMessage = test.Targets[0].Item.Source.NetworkMessageName;
                targetDateTime       = test.Targets[0].Item.Source.DateTime;
                targetiLine          = test.Targets[0].Item.Source.iLine;
            }

            var item = new NetworkReportItem
            {
                SourceNode           = message.Source.Node,
                SourcePath           = SourcePath,
                SourceNetworkMessage = message.Source.NetworkMessageName,
                SourceiLine          = message.Source.iLine,
                SourceDateTime       = message.Source.DateTime,
                TargetNode           = test.Targets.Count == 1 ? test.Targets[0].Item.Source.Node : "",
                TargetPath           = targetPath,
                TargetNetworkMessage = targetNetworkMessage,
                TargetiLine          = targetiLine,
                TargetDateTime       = targetDateTime,
                TargetMatches        = test.Targets.Count()
            };

            Report.Results.Add(item);

            lock (Report.Summary)
            {
                var summary = Report.Summary.SingleOrDefault(n => n.SourceNode == item.SourceNode &&
                                                             n.TargetNode == item.TargetNode);

                if (summary != null)
                {
                    summary.MessageCount++;
                }
                else
                {
                    Report.Summary.Add(new NetworkReportSummary
                    {
                        SourceNode   = item.SourceNode,
                        TargetNode   = item.TargetNode,
                        MessageCount = 1
                    });
                }
            }
        }
        /// <summary>
        /// Using the current selected LineFS, this method will get the Network Messages that Match
        /// </summary>
        public void GetCurrentLineNetworkMessages(Action <NetworkTargets> callback)
        {
            ThreadPool.QueueUserWorkItem(delegate
            {
                lock (this)
                {
                    var lineArgs      = MainViewModel.Current.CurrentLineArgs;
                    var sourceFile    = XmlDal.CacheModel.GetFile(lineArgs.Path);
                    var sourceMessage = sourceFile.GetNetworkMessage(lineArgs.iLine);
                    if (sourceMessage == null)
                    {
                        Log.WriteError("sourceMessage should never be null!", typeof(NetworkMapingViewModel).FullName, MethodBase.GetCurrentMethod().Name);
                        return;
                    }

                    lock (this)
                        lock (sourceMessage.InternalTargets)
                        {
                            if (sourceMessage.IsCached_Targets)
                            {
                                // The TargetsCached is True so we can simple call the method without showing a Status Message - Sara
                                callback(NetworkMapService.GetNetworkMessagesBySourceLine(lineArgs));
                                return;
                            }

                            try
                            {
                                View.StatusUpdate(StatusModel.StartBackground);
                                View.StatusUpdate(StatusModel.StartStopWatch);
                                View.StatusUpdate(StatusModel.Update(STATUS_TITLE,
                                                                     "Building Current LineFS Network Messages..."));

                                callback(NetworkMapService.GetNetworkMessagesBySourceLine(lineArgs));
                            }
                            finally
                            {
                                View.StatusUpdate(StatusModel.EndBackground);
                                View.StatusUpdate(StatusModel.Completed);
                            }
                        }
                }
            });
        }
Example #3
0
 public void GetNetworkMessages(Action <NetworkTargets> callback)
 {
     NetworkMapService.GetNetworkMessagesBySourceLine(MainViewModel.Current.CurrentLineArgs, callback);
 }