Browse Source

Add option to not reload assemblies

pull/1409/head
Edward Cooke 8 years ago
parent
commit
660d8ca17a
  1. 17
      ILSpy/MainWindow.xaml.cs
  2. 14
      ILSpy/Options/MiscSettings.cs
  3. 1
      ILSpy/Options/MiscSettingsPanel.xaml
  4. 3
      ILSpy/Options/MiscSettingsPanel.xaml.cs

17
ILSpy/MainWindow.xaml.cs

@ -362,15 +362,22 @@ namespace ICSharpCode.ILSpy
{ {
ILSpySettings spySettings = this.spySettings; ILSpySettings spySettings = this.spySettings;
this.spySettings = null; this.spySettings = null;
var loadPreviousAssemblies = Options.MiscSettingsPanel.CurrentMiscSettings.LoadPreviousAssemblies;
// Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff. if (loadPreviousAssemblies) {
// This makes the UI come up a bit faster. // Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff.
this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList); // This makes the UI come up a bit faster.
this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
} else {
this.assemblyList = new AssemblyList(AssemblyListManager.DefaultListName);
assemblyListManager.ClearAll();
}
HandleCommandLineArguments(App.CommandLineArguments); HandleCommandLineArguments(App.CommandLineArguments);
if (assemblyList.GetAssemblies().Length == 0 if (assemblyList.GetAssemblies().Length == 0
&& assemblyList.ListName == AssemblyListManager.DefaultListName) { && assemblyList.ListName == AssemblyListManager.DefaultListName
&& loadPreviousAssemblies) {
LoadInitialAssemblies(); LoadInitialAssemblies();
} }
@ -731,7 +738,7 @@ namespace ICSharpCode.ILSpy
OpenFiles(dlg.FileNames); OpenFiles(dlg.FileNames);
} }
} }
public void OpenFiles(string[] fileNames, bool focusNode = true) public void OpenFiles(string[] fileNames, bool focusNode = true)
{ {
if (fileNames == null) if (fileNames == null)

14
ILSpy/Options/MiscSettings.cs

@ -24,6 +24,7 @@ namespace ICSharpCode.ILSpy.Options
public class MiscSettings : INotifyPropertyChanged public class MiscSettings : INotifyPropertyChanged
{ {
bool allowMultipleInstances; bool allowMultipleInstances;
bool loadPreviousAssemblies;
/// <summary> /// <summary>
/// Allow multiple instances. /// Allow multiple instances.
@ -39,6 +40,19 @@ namespace ICSharpCode.ILSpy.Options
} }
} }
/// <summary>
/// Load assemblies that were loaded in the previous instance
/// </summary>
public bool LoadPreviousAssemblies {
get { return loadPreviousAssemblies; }
set {
if (loadPreviousAssemblies != value) {
loadPreviousAssemblies = value;
OnPropertyChanged();
}
}
}
#region INotifyPropertyChanged Implementation #region INotifyPropertyChanged Implementation
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

1
ILSpy/Options/MiscSettingsPanel.xaml

@ -7,5 +7,6 @@
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<StackPanel Margin="10"> <StackPanel Margin="10">
<CheckBox IsChecked="{Binding AllowMultipleInstances}">Allow multiple instances</CheckBox> <CheckBox IsChecked="{Binding AllowMultipleInstances}">Allow multiple instances</CheckBox>
<CheckBox IsChecked="{Binding LoadPreviousAssemblies}">Load assemblies that were loaded in the last instance.</CheckBox>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

3
ILSpy/Options/MiscSettingsPanel.xaml.cs

@ -50,6 +50,8 @@ namespace ICSharpCode.ILSpy.Options
XElement e = settings["MiscSettings"]; XElement e = settings["MiscSettings"];
var s = new MiscSettings(); var s = new MiscSettings();
s.AllowMultipleInstances = (bool?)e.Attribute("AllowMultipleInstances") ?? false; s.AllowMultipleInstances = (bool?)e.Attribute("AllowMultipleInstances") ?? false;
s.LoadPreviousAssemblies = (bool?)e.Attribute(nameof(s.LoadPreviousAssemblies)) ?? true;
return s; return s;
} }
@ -59,6 +61,7 @@ namespace ICSharpCode.ILSpy.Options
var section = new XElement("MiscSettings"); var section = new XElement("MiscSettings");
section.SetAttributeValue("AllowMultipleInstances", s.AllowMultipleInstances); section.SetAttributeValue("AllowMultipleInstances", s.AllowMultipleInstances);
section.SetAttributeValue(nameof(s.LoadPreviousAssemblies), s.LoadPreviousAssemblies);
XElement existingElement = root.Element("MiscSettings"); XElement existingElement = root.Element("MiscSettings");
if (existingElement != null) if (existingElement != null)

Loading…
Cancel
Save