Example #1
0
 public void UpdateDestinationLine(string executionNodeID, string uuid, int messagesSent, int messageFail, HubCallerContext context, bool forceUpdate = false)
 {
     if (clientControls.ContainsKey(context.ConnectionId))
     {
         try {
             Application.Current.Dispatcher.Invoke(delegate {
                 ExecutionRecordClass r = View.RecordsCollection.FirstOrDefault <ExecutionRecordClass>(record => record.ExecutionLineID == uuid);
                 if (r != null)
                 {
                     r.Sent = messagesSent;
                     r.Fail = messageFail;
                     if (this.gridRefreshRate == 0 || forceUpdate)
                     {
                         View.VisibleDataGrid?.Items.Refresh();
                     }
                 }
             });
         } catch (Exception ex) {
             Debug.WriteLine(ex.Message);
         }
     }
 }
Example #2
0
        public void AddUpdateExecutionRecord(ExecutionRecordClass rec)
        {
            try {
                Application.Current.Dispatcher.Invoke(delegate {
                    ExecutionRecordClass r = RecordsCollection.FirstOrDefault <ExecutionRecordClass>(record => record.ExecutionLineID == rec.ExecutionLineID);

                    if (r != null)
                    {
                        r.MM   = rec.MM;
                        r.Sent = rec.Sent;
                        r.Name = rec.Name;
                        r.Type = rec.Type;
                        OnPropertyChanged("RecordsCollection");
                    }
                    else
                    {
                        RecordsCollection.Add(rec);
                        OnPropertyChanged("RecordsCollection");
                    }
                });
            } catch (Exception ex) {
                Console.WriteLine("Unmanaged error.   " + ex.Message);
            }
        }
