Browse Source

Persist selected search mode in SessionSettings.

pull/881/merge
Siegfried Pammer 8 years ago
parent
commit
37d29f4042
  1. 11
      ILSpy/SearchPane.cs
  2. 3
      ILSpy/SessionSettings.cs

11
ILSpy/SearchPane.cs

@ -61,7 +61,8 @@ namespace ICSharpCode.ILSpy @@ -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 @@ -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 @@ -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)

3
ILSpy/SessionSettings.cs

@ -55,6 +55,7 @@ namespace ICSharpCode.ILSpy @@ -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 @@ -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 @@ -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);
}

Loading…
Cancel
Save