Example #1
0
        private void LogEvent(object source, EventArgs e)
        {
            if (logMonitor.LastScanValid)
            {
                ScanReader scan = new ScanReader(logMonitor);

                if (scan.IsInteresting())
                {
                    Invoke((MethodInvoker) delegate()
                    {
                        listEvent.BeginUpdate();
                        if (!logMonitor.ReadAllInProgress)
                        {
                            RemoveUninteresting();
                        }

                        foreach (var item in scan.Interest)
                        {
                            AddListItem(item);
                        }

                        if (!logMonitor.ReadAllInProgress && scan.Interest.Count > 0)
                        {
                            AnnounceItems(logMonitor.CurrentSystem, scan.Interest);
                        }
                        listEvent.EndUpdate();
                    });
                }
                else if (!logMonitor.ReadAllInProgress)
                {
                    ListViewItem newItem = new ListViewItem(new string[] { scan.Interest[0].BodyName, "Uninteresting", logMonitor.LastScan.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"), string.Empty, string.Empty })
                    {
                        UseItemStyleForSubItems = false
                    };

                    Invoke((MethodInvoker) delegate()
                    {
                        listEvent.BeginUpdate();
                        RemoveUninteresting();
                        newItem.SubItems[0].ForeColor = Color.DarkGray;
                        newItem.SubItems[1].ForeColor = Color.DarkGray;
                        newItem.SubItems[2].ForeColor = Color.DarkGray;
                        listEvent.Items.Add(newItem).EnsureVisible();
                        listEvent.EndUpdate();
                    });
                }
            }
        }
Example #2
0
        private void LogEvent(object source, EventArgs e)
        {
            if (logMonitor.LastScanValid)
            {
                ScanReader scan = new ScanReader(logMonitor);

                if (scan.IsInteresting())
                {
                    Invoke((MethodInvoker) delegate()
                    {
                        if (!logMonitor.ReadAllInProgress)
                        {
                            RemoveUninteresting();
                        }

                        foreach (var item in scan.Interest)
                        {
                            AddListItem(item);
                        }

                        if (!logMonitor.ReadAllInProgress && scan.Interest.Count > 0)
                        {
                            AnnounceItems(logMonitor.CurrentSystem, scan.Interest);
                        }
                    });
                }
                else if (!logMonitor.ReadAllInProgress)
                {
                    ListViewItem newItem = new ListViewItem(new string[] { scan.Interest[0].BodyName, "Uninteresting", logMonitor.LastScan.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"), string.Empty, string.Empty })
                    {
                        UseItemStyleForSubItems = false
                    };

                    Invoke((MethodInvoker) delegate()
                    {
                        listEvent.BeginUpdate();
                        RemoveUninteresting();
                        newItem.SubItems[0].ForeColor = Color.DarkGray;
                        newItem.SubItems[1].ForeColor = Color.DarkGray;
                        newItem.SubItems[2].ForeColor = Color.DarkGray;
                        listEvent.Items.Add(newItem).EnsureVisible();
                        listEvent.EndUpdate();
                    });
                }
            }
            else if (logMonitor.LastCodexValid)
            {
                CodexReader.ProcessCodex(logMonitor.LastCodex);

                if (Properties.Observatory.Default.IncludeCodex)
                {
                    Invoke((MethodInvoker) delegate()
                    {
                        string location;
                        listEvent.BeginUpdate();

                        if (logMonitor.LastCodex.Category != "$Codex_Category_StellarBodies;" && logMonitor.LastCodex.NearestDestinationLocalised?.Length > 0 && logMonitor.LastCodex.Body?.Length > 0)
                        {
                            location = logMonitor.LastCodex.Body;
                        }
                        else
                        {
                            location = logMonitor.LastCodex.System;
                        }

                        ListViewItem newItem = new ListViewItem(new string[] { location, logMonitor.LastCodex.NearestDestinationLocalised?.Length > 0 ? logMonitor.LastCodex.NearestDestinationLocalised : "Codex Entry", logMonitor.LastCodex.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"), logMonitor.LastCodex.NameLocalised, string.Empty });
                        listEvent.Items.Add(newItem).EnsureVisible();
                        listEvent.EndUpdate();
                    });
                }
            }
        }