Example #3
0
        public void InterrogateResponse(string processID, string ipAddress, string osversion, string xml, string status, string archName, int duration, HubCallerContext context)
        {
            if (!clientControls.ContainsKey(context.ConnectionId))
            {
                try {
                    Application.Current.Dispatcher.Invoke((Action) delegate {
                        ClientControl cl = new ClientControl(context.ConnectionId, MessageHub, this)
                        {
                            StatusText = status
                        };
                        if (clientControls.ContainsKey(context.ConnectionId))
                        {
                            clientControls[context.ConnectionId] = cl;
                        }
                        else
                        {
                            clientControls.Add(context.ConnectionId, cl);
                        }

                        ClientTabControl tabControl = new ClientTabControl($"PID:{processID}", this)
                        {
                            IsSummary = false, ConnectionID = context.ConnectionId
                        };

                        if (clientTabControls.ContainsKey(context.ConnectionId))
                        {
                            clientTabControls[context.ConnectionId] = tabControl;
                        }
                        else
                        {
                            clientTabControls.Add(context.ConnectionId, tabControl);
                        }
                        View.AddClientControl(cl);
                        View.AddClientTab(tabControl);
                    });
                } catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }

            ClientControl    client            = clientControls[context.ConnectionId];
            ClientTabControl clientTabControl  = clientTabControls[context.ConnectionId];
            ClientTabControl summaryTabControl = clientTabControls["summary"];

            clientTabControl.Header      = $"PID:{processID}";
            clientTabControl.IP          = ipAddress;
            clientTabControl.ProcessID   = processID;
            clientTabControl.OSVersion   = osversion;
            clientTabControl.StatusText  = status;
            clientTabControl.XML         = xml;
            clientTabControl.WorkPackage = archName;

            client.IP         = ipAddress;
            client.ProcessID  = processID;
            client.OSVersion  = osversion;
            client.StatusText = status;
            client.XML        = xml;
            client.duration   = duration;

            if (xml != null)
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);

                try {
                    foreach (XmlNode node in doc.SelectNodes(".//*"))
                    {
                        if (node.Name == "destination")
                        {
                            ExecutionRecordClass rec = new ExecutionRecordClass()
                            {
                                IP                = ipAddress,
                                ProcessID         = processID,
                                Type              = "Destination",
                                Name              = node.Attributes["name"]?.Value,
                                ConfigMM          = node.Attributes["messagesPerMinute"]?.Value,
                                MM                = "-",
                                ExecutionLineID   = node.Attributes["uuid"]?.Value,
                                ExecutionNodeID   = node.Attributes["executionNodeUuid"]?.Value,
                                SourceDestination = "Destination",
                                Protocol          = node.Attributes["protocol"]?.Value,
                                ConnectionID      = context.ConnectionId
                            };

                            View.AddUpdateExecutionRecord(rec);
                            client.ExecutionNodeID           = rec.ExecutionNodeID;
                            clientTabControl.ExecutionNodeID = rec.ExecutionNodeID;
                            clientTabControl.AddUpdateExecutionRecord(rec);
                            summaryTabControl.AddUpdateExecutionRecord(rec);
                        }
                        if (node.Name == "ratedriven")
                        {
                            ExecutionRecordClass rec = new ExecutionRecordClass()
                            {
                                IP                = ipAddress,
                                ProcessID         = processID,
                                Type              = "Rate Driven Source",
                                Name              = node.Attributes["name"]?.Value,
                                ConfigMM          = node.Attributes["messagesPerMinute"]?.Value,
                                MM                = "-",
                                ExecutionLineID   = node.Attributes["uuid"]?.Value,
                                ExecutionNodeID   = node.Attributes["executionNodeUuid"]?.Value,
                                SourceDestination = "Rate Driven Source",
                                Protocol          = node.Attributes["dataSource"]?.Value,
                                ConnectionID      = context.ConnectionId
                            };

                            View.AddUpdateExecutionRecord(rec);
                            client.ExecutionNodeID           = rec.ExecutionNodeID;
                            clientTabControl.ExecutionNodeID = rec.ExecutionNodeID;
                            clientTabControl.AddUpdateExecutionRecord(rec);
                            summaryTabControl.AddUpdateExecutionRecord(rec);
                        }
                        if (node.Name.Contains("datadriven"))
                        {
                            ExecutionRecordClass rec = new ExecutionRecordClass()
                            {
                                IP                = ipAddress,
                                ProcessID         = processID,
                                Type              = "Data Driven Source",
                                Name              = node.Attributes["name"]?.Value,
                                ConfigMM          = "-",
                                MM                = "-",
                                ExecutionLineID   = node.Attributes["uuid"]?.Value,
                                ExecutionNodeID   = node.Attributes["executionNodeUuid"]?.Value,
                                SourceDestination = "Data Driven Source",
                                Protocol          = "Data Driven Source",
                                ConnectionID      = context.ConnectionId
                            };

                            if (node.Name.Contains("csvdatadriven"))
                            {
                                rec.Protocol = "CSV Data Driven";
                            }
                            if (node.Name.Contains("jsondatadriven"))
                            {
                                rec.Protocol = "JSON Data Driven";
                            }
                            if (node.Name.Contains("xmldatadriven"))
                            {
                                rec.Protocol = "XML Data Driven";
                            }
                            if (node.Name.Contains("exceldatadriven"))
                            {
                                rec.Protocol = "Excel Data Driven";
                            }
                            if (node.Name.Contains("databasedatadriven"))
                            {
                                rec.Protocol = "Data Base Data Driven";
                            }

                            View.AddUpdateExecutionRecord(rec);
                            client.ExecutionNodeID           = rec.ExecutionNodeID;
                            clientTabControl.ExecutionNodeID = rec.ExecutionNodeID;
                            clientTabControl.AddUpdateExecutionRecord(rec);
                            summaryTabControl.AddUpdateExecutionRecord(rec);
                        }
                        if (node.Name.Contains("chain"))
                        {
                            ExecutionRecordClass rec = new ExecutionRecordClass()
                            {
                                IP                = ipAddress,
                                ProcessID         = processID,
                                Type              = "Chained Source",
                                Name              = node.Attributes["name"]?.Value,
                                ConfigMM          = "-",
                                MM                = "-",
                                ExecutionLineID   = node.Attributes["uuid"]?.Value,
                                ExecutionNodeID   = node.Attributes["executionNodeUuid"]?.Value,
                                SourceDestination = "Chained Source",
                                ConnectionID      = context.ConnectionId
                            };

                            View.AddUpdateExecutionRecord(rec);
                            client.ExecutionNodeID           = rec.ExecutionNodeID;
                            clientTabControl.ExecutionNodeID = rec.ExecutionNodeID;
                            clientTabControl.AddUpdateExecutionRecord(rec);
                            summaryTabControl.AddUpdateExecutionRecord(rec);
                        }
                    }
                } catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }

            clientTabControl.OnPropertyChanged("Title");
        }