Skip to content

Commit 6ee4232

Browse files
committed
Libaries view improved
1 parent ccec045 commit 6ee4232

10 files changed

Lines changed: 185 additions & 188 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace NETworkManager.Models.Documentation
2+
{
3+
public class LibraryInfo
4+
{
5+
public string Library { get; set; }
6+
public string LibraryUrl { get; set; }
7+
public string Description { get; set; }
8+
public string License { get; set; }
9+
public string LicenseUrl { get; set; }
10+
11+
public LibraryInfo()
12+
{
13+
14+
}
15+
16+
public LibraryInfo(string library, string libraryUrl, string description, string license, string licenseUrl)
17+
{
18+
Library = library;
19+
LibraryUrl = libraryUrl;
20+
Description = description;
21+
License = license;
22+
LicenseUrl = licenseUrl;
23+
}
24+
}
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using NETworkManager.Models.Settings;
2+
using System.Collections.Generic;
3+
4+
namespace NETworkManager.Models.Documentation
5+
{
6+
public static class LibraryManager
7+
{
8+
public static List<LibraryInfo> List
9+
{
10+
get
11+
{
12+
return new List<LibraryInfo>
13+
{
14+
new LibraryInfo("MahApps.Metro", "https://github.com/mahapps/mahapps.metro", "A toolkit for creating Metro / Modern UI styled WPF apps.", "MIT License", "https://github.com/MahApps/MahApps.Metro/blob/master/LICENSE")
15+
};
16+
}
17+
}
18+
}
19+
}

Source/NETworkManager/NETworkManager.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@
199199
<Compile Include="Helpers\PowerShellHelper.cs" />
200200
<Compile Include="Helpers\SecureStringHelper.cs" />
201201
<Compile Include="Helpers\SingleInstanceHelper.cs" />
202+
<Compile Include="Models\Documentation\LibraryManager.cs" />
203+
<Compile Include="Models\Documentation\LibraryInfo.cs" />
202204
<Compile Include="Models\Documentation\DocumentationInfo.cs" />
203205
<Compile Include="Models\Documentation\DocumentationManager.cs" />
204206
<Compile Include="Models\Network\HTTPHeadersOptions.cs" />

Source/NETworkManager/Properties/Resources.Designer.cs

Lines changed: 45 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/NETworkManager/Properties/Resources.resx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,6 @@
165165
<data name="Libary_MahAppsMetroIconPacks_ProjectUrl" xml:space="preserve">
166166
<value>https://github.com/MahApps/MahApps.Metro.IconPacks</value>
167167
</data>
168-
<data name="Libary_MahAppsMetro_Description" xml:space="preserve">
169-
<value>A toolkit for creating Metro / Modern UI styled WPF apps.</value>
170-
</data>
171-
<data name="Libary_MahAppsMetro_LicenseUrl" xml:space="preserve">
172-
<value>https://github.com/MahApps/MahApps.Metro/blob/master/LICENSE</value>
173-
</data>
174-
<data name="Libary_MahAppsMetro_Name" xml:space="preserve">
175-
<value>MahApps.Metro</value>
176-
</data>
177-
<data name="Libary_MahAppsMetro_ProjectUrl" xml:space="preserve">
178-
<value>https://github.com/mahapps/mahapps.metro</value>
179-
</data>
180168
<data name="Libary_Octokit_Description" xml:space="preserve">
181169
<value>A GitHub API client library for .NET</value>
182170
</data>

Source/NETworkManager/Resources/Localization/Resources.de-DE.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@
360360
<system:String x:Key="String_TheProcessCanTakeUpSomeTimeAndResources">Der Vorgang kann einige Zeit und Ressourcen in Anspruch nehmen (CPU / RAM).</system:String>
361361
<system:String x:Key="String_ErrorCheckingApiGithubComVerifyYourNetworkConnection">Fehler beim Überprüfen von 'api.github.com', überprüfen Sie Ihre Netzwerkverbindung!</system:String>
362362
<system:String x:Key="String_Mode">Modus</system:String>
363+
<system:String x:Key="String_OpenProject">Projekt öffnen</system:String>
364+
<system:String x:Key="String_OpenLicense">Lizenz öffnen</system:String>
363365

364366
<!-- Documentation title -->
365367
<system:String x:Key="String_DocumentationTitle_00001">Wie installiere ich RDP 8.1 unter Windows 7 / Server 2008 R2?</system:String>

Source/NETworkManager/Resources/Localization/Resources.en-US.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@
360360
<system:String x:Key="String_TheProcessCanTakeUpSomeTimeAndResources">The process can take up some time and resources (CPU / RAM).</system:String>
361361
<system:String x:Key="String_ErrorCheckingApiGithubComVerifyYourNetworkConnection">Error checking 'api.github.com', check your network connection!</system:String>
362362
<system:String x:Key="String_Mode">Mode</system:String>
363+
<system:String x:Key="String_OpenProject">Open project</system:String>
364+
<system:String x:Key="String_OpenLicense">Open license</system:String>
363365

364366
<!-- Documentation title -->
365367
<system:String x:Key="String_DocumentationTitle_00001">How to install RDP 8.1 on Windows 7/Server 2008 R2</system:String>

Source/NETworkManager/ViewModels/Settings/AboutViewModel.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
using System.Windows;
55
using NETworkManager.Models.Update;
66
using System;
7+
using System.ComponentModel;
8+
using NETworkManager.Models.Documentation;
9+
using System.Windows.Data;
710

811
namespace NETworkManager.ViewModels.Settings
912
{
@@ -122,13 +125,35 @@ public string UpdaterMessage
122125
OnPropertyChanged();
123126
}
124127
}
128+
129+
private ICollectionView _librariesView;
130+
public ICollectionView LibrariesView
131+
{
132+
get { return _librariesView; }
133+
}
134+
135+
private LibraryInfo _selectedLibraryInfo;
136+
public LibraryInfo SelectedLibraryInfo
137+
{
138+
get { return _selectedLibraryInfo; }
139+
set
140+
{
141+
if (value == _selectedLibraryInfo)
142+
return;
143+
144+
_selectedLibraryInfo = value;
145+
OnPropertyChanged();
146+
}
147+
}
125148
#endregion
126149

127150
#region Constructor
128151
public AboutViewModel()
129152
{
130153
Version = string.Format("{0} {1}", Application.Current.Resources["String_Version"] as string, AssemblyManager.Current.Version);
131154
CopyrightAndAuthor = string.Format("{0} {1}.", AssemblyManager.Current.Copyright, AssemblyManager.Current.Company);
155+
156+
_librariesView = CollectionViewSource.GetDefaultView(LibraryManager.List);
132157
}
133158
#endregion
134159

@@ -152,6 +177,26 @@ private void OpenWebsiteAction(object url)
152177
{
153178
Process.Start((string)url);
154179
}
180+
181+
public ICommand OpenLibaryWebsiteCommand
182+
{
183+
get { return new RelayCommand(p => OpenLibaryWebsiteAction()); }
184+
}
185+
186+
private void OpenLibaryWebsiteAction()
187+
{
188+
Process.Start(SelectedLibraryInfo.LibraryUrl);
189+
}
190+
191+
public ICommand OpenLibaryLicenseCommand
192+
{
193+
get { return new RelayCommand(p => OpenLibaryLicenseAction()); }
194+
}
195+
196+
private void OpenLibaryLicenseAction()
197+
{
198+
Process.Start(SelectedLibraryInfo.LicenseUrl);
199+
}
155200
#endregion
156201

157202
#region Methods

Source/NETworkManager/Views/Settings/AboutView.xaml

Lines changed: 39 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -81,100 +81,44 @@
8181
<TextBlock Grid.Column="2" Text="{Binding UpdaterMessage}" Visibility="{Binding ShowUpdaterMessage, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource CenterTextBlock}" Margin="10,0,0,0" />
8282
</Grid>
8383
<TextBlock Grid.Row="3" Text="{DynamicResource String_Header_Libraries}" Style="{StaticResource HeaderTextBlock}"/>
84-
<ScrollViewer Grid.Row="4" Style="{StaticResource DefaulScrollViewer}" Margin="0,0,0,20">
85-
<Grid>
86-
<Grid.ColumnDefinitions>
87-
<ColumnDefinition Width="Auto" />
88-
<ColumnDefinition Width="10" />
89-
<ColumnDefinition Width="*" />
90-
<ColumnDefinition Width="10" />
91-
<ColumnDefinition Width="Auto" />
92-
</Grid.ColumnDefinitions>
93-
<Grid.RowDefinitions>
94-
<RowDefinition Height="Auto" />
95-
<RowDefinition Height="5" />
96-
<RowDefinition Height="Auto" />
97-
<RowDefinition Height="5" />
98-
<RowDefinition Height="Auto" />
99-
<RowDefinition Height="5" />
100-
<RowDefinition Height="Auto" />
101-
<RowDefinition Height="5" />
102-
<RowDefinition Height="Auto" />
103-
<RowDefinition Height="5" />
104-
<RowDefinition Height="Auto" />
105-
<RowDefinition Height="5" />
106-
<RowDefinition Height="Auto" />
107-
</Grid.RowDefinitions>
108-
<TextBlock Grid.Column="0" Grid.Row="0" Style="{StaticResource BoldTextBlock}" Text="{DynamicResource String_Name}" />
109-
<TextBlock Grid.Column="2" Grid.Row="0" Style="{StaticResource BoldTextBlock}" Text="{DynamicResource String_Description}" />
110-
<TextBlock Grid.Column="4" Grid.Row="0" Style="{StaticResource BoldTextBlock}" Text="{DynamicResource String_License}" />
111-
<TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static Resources:Resources.Libary_MahAppsMetro_Name}" Style="{StaticResource LinkTextBlock}">
112-
<TextBlock.InputBindings>
113-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_MahAppsMetro_ProjectUrl}" MouseAction="LeftClick" />
114-
</TextBlock.InputBindings>
115-
</TextBlock>
116-
<TextBlock Grid.Column="2" Grid.Row="2" Text="{x:Static Resources:Resources.Libary_MahAppsMetro_Description}" Style="{StaticResource WrapTextBlock}" />
117-
<TextBlock Grid.Column="4" Grid.Row="2" Text="{x:Static Resources:Resources.License_MIT}" Style="{StaticResource LinkTextBlock}">
118-
<TextBlock.InputBindings>
119-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_MahAppsMetro_LicenseUrl}" MouseAction="LeftClick" />
120-
</TextBlock.InputBindings>
121-
</TextBlock>
122-
<TextBlock Grid.Column="0" Grid.Row="4" Text="{x:Static Resources:Resources.Libary_MahAppsMetroIconPacks_Name}" Style="{StaticResource LinkTextBlock}">
123-
<TextBlock.InputBindings>
124-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_MahAppsMetroIconPacks_ProjectUrl}" MouseAction="LeftClick" />
125-
</TextBlock.InputBindings>
126-
</TextBlock>
127-
<TextBlock Grid.Column="2" Grid.Row="4" Text="{x:Static Resources:Resources.Libary_MahAppsMetroIconPacks_Description}" Style="{StaticResource WrapTextBlock}" />
128-
<TextBlock Grid.Column="4" Grid.Row="4" Text="{x:Static Resources:Resources.License_MIT}" Style="{StaticResource LinkTextBlock}">
129-
<TextBlock.InputBindings>
130-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_MahAppsMetroIconPacks_LicenseUrl}" MouseAction="LeftClick" />
131-
</TextBlock.InputBindings>
132-
</TextBlock>
133-
<TextBlock Grid.Column="0" Grid.Row="6" Text="{x:Static Resources:Resources.Libary_ControlzEx_Name}" Style="{StaticResource LinkTextBlock}">
134-
<TextBlock.InputBindings>
135-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_ControlzEx_ProjectUrl}" MouseAction="LeftClick" />
136-
</TextBlock.InputBindings>
137-
</TextBlock>
138-
<TextBlock Grid.Column="2" Grid.Row="6" Text="{x:Static Resources:Resources.Libary_ControlEx_Description}" Style="{StaticResource WrapTextBlock}" />
139-
<TextBlock Grid.Column="4" Grid.Row="6" Text="{x:Static Resources:Resources.License_MIT}" Style="{StaticResource LinkTextBlock}">
140-
<TextBlock.InputBindings>
141-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_ControlzEx_ProjectUrl }" MouseAction="LeftClick" />
142-
</TextBlock.InputBindings>
143-
</TextBlock>
144-
<TextBlock Grid.Column="0" Grid.Row="8" Text="{x:Static Resources:Resources.Libary_HeijdenDNS_Name}" Style="{StaticResource LinkTextBlock}">
145-
<TextBlock.InputBindings>
146-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_HeijdenDNS_ProjectUrl}" MouseAction="LeftClick" />
147-
</TextBlock.InputBindings>
148-
</TextBlock>
149-
<TextBlock Grid.Column="2" Grid.Row="8" Text="{x:Static Resources:Resources.Libary_HeijdenDNS_Description}" Style="{StaticResource WrapTextBlock}" />
150-
<TextBlock Grid.Column="4" Grid.Row="8" Text="{x:Static Resources:Resources.License_CPOL}" Style="{StaticResource LinkTextBlock}">
151-
<TextBlock.InputBindings>
152-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_HeijdenDNS_LicenseUrl}" MouseAction="LeftClick" />
153-
</TextBlock.InputBindings>
154-
</TextBlock>
155-
<TextBlock Grid.Column="0" Grid.Row="10" Text="{x:Static Resources:Resources.Libary_Dragablz_Name}" Style="{StaticResource LinkTextBlock}">
156-
<TextBlock.InputBindings>
157-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_Dragablz_ProjectUrl}" MouseAction="LeftClick" />
158-
</TextBlock.InputBindings>
159-
</TextBlock>
160-
<TextBlock Grid.Column="2" Grid.Row="10" Text="{x:Static Resources:Resources.Libary_Dragablz_Description}" Style="{StaticResource WrapTextBlock}" />
161-
<TextBlock Grid.Column="4" Grid.Row="10" Text="{x:Static Resources:Resources.License_MIT}" Style="{StaticResource LinkTextBlock}">
162-
<TextBlock.InputBindings>
163-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_Dragablz_LicenseUrl}" MouseAction="LeftClick" />
164-
</TextBlock.InputBindings>
165-
</TextBlock>
166-
<TextBlock Grid.Column="0" Grid.Row="12" Text="{x:Static Resources:Resources.Libary_SharpSNMPLib_Name}" Style="{StaticResource LinkTextBlock}">
167-
<TextBlock.InputBindings>
168-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_SharpSNMPLib_ProjectUrl}" MouseAction="LeftClick" />
169-
</TextBlock.InputBindings>
170-
</TextBlock>
171-
<TextBlock Grid.Column="2" Grid.Row="12" Text="{x:Static Resources:Resources.Libary_SharpSNMPLib_Description}" Style="{StaticResource WrapTextBlock}" />
172-
<TextBlock Grid.Column="4" Grid.Row="12" Text="{x:Static Resources:Resources.License_MIT}" Style="{StaticResource LinkTextBlock}">
173-
<TextBlock.InputBindings>
174-
<MouseBinding Command="{Binding OpenWebsiteCommand}" CommandParameter="{x:Static Resources:Resources.Libary_SharpSNMPLib_LicenseUrl}" MouseAction="LeftClick" />
175-
</TextBlock.InputBindings>
176-
</TextBlock>
177-
</Grid>
178-
</ScrollViewer>
84+
<DataGrid x:Name="dataGridLibary" Grid.Row="4" ItemsSource="{Binding LibrariesView}" SelectedItem="{Binding SelectedLibraryInfo}">
85+
<DataGrid.Resources>
86+
<Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource DataGridScrollBar}" />
87+
<ContextMenu x:Key="RowContextMenu" Opened="ContextMenu_Opened" MinWidth="150">
88+
<MenuItem Header="{DynamicResource String_OpenProject}" Command="{Binding OpenLibaryWebsiteCommand}">
89+
<MenuItem.Icon>
90+
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
91+
<Rectangle.OpacityMask>
92+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:Material Kind=OpenInNew}" />
93+
</Rectangle.OpacityMask>
94+
</Rectangle>
95+
</MenuItem.Icon>
96+
</MenuItem>
97+
<MenuItem Header="{DynamicResource String_OpenLicense}" Command="{Binding OpenLibaryLicenseCommand}">
98+
<MenuItem.Icon>
99+
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
100+
<Rectangle.OpacityMask>
101+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:Material Kind=OpenInNew}" />
102+
</Rectangle.OpacityMask>
103+
</Rectangle>
104+
</MenuItem.Icon>
105+
</MenuItem>
106+
</ContextMenu>
107+
</DataGrid.Resources>
108+
<DataGrid.RowStyle>
109+
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource MetroDataGridRow}">
110+
<Style.Triggers>
111+
<DataTrigger Binding="{Binding SelectedItems.Count, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}}" Value="1" >
112+
<Setter Property="ContextMenu" Value="{StaticResource RowContextMenu}"/>
113+
</DataTrigger>
114+
</Style.Triggers>
115+
</Style>
116+
</DataGrid.RowStyle>
117+
<DataGrid.Columns>
118+
<DataGridTextColumn Header="{DynamicResource String_Name}" Binding="{Binding Library}" SortMemberPath="IPAddressInt32" MinWidth="150" />
119+
<DataGridTextColumn Header="{DynamicResource String_Description}" Binding="{Binding Description}" MinWidth="300" Width="*" />
120+
<DataGridTextColumn Header="{DynamicResource String_License}" Binding="{Binding License}" MinWidth="150" />
121+
</DataGrid.Columns>
122+
</DataGrid>
179123
</Grid>
180124
</UserControl>

Source/NETworkManager/Views/Settings/AboutView.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,11 @@ public AboutView()
1212
InitializeComponent();
1313
DataContext = viewModel;
1414
}
15+
16+
private void ContextMenu_Opened(object sender, System.Windows.RoutedEventArgs e)
17+
{
18+
ContextMenu menu = sender as ContextMenu;
19+
menu.DataContext = viewModel;
20+
}
1521
}
1622
}

0 commit comments

Comments
 (0)