Browse Source

Fix #347 - Add a Reset button to the "Open List"

pull/863/head
Siegfried Pammer 8 years ago
parent
commit
2e09b506b2
  1. 14
      ILSpy/AssemblyListManager.cs
  2. 5
      ILSpy/OpenListDialog.xaml
  3. 10
      ILSpy/OpenListDialog.xaml.cs

14
ILSpy/AssemblyListManager.cs

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Xml.Linq;
@ -123,5 +124,18 @@ namespace ICSharpCode.ILSpy @@ -123,5 +124,18 @@ namespace ICSharpCode.ILSpy
}
return false;
}
public void ClearAll()
{
AssemblyLists.Clear();
ILSpySettings.Update(
delegate (XElement root) {
XElement doc = root.Element("AssemblyLists");
if (doc == null) {
return;
}
doc.Remove();
});
}
}
}

5
ILSpy/OpenListDialog.xaml

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
Style="{DynamicResource DialogWindow}"
WindowStartupLocation="CenterOwner"
ResizeMode="CanResizeWithGrip"
MinWidth="380"
MinWidth="480"
MinHeight="250"
Height="350"
Width="380"
Width="480"
FocusManager.FocusedElement="{Binding ElementName=listView}">
<Grid Margin="12,8">
<Grid.RowDefinitions>
@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
<StackPanel DockPanel.Dock="Left" Orientation="Horizontal" HorizontalAlignment="Left">
<Button Margin="2,0" Click="CreateButton_Click">Create</Button>
<Button Margin="2,0" IsEnabled="False" Name="removeButton" Click="RemoveButton_Click">Remove</Button>
<Button Margin="2,0" Click="ResetButton_Click">Reset</Button>
</StackPanel>
</DockPanel>
</Grid>

10
ILSpy/OpenListDialog.xaml.cs

@ -172,7 +172,6 @@ namespace ICSharpCode.ILSpy @@ -172,7 +172,6 @@ namespace ICSharpCode.ILSpy
{
manager.CreateList(new AssemblyList(dlg.NewListName));
}
}
private void RemoveButton_Click(object sender, RoutedEventArgs e)
@ -181,6 +180,15 @@ namespace ICSharpCode.ILSpy @@ -181,6 +180,15 @@ namespace ICSharpCode.ILSpy
manager.DeleteList(listView.SelectedItem.ToString());
}
private void ResetButton_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show(this, "Are you sure that you want to remove all assembly lists and recreate the default assembly lists?",
"ILSpy", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No, MessageBoxOptions.None) != MessageBoxResult.Yes)
return;
manager.ClearAll();
CreateDefaultAssemblyLists();
}
private void listView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left && listView.SelectedItem != null)

Loading…
Cancel
Save