diff --git a/ILSpy/SearchPane.cs b/ILSpy/SearchPane.cs index 850a30822..658400281 100644 --- a/ILSpy/SearchPane.cs +++ b/ILSpy/SearchPane.cs @@ -61,7 +61,8 @@ namespace ICSharpCode.ILSpy searchModeComboBox.Items.Add(new { Image = Images.Property, Name = "Property" }); searchModeComboBox.Items.Add(new { Image = Images.Event, Name = "Event" }); searchModeComboBox.Items.Add(new { Image = Images.Literal, Name = "Constant" }); - searchModeComboBox.SelectedIndex = (int)SearchMode.TypeAndMember; + searchModeComboBox.SelectedIndex = (int)MainWindow.Instance.SessionSettings.SelectedSearchMode; + searchModeComboBox.SelectionChanged += (sender, e) => MainWindow.Instance.SessionSettings.SelectedSearchMode = (SearchMode)searchModeComboBox.SelectedIndex; ContextMenuProvider.Add(listBox); MainWindow.Instance.CurrentAssemblyListChanged += MainWindow_Instance_CurrentAssemblyListChanged; @@ -168,10 +169,10 @@ namespace ICSharpCode.ILSpy } else if (e.Key == Key.M && e.KeyboardDevice.Modifiers == ModifierKeys.Control) { searchModeComboBox.SelectedIndex = (int)SearchMode.Member; e.Handled = true; - } /*else if (e.Key == Key.S && e.KeyboardDevice.Modifiers == ModifierKeys.Control) { + } else if (e.Key == Key.S && e.KeyboardDevice.Modifiers == ModifierKeys.Control) { searchModeComboBox.SelectedIndex = (int)SearchMode.Literal; e.Handled = true; - }*/ + } } void SearchBox_PreviewKeyDown(object sender, KeyEventArgs e) @@ -276,8 +277,8 @@ namespace ICSharpCode.ILSpy if (terms[0].StartsWith("e:", StringComparison.Ordinal)) return new MemberSearchStrategy(terms[0].Substring(2), MemberSearchKind.Event); - //if (terms[0].StartsWith("c:", StringComparison.Ordinal)) - // return new LiteralSearchStrategy(terms[0].Substring(2)); + if (terms[0].StartsWith("c:", StringComparison.Ordinal)) + return new LiteralSearchStrategy(terms[0].Substring(2)); } switch (mode) diff --git a/ILSpy/SessionSettings.cs b/ILSpy/SessionSettings.cs index 56a4490dd..30a26787f 100644 --- a/ILSpy/SessionSettings.cs +++ b/ILSpy/SessionSettings.cs @@ -55,6 +55,7 @@ namespace ICSharpCode.ILSpy this.SplitterPosition = FromString((string)doc.Element("SplitterPosition"), 0.4); this.TopPaneSplitterPosition = FromString((string)doc.Element("TopPaneSplitterPosition"), 0.3); this.BottomPaneSplitterPosition = FromString((string)doc.Element("BottomPaneSplitterPosition"), 0.3); + this.SelectedSearchMode = FromString((string)doc.Element("SelectedSearchMode"), SearchMode.TypeAndMember); } public event PropertyChangedEventHandler PropertyChanged; @@ -66,6 +67,7 @@ namespace ICSharpCode.ILSpy } public FilterSettings FilterSettings { get; private set; } + public SearchMode SelectedSearchMode { get; set; } public string[] ActiveTreeViewPath; public string ActiveAutoLoadedAssembly; @@ -99,6 +101,7 @@ namespace ICSharpCode.ILSpy doc.Add(new XElement("SplitterPosition", ToString(this.SplitterPosition))); doc.Add(new XElement("TopPaneSplitterPosition", ToString(this.TopPaneSplitterPosition))); doc.Add(new XElement("BottomPaneSplitterPosition", ToString(this.BottomPaneSplitterPosition))); + doc.Add(new XElement("SelectedSearchMode", ToString(this.SelectedSearchMode))); ILSpySettings.SaveSettings(doc); }