private void LoadSettings() { Debug.Print("LoadSettings"); App.ReadSettingsFromDisk(); this.Location = App.Settings.WindowLocation; if (!App.Settings.WindowSize.IsEmpty) this.Size = App.Settings.WindowSize; if (App.Settings.WindowState != FormWindowState.Minimized) this.WindowState = App.Settings.WindowState; if (App.Settings.SearchPhrasesHeight != 0) panelSearchPhrases.Height = App.Settings.SearchPhrasesHeight; if (App.Settings.SearchDirectoriesHeight != 0) panelSearchDirectories.Height = App.Settings.SearchDirectoriesHeight; if (App.Settings.SearchFilesHeight != 0) panelSearchFiles.Height = App.Settings.SearchFilesHeight; if (App.Settings.SearchAttributesWidth != 0) panelSearchAttributes.Width = App.Settings.SearchAttributesWidth; if (App.Settings.FilesListHeight != 0) panelFilesList.Height = App.Settings.FilesListHeight; if (App.Settings.FilesColumnWidth != 0) { ColumnFile.Width = App.Settings.FilesColumnWidth; } tabControlSearchPages.TabPages.Clear(); if (App.Settings.SearchInstances.Capacity == 0) { AddNewTab(null); } else { foreach (SearchInstance s in App.Settings.SearchInstances) { TabPage t = new TabPage(s.Name); t.Tag = s; tabControlSearchPages.TabPages.Add(t); } } tabControlSearchPages.TabPages.Add("*"); activeSearch = App.Settings.SearchInstances[0]; LoadActiveSearch(); }
private void DeleteActiveSearch() { if (activeSearch != null) { App.Settings.SearchInstances.Remove(activeSearch); activeSearch = null; tabControlSearchPages.TabPages.Remove(tabControlSearchPages.SelectedTab); if (App.Settings.SearchInstances.Capacity == 0) { AddNewTab(null); } } }
private void AddNewTab(TabPage tabPage, SearchInstance copyFrom = null) { SearchInstance s = new SearchInstance(); if (copyFrom == null) { s.Name = "[New Search]"; } else { s.Name = copyFrom.Name; foreach (SearchPhrase phrase in copyFrom.SearchPhrases) { s.SearchPhrases.Add(new SearchPhrase(phrase.Phrase, phrase.Highlight)); } foreach (string directory in copyFrom.SearchDirectories) { s.SearchDirectories.Add(directory); } foreach (string file in copyFrom.SearchFiles) { s.SearchFiles.Add(file); } } App.Settings.SearchInstances.Add(s); TabPage t = tabPage == null ? new TabPage() : tabPage; t.Tag = s; t.Text = s.Name; if (tabPage == null) { tabControlSearchPages.TabPages.Add(t); } else { tabControlSearchPages.TabPages.Add("*"); } }
private void tabControlSearchPages_Selected(object sender, TabControlEventArgs e) { if (tabControlSearchPages.SelectedIndex > -1) { if (tabControlSearchPages.SelectedTab.Tag == null) { AddNewTab(tabControlSearchPages.SelectedTab); } activeSearch = App.Settings.SearchInstances[tabControlSearchPages.SelectedIndex]; LoadActiveSearch(); } }
internal void CompleteSearch(SearchInstance searchInstance) { if (activeSearch == searchInstance) { AddFoundFiles(); toolStripButtonStartSearch.Enabled = true; toolStripButtonStopSearch.Enabled = false; statusLabelSearchProgress.Text = TimeSpanToShortString(searchInstance.Duration); statusProgressBar.Value = 0; } }
private void StatusUpdate(SearchInstance searchInstance, string path, int percentageComplete) { if (searchInstance == activeSearch) { statusLabelSearchProgress.Text = "Searching " + path; if (percentageComplete != -1) { statusProgressBar.Value = percentageComplete; } } }