9 changed files with 237 additions and 30 deletions
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
<gui:OptionPanel |
||||
x:Class="ICSharpCode.PackageManagement.RegisteredProjectTemplatePackageSourcesView" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:pm="clr-namespace:ICSharpCode.PackageManagement" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
Height="300"> |
||||
|
||||
<Grid x:Name="MainGrid"> |
||||
<Grid.Resources> |
||||
<pm:PackageManagementViewModels x:Key="ViewModels"/> |
||||
|
||||
<Style |
||||
x:Key="ListBoxItemStyle" |
||||
TargetType="{x:Type ListBoxItem}"> |
||||
|
||||
<Style.Resources> |
||||
<SolidColorBrush |
||||
x:Key="{x:Static SystemColors.ControlBrushKey}" |
||||
Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" /> |
||||
</Style.Resources> |
||||
|
||||
<Setter |
||||
Property="Background" |
||||
Value="LightGray"/> |
||||
|
||||
<Style.Triggers> |
||||
<Trigger |
||||
Property="ItemsControl.AlternationIndex" |
||||
Value="0"> |
||||
<Setter |
||||
Property="Background" |
||||
Value="White"/> |
||||
</Trigger> |
||||
</Style.Triggers> |
||||
</Style> |
||||
|
||||
<DataTemplate x:Key="PackageSourceListBoxTemplate"> |
||||
<StackPanel |
||||
x:Name="PackageSourceStackPanel" |
||||
Margin="4"> |
||||
<TextBlock Text="{Binding Path=Name}"/> |
||||
<TextBlock> |
||||
<Hyperlink> |
||||
<TextBlock Text="{Binding Path=SourceUrl}"/> |
||||
</Hyperlink> |
||||
</TextBlock> |
||||
</StackPanel> |
||||
</DataTemplate> |
||||
</Grid.Resources> |
||||
|
||||
<Grid.DataContext> |
||||
<Binding Source="{StaticResource ViewModels}" Path="RegisteredProjectTemplatePackageSourcesViewModel"/> |
||||
</Grid.DataContext> |
||||
|
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition /> |
||||
<ColumnDefinition Width="Auto"/> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition /> |
||||
<RowDefinition Height="Auto"/> |
||||
</Grid.RowDefinitions> |
||||
<ListBox |
||||
Grid.Row="0" |
||||
HorizontalContentAlignment="Stretch" |
||||
AlternationCount="2" |
||||
pm:ListBoxBehaviour.IsSelectedItemScrolledIntoView="True" |
||||
ItemContainerStyle="{StaticResource ListBoxItemStyle}" |
||||
ItemTemplate="{StaticResource PackageSourceListBoxTemplate}" |
||||
ItemsSource="{Binding Path=PackageSourceViewModels}" |
||||
SelectedItem="{Binding Path=SelectedPackageSourceViewModel}"/> |
||||
<Grid |
||||
Grid.Row="1" |
||||
Margin="4"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
<TextBlock |
||||
Grid.Row="0" |
||||
Grid.Column="0" |
||||
Margin="4" |
||||
Text="Name:"/> |
||||
<TextBox |
||||
Grid.Row="0" |
||||
Grid.Column="1" |
||||
Text="{Binding Path=NewPackageSourceName, UpdateSourceTrigger=PropertyChanged}" |
||||
Margin="4, 2"/> |
||||
<TextBlock |
||||
Grid.Row="1" |
||||
Grid.Column="0" |
||||
Margin="4" |
||||
Text="Source:"/> |
||||
<TextBox |
||||
Grid.Row="1" |
||||
Grid.Column="1" |
||||
Text="{Binding Path=NewPackageSourceUrl, UpdateSourceTrigger=PropertyChanged}" |
||||
Margin="4,2"/> |
||||
</Grid> |
||||
<StackPanel |
||||
Grid.Column="1" |
||||
Grid.Row="0"> |
||||
<Button |
||||
Content="Move Up" |
||||
Command="{Binding Path=MovePackageSourceUpCommand}" |
||||
Margin="4, 2" |
||||
Padding="7, 0"/> |
||||
<Button |
||||
Content="Move Down" |
||||
Command="{Binding Path=MovePackageSourceDownCommand}" |
||||
Margin="4, 2" |
||||
Padding="7, 0"/> |
||||
<Button |
||||
Content="Remove" |
||||
Command="{Binding Path=RemovePackageSourceCommand}" |
||||
Margin="4, 2" |
||||
Padding="7, 0"/> |
||||
</StackPanel> |
||||
<StackPanel |
||||
Grid.Column="1" |
||||
Grid.Row="1"> |
||||
<Button |
||||
Content="Add" |
||||
Command="{Binding Path=AddPackageSourceCommand}" |
||||
Margin="4, 6, 4, 4" |
||||
Padding="7, 0"/> |
||||
<Button |
||||
Content="..." |
||||
Command="{Binding Path=BrowsePackageFolderCommand}" |
||||
HorizontalAlignment="Left" |
||||
Margin="4, 4" |
||||
Padding="7, 0"/> |
||||
</StackPanel> |
||||
</Grid> |
||||
</gui:OptionPanel> |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public partial class RegisteredProjectTemplatePackageSourcesView : OptionPanel |
||||
{ |
||||
RegisteredPackageSourcesViewModel viewModel; |
||||
|
||||
public RegisteredProjectTemplatePackageSourcesView() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
RegisteredPackageSourcesViewModel ViewModel { |
||||
get { |
||||
if (viewModel == null) { |
||||
viewModel = MainGrid.DataContext as RegisteredPackageSourcesViewModel; |
||||
} |
||||
return viewModel; |
||||
} |
||||
} |
||||
|
||||
public override void LoadOptions() |
||||
{ |
||||
ViewModel.Load(); |
||||
} |
||||
|
||||
public override bool SaveOptions() |
||||
{ |
||||
ViewModel.Save(); |
||||
return true; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue