Browse Source

Added Create and Remove buttons for assembly lists.

Implemented Remove button.
pull/254/head
Dick van den Brink 15 years ago
parent
commit
06e6eaa767
  1. 30
      ILSpy/AssemblyListManager.cs
  2. 22
      ILSpy/OpenListDialog.xaml
  3. 23
      ILSpy/OpenListDialog.xaml.cs

30
ILSpy/AssemblyListManager.cs

@ -90,5 +90,35 @@ namespace ICSharpCode.ILSpy @@ -90,5 +90,35 @@ namespace ICSharpCode.ILSpy
doc.Add(list.SaveAsXml());
});
}
public void CreateList(AssemblyList list)
{
if (!AssemblyLists.Contains(list.ListName))
{
AssemblyLists.Add(list.ListName);
SaveList(list);
}
}
public void DeleteList(string Name)
{
if (AssemblyLists.Contains(Name))
{
AssemblyLists.Remove(Name);
ILSpySettings.Update(
delegate(XElement root)
{
XElement doc = root.Element("AssemblyLists");
if (doc == null)
{
return;
}
XElement listElement = doc.Elements("List").FirstOrDefault(e => (string)e.Attribute("name") == Name);
if (listElement != null)
listElement.Remove();
});
}
}
}
}

22
ILSpy/OpenListDialog.xaml

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
Style="{DynamicResource DialogWindow}"
WindowStartupLocation="CenterOwner"
ResizeMode="CanResizeWithGrip"
MinWidth="200"
MinWidth="380"
MinHeight="150"
Height="350"
Width="300"
Width="380"
FocusManager.FocusedElement="{Binding ElementName=listView}">
<Grid Margin="12,8">
<Grid.RowDefinitions>
@ -18,16 +18,24 @@ @@ -18,16 +18,24 @@
<StackPanel>
<Label>Select a list:</Label>
</StackPanel>
<ListView Name="listView" Grid.Row="1" Margin="0, 8" controls:SortableGridViewColumn.SortMode="Automatic" SelectionChanged="ListView_SelectionChanged" Loaded="listView_Loaded" SelectionMode="Single">
<ListView Name="listView" Grid.Row="1" Margin="0, 8" controls:SortableGridViewColumn.SortMode="Automatic" SelectionChanged="ListView_SelectionChanged"
Loaded="listView_Loaded" SelectionMode="Single">
<ListView.View>
<GridView>
<controls:SortableGridViewColumn x:Name="nameColumn" Header="Name" DisplayMemberBinding="{Binding .}" />
</GridView>
</ListView.View>
</ListView>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button IsDefault="True" Margin="2,0" IsEnabled="False" Name="okButton" Click="OKButton_Click">Open</Button>
<Button IsCancel="True" Margin="2,0">Cancel</Button>
</StackPanel>
<DockPanel Grid.Row="2">
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">
<Button IsDefault="True" Margin="2,0" IsEnabled="False" Name="okButton" Click="OKButton_Click">Open</Button>
<Button IsCancel="True" Margin="2,0">Cancel</Button>
</StackPanel>
<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>
</StackPanel>
</DockPanel>
</Grid>
</Window>

23
ILSpy/OpenListDialog.xaml.cs

@ -48,7 +48,8 @@ namespace ICSharpCode.ILSpy @@ -48,7 +48,8 @@ namespace ICSharpCode.ILSpy
void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
okButton.IsEnabled = listView.SelectedItems != null;
okButton.IsEnabled = listView.SelectedItem != null;
removeButton.IsEnabled = listView.SelectedItem != null;
}
void OKButton_Click(object sender, RoutedEventArgs e)
@ -84,8 +85,7 @@ namespace ICSharpCode.ILSpy @@ -84,8 +85,7 @@ namespace ICSharpCode.ILSpy
if (dotnet4.assemblies.Count > 0)
{
manager.AssemblyLists.Add(dotnet4.ListName);
AssemblyListManager.SaveList(dotnet4);
manager.CreateList(dotnet4);
}
}
@ -104,8 +104,7 @@ namespace ICSharpCode.ILSpy @@ -104,8 +104,7 @@ namespace ICSharpCode.ILSpy
if (dotnet35.assemblies.Count > 0)
{
manager.AssemblyLists.Add(dotnet35.ListName);
AssemblyListManager.SaveList(dotnet35);
manager.CreateList(dotnet35);
}
}
@ -138,8 +137,7 @@ namespace ICSharpCode.ILSpy @@ -138,8 +137,7 @@ namespace ICSharpCode.ILSpy
if (mvc.assemblies.Count > 0)
{
manager.AssemblyLists.Add(mvc.ListName);
AssemblyListManager.SaveList(mvc);
manager.CreateList(mvc);
}
}
}
@ -152,5 +150,16 @@ namespace ICSharpCode.ILSpy @@ -152,5 +150,16 @@ namespace ICSharpCode.ILSpy
list.OpenAssembly(file);
}
private void CreateButton_Click(object sender, RoutedEventArgs e)
{
}
private void RemoveButton_Click(object sender, RoutedEventArgs e)
{
if(listView.SelectedItem != null)
manager.DeleteList(listView.SelectedItem.ToString());
}
}
}

Loading…
Cancel
Save