示例#1
0
        private void logWatcherLocal_ProcessNewData(object sender, ProcessNewDataEventArgs e)
        {
            string currentSystemName = null;

            foreach (string line in e.Lines)
            {
                int index = line.IndexOf("Channel changed to Local", StringComparison.OrdinalIgnoreCase);
                if (index != -1)
                {
                    index             = line.TrimEnd().LastIndexOf(' ');
                    currentSystemName = line.Substring(index + 1);
                }
            }
            if (currentSystemName != null)
            {
                IQueryable <SolarSystem> q = from o in DbHelper.DataContext.SolarSystems
                                             where o.SolarSystemName == currentSystemName
                                             select o;

                SolarSystem solarSystem = q.FirstOrDefault();
                if (solarSystem != null)
                {
                    Settings.Default.currentSystemId = solarSystem.Id;
                    map.CurrentSystemName            = solarSystem.SolarSystemName;
                    _ComboBoxSystemsSetValue         = true;
                    comboBoxSystems.SelectedItem     = solarSystem;
                    _ComboBoxSystemsSetValue         = false;
                }
            }
        }
示例#2
0
        private void logWatcherIntel_ProcessNewData(object sender, ProcessNewDataEventArgs e)
        {
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork             += WorkerOnDoWork;
            worker.RunWorkerCompleted += (o, args) => {
                dataGridIntel.Refresh();
                dataGridIntel.ClearSelection();
                DataGridViewRow row = dataGridIntel.Rows.OfType <DataGridViewRow>().LastOrDefault();
                if (row != null)
                {
                    row.Selected = true;
                    dataGridIntel.FirstDisplayedScrollingRowIndex = row.Index;
                }
                List <string> result = (List <string>)args.Result;
                DateTime      now    = DateTime.Now;
                foreach (string item in result)
                {
                    map.RedInfo[item] = now;
                }
                map.UpdateNodes();
            };
            worker.RunWorkerAsync(new LogWatcherIntelProcessNewDataArg {
                Lines = e.Lines,
                Logs  = _CitadelLogs
            });
        }