Skip to content

Commit

Permalink
(GH-425) New source settings
Browse files Browse the repository at this point in the history
- Added necessary UI elements
- Updated model classes with new properties
  • Loading branch information
gep13 authored and ferventcoder committed Jun 12, 2017
1 parent e752412 commit 2e5a7ce
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 48 deletions.
20 changes: 16 additions & 4 deletions Source/ChocolateyGui.Shared/Models/ChocolateySource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public class ChocolateySource : IEquatable<ChocolateySource>
[DataMember]
public string CertificatePassword { get; set; }

public bool ByPassProxy { get; set; }

public bool SelfService { get; set; }

public bool Equals(ChocolateySource other)
{
if (ReferenceEquals(null, other))
Expand All @@ -48,10 +52,16 @@ public bool Equals(ChocolateySource other)
return true;
}

return string.Equals(Id, other.Id) && string.Equals(Value, other.Value) && Disabled == other.Disabled
&& string.Equals(UserName, other.UserName) && string.Equals(Password, other.Password)
&& Priority == other.Priority && string.Equals(Certificate, other.Certificate)
&& string.Equals(CertificatePassword, other.CertificatePassword);
return string.Equals(Id, other.Id)
&& string.Equals(Value, other.Value)
&& Disabled == other.Disabled
&& string.Equals(UserName, other.UserName)
&& string.Equals(Password, other.Password)
&& Priority == other.Priority
&& string.Equals(Certificate, other.Certificate)
&& string.Equals(CertificatePassword, other.CertificatePassword)
&& ByPassProxy == other.ByPassProxy
&& SelfService == other.SelfService;
}

public override bool Equals(object obj)
Expand Down Expand Up @@ -86,6 +96,8 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ Priority;
hashCode = (hashCode * 397) ^ (Certificate?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (CertificatePassword?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ ByPassProxy.GetHashCode();
hashCode = (hashCode * 397) ^ SelfService.GetHashCode();
return hashCode;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Source/ChocolateyGui.Subprocess/ChocolateyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ public async Task AddSource(ChocolateySource source)
config.SourceCommand.Certificate = source.Certificate;
config.SourceCommand.CertificatePassword = source.CertificatePassword;
config.SourceCommand.Priority = source.Priority;
config.SourceCommand.BypassProxy = source.ByPassProxy;
config.SourceCommand.AllowSelfService = source.SelfService;
});

await choco.RunAsync();
Expand Down
36 changes: 36 additions & 0 deletions Source/ChocolateyGui/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Source/ChocolateyGui/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@
<data name="SettingsView_Sources" xml:space="preserve">
<value>Quellen</value>
</data>
<data name="SettingsView_SourcesByPassProxy" xml:space="preserve">
<value />
</data>
<data name="SettingsView_SourcesCertificate" xml:space="preserve">
<value>Zertifikat</value>
</data>
Expand All @@ -324,6 +327,9 @@
<data name="SettingsView_SourcesPriority" xml:space="preserve">
<value>Priorität</value>
</data>
<data name="SettingsView_SourcesSelfService" xml:space="preserve">
<value />
</data>
<data name="SettingsView_SourcesSource" xml:space="preserve">
<value>Quelle</value>
</data>
Expand Down
12 changes: 12 additions & 0 deletions Source/ChocolateyGui/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,16 @@ NOTE: Probably only necessary to change in RTL languages.</comment>
<data name="VersionNumberProvider_VersionFormat" xml:space="preserve">
<value>Version: {0}</value>
</data>
<data name="SettingsView_SourcesByPassProxy" xml:space="preserve">
<value>ByPass Proxy</value>
</data>
<data name="SettingsView_SourcesSelfService" xml:space="preserve">
<value>Self Service</value>
</data>
<data name="SettingsView_SourcesIsByPassProxy" xml:space="preserve">
<value>Is Proxy ByPassed</value>
</data>
<data name="SettingsView_SourcesIsSelfService" xml:space="preserve">
<value>Is Self Service</value>
</data>
</root>
6 changes: 6 additions & 0 deletions Source/ChocolateyGui/Properties/Resources.sv.resx
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ NOTE: Probably only necessary to change in RTL languages.</comment>
<data name="SettingsView_Sources" xml:space="preserve">
<value>Källor</value>
</data>
<data name="SettingsView_SourcesByPassProxy" xml:space="preserve">
<value />
</data>
<data name="SettingsView_SourcesCertificate" xml:space="preserve">
<value>Certifikat</value>
</data>
Expand All @@ -543,6 +546,9 @@ NOTE: Probably only necessary to change in RTL languages.</comment>
<data name="SettingsView_SourcesPriority" xml:space="preserve">
<value>Prioritet</value>
</data>
<data name="SettingsView_SourcesSelfService" xml:space="preserve">
<value />
</data>
<data name="SettingsView_SourcesSource" xml:space="preserve">
<value>Källa</value>
</data>
Expand Down
30 changes: 15 additions & 15 deletions Source/ChocolateyGui/Views/PackageView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<StackPanel Orientation="Horizontal">
<Image Style="{StaticResource PrimaryUacActionStyle}" />
<iconPacks:PackIconEntypo Kind="Install" Margin="0 0 5 0 " VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonInstall}" FontSize="16"/>
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonInstall}" FontSize="16"/>
</StackPanel>
</Button>
</StackPanel>
Expand All @@ -84,7 +84,7 @@
<StackPanel Orientation="Horizontal">
<Image Style="{StaticResource TertiaryUacActionStyle}" />
<iconPacks:PackIconModern Kind="Pin" Margin="0 0 5 0 " VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonPin}" FontSize="16"/>
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonPin}" FontSize="16"/>
</StackPanel>
</Button>
<Button Padding="10" Margin="5 0"
Expand All @@ -93,23 +93,23 @@
<StackPanel Orientation="Horizontal">
<Image Style="{StaticResource TertiaryUacActionStyle}" />
<iconPacks:PackIconModern Kind="PinRemove" Margin="0 0 5 0 " VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonUnpin}" FontSize="16"/>
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonUnpin}" FontSize="16"/>
</StackPanel>
</Button>
<Button Padding="10" Margin="5 0"
Command="{commands:DataContextCommandAdapter Reinstall}">
<StackPanel Orientation="Horizontal">
<Image Style="{StaticResource PrimaryUacActionStyle}" />
<iconPacks:PackIconEntypo Kind="Cw" Margin="0 0 5 0 " VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonReinstall}" FontSize="16"/>
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonReinstall}" FontSize="16"/>
</StackPanel>
</Button>
<Button Padding="10" Margin="5 0"
Command="{commands:DataContextCommandAdapter Uninstall}">
<StackPanel Orientation="Horizontal">
<Image Style="{StaticResource PrimaryUacActionStyle}" />
<iconPacks:PackIconEntypo Kind="Uninstall" Margin="0 0 5 0 " VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonUninstall}" FontSize="16"/>
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonUninstall}" FontSize="16"/>
</StackPanel>
</Button>
<Button Padding="10" Margin="5 0"
Expand All @@ -118,7 +118,7 @@
<StackPanel Orientation="Horizontal">
<Image Style="{StaticResource PrimaryUacActionStyle}" />
<iconPacks:PackIconEntypo Kind="Cycle" Margin="0 0 5 0 " VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonUpdate}" FontSize="16"/>
<TextBlock Text="{x:Static lang:Resources.PackageView_ButtonUpdate}" FontSize="16"/>
</StackPanel>
</Button>
</StackPanel>
Expand All @@ -127,18 +127,18 @@
</Grid>

<StackPanel DockPanel.Dock="Left" Margin="20,0,0,0">
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_Downloads}"
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_Downloads}"
Target="{Binding ElementName=VersionDownloadCount}" />
<TextBlock x:Name="VersionDownloadCount" Text="{Binding VersionDownloadCount, StringFormat=N0}"
Style="{StaticResource PackageResourceValue}" />
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_TotalDownloads}"
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_TotalDownloads}"
Target="{Binding ElementName=DownloadCount}" />
<TextBlock x:Name="DownloadCount" Text="{Binding DownloadCount, StringFormat=N0}"
Style="{StaticResource PackageResourceValue}" />
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_LastUpdate}"
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_LastUpdate}"
Target="{Binding ElementName=Published}" />
<TextBlock x:Name="Published" Text="{Binding Published, StringFormat=g}" Style="{StaticResource PackageResourceValue}" />
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_PackageSize}"
<Label Style="{StaticResource PackageResourceLabel}" Content="{x:Static lang:Resources.PackageView_PackageSize}"
Target="{Binding ElementName=PackageSize}" />
<TextBlock x:Name="PackageSize"
Text="{Binding PackageSize, Converter={StaticResource LongSizeToFileSizeString}}"
Expand Down Expand Up @@ -191,17 +191,17 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="3*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{x:Static lang:Resources.PackageView_PackageID}" Style="{StaticResource SectionHeaderTextStyle}"
<TextBlock Grid.Row="0" Text="{x:Static lang:Resources.PackageView_PackageID}" Style="{StaticResource SectionHeaderTextStyle}"
Visibility="{Binding Id, Converter={StaticResource NullToVisibility}}" />
<TextBlock Grid.Row="1" Text="{Binding Id}" ScrollViewer.CanContentScroll="True" TextWrapping="Wrap"
Style="{StaticResource PageTextBlockStyle}"
Visibility="{Binding Id, Converter={StaticResource NullToVisibility}}" />
<TextBlock Grid.Row="2" Text="{x:Static lang:Resources.PackageView_Summary}" Style="{StaticResource SectionHeaderTextStyle}"
<TextBlock Grid.Row="2" Text="{x:Static lang:Resources.PackageView_Summary}" Style="{StaticResource SectionHeaderTextStyle}"
Visibility="{Binding Summary, Converter={StaticResource NullToVisibility}}" />
<TextBlock Grid.Row="3" Text="{Binding Summary}" ScrollViewer.CanContentScroll="True" TextWrapping="Wrap"
Style="{StaticResource PageTextBlockStyle}"
Visibility="{Binding Summary, Converter={StaticResource NullToVisibility}}" />
<TextBlock Grid.Row="4" Text="{x:Static lang:Resources.PackageView_Description}" Style="{StaticResource SectionHeaderTextStyle}" />
<TextBlock Grid.Row="4" Text="{x:Static lang:Resources.PackageView_Description}" Style="{StaticResource SectionHeaderTextStyle}" />
<controls:MarkdownViewer
AutomationProperties.Name="Package Description"
Grid.Row="5"
Expand All @@ -210,12 +210,12 @@
Margin="5 0"
MarkdownString="{Binding Description}" />
<StackPanel Grid.Row="6" Visibility="{Binding Dependencies, Converter={StaticResource NullToVisibility}}">
<TextBlock Text="{x:Static lang:Resources.PackageView_Dependencies}" Style="{StaticResource SectionHeaderTextStyle}" />
<TextBlock Text="{x:Static lang:Resources.PackageView_Dependencies}" Style="{StaticResource SectionHeaderTextStyle}" />
<TextBlock Text="{Binding Dependencies, Converter={StaticResource PackageDependenciesToString}}"
Margin="5" Style="{StaticResource PageTextBlockStyle}"
AutomationProperties.Name="Package Dependencies" />
</StackPanel>
<TextBlock Grid.Row="7" Text="{x:Static lang:Resources.PackageView_ReleaseNotes}" Style="{StaticResource SectionHeaderTextStyle}"
<TextBlock Grid.Row="7" Text="{x:Static lang:Resources.PackageView_ReleaseNotes}" Style="{StaticResource SectionHeaderTextStyle}"
Visibility="{Binding ReleaseNotes, Converter={StaticResource NullToVisibility}}" />
<controls:MarkdownViewer Grid.Row="8"
AutomationProperties.Name="Package Release Notes"
Expand Down
Loading

0 comments on commit 2e5a7ce

Please sign in to comment.