private void WorkerSearch_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { SearchEventArgs sea = (SearchEventArgs)e.Result; List <LogPos> searchResult = streamingFactory.GetSearchResult(sea); if (searchResult != null && searchResult.Count > 0) { TabPage tp = new TabPage(); LogListControl llc = new LogListControl(); tp.Controls.Add(llc); llc.Dock = DockStyle.Fill; llc.DoubleClickListView += LogListControlMain_DoubleClickListView; llc.Follow = logListControlMain.Follow; tp.Name = "tabPageSearchResult"; tp.Padding = new System.Windows.Forms.Padding(3); tp.Text = "Search Result"; tp.UseVisualStyleBackColor = true; tabControlMain.TabPages.Add(tp); tabControlMain.SelectedTab = tp; llc.SetStreamingFactory(streamingFactory, sea); } logListControlMain.Enabled = true; foreach (TabPage tp in tabControlMain.TabPages) { tp.Controls[0].Enabled = true; } this.Cursor = Cursors.Default; }
public MainForm() { InitializeComponent(); selectedLogListControl = logListControlMain; this.Size = new Size(1600, 800); streamingFactory = new StreamingFactory(); selectedLogListControl.SetStreamingFactory(streamingFactory, null); streamingFactory.IsInconsistent += StreamingFactory_IsInConsistent; currentMainForm = this; workerIndex = new BackgroundWorker(); workerIndex.WorkerReportsProgress = true; workerIndex.WorkerSupportsCancellation = true; workerIndex.ProgressChanged += WorkerIndex_ProgressChanged; workerIndex.DoWork += WorkerIndex_DoWork; workerIndex.RunWorkerCompleted += WorkerIndex_RunWorkerCompleted; workerSearch = new BackgroundWorker(); workerSearch.WorkerReportsProgress = true; workerSearch.WorkerSupportsCancellation = true; workerSearch.ProgressChanged += WorkerSearch_ProgressChanged; workerSearch.DoWork += WorkerSearch_DoWork; workerSearch.RunWorkerCompleted += WorkerSearch_RunWorkerCompleted; timerNewLogFilesAdded = new System.Windows.Forms.Timer(); timerNewLogFilesAdded.Interval = 500; timerNewLogFilesAdded.Enabled = false; timerNewLogFilesAdded.Tick += TimerNewLogFilesAdded_Tick; }
private void SelectedIndexChanged(LogListControl listViewLog) { if (listViewLog.SelectedIndex >= 0) { int index = listViewLog.SelectedIndex; if (infoControl != null) { long selectedLine = LoglineObject.InfoTextFromLine(streamingFactory, index, infoControl.InfoTextBox); infoControl.Tag = selectedLine; if (!isFromSearchControl) { this.searchControlMain.SelectedLine = (int)selectedLine; this.searchControlMain.SelectedTimestamp = streamingFactory.PositionList[index].TimeStamp; } } } }
private void LogListControlMain_DoubleClickListView(object sender, ListViewControlEventArgs e) { LogListControl llc = sender as LogListControl; Follow = false; if (e.SearchEventArgs != null) { LogPos lp = llc.SelectedLogPos; if (lp != null) { JumpToLine((int)lp.Order); } } if (e.Bookmark) { TabPage oldPage = tabPageInfo; TabPage selectedPage = AddInfoTabPage(llc.SelectedIndex); if (oldPage != tabPageInfo && oldPage != null) { oldPage.Text = $"Bookmark {llc.SelectedIndex:n0}"; LoglineInfoControl llic = (LoglineInfoControl)oldPage.Controls[0]; llic.SelectedLine = llc.SelectedIndex; llic.DoubleClickTextBox += InfoControl_DoubleClickTextBox; tabControlMain.SelectedTab = oldPage; } else { tabControlMain.SelectedTab = selectedPage; } } else { tabControlMain.SelectedTab = tabPageInfo; } }