Skip to content

Commit 04cc6fd

Browse files
committed
add a new ui component : about control
1 parent 9a4d77c commit 04cc6fd

File tree

4 files changed

+107
-12
lines changed

4 files changed

+107
-12
lines changed

sources/RevitDBExplorer/ConfigWindow.xaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:wpf="clr-namespace:RevitDBExplorer.WPF"
7+
xmlns:componentAbout="clr-namespace:RevitDBExplorer.UIComponents.About"
78
x:ClassModifier="internal"
89
WindowStartupLocation="CenterOwner"
910
xmlns:local="clr-namespace:RevitDBExplorer"
@@ -27,16 +28,12 @@
2728
</Window.Resources>
2829
<Grid Margin="7">
2930
<Grid.RowDefinitions>
30-
<RowDefinition Height="27"></RowDefinition>
31+
<RowDefinition Height="69"></RowDefinition>
3132
<RowDefinition Height="*"></RowDefinition>
3233
<RowDefinition Height="auto"></RowDefinition>
3334
</Grid.RowDefinitions>
3435

35-
<TextBlock HorizontalAlignment="Center">
36-
<Hyperlink NavigateUri="https://github.com/NeVeSpl/RevitDBExplorer" RequestNavigate="Hyperlink_RequestNavigate">
37-
https://github.com/NeVeSpl/RevitDBExplorer
38-
</Hyperlink>
39-
</TextBlock>
36+
<componentAbout:AboutControl/>
4037

4138
<TabControl Grid.Row="1" Margin="0 0 0 7" Padding="7">
4239
<TabItem Header="General">

sources/RevitDBExplorer/ConfigWindow.xaml.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
149149
ApplicationModifyTab.Update(AppSettings.Default.AddRDBECmdToModifyTab);
150150
Close();
151151
}
152-
153-
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
154-
{
155-
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
156-
e.Handled = true;
157-
}
152+
158153

159154
#region INotifyPropertyChanged
160155

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<UserControl x:Class="RevitDBExplorer.UIComponents.About.AboutControl"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:RevitDBExplorer.UIComponents.About"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800">
9+
<UserControl.Resources>
10+
<Style x:Key="SponsorButtonStyle" TargetType="Button">
11+
<Setter Property="Foreground" Value="#25292E"/>
12+
<Setter Property="Background" Value="#F6F8FA"/>
13+
<Setter Property="BorderBrush" Value="#D1D9E0"/>
14+
<Setter Property="FontFamily" Value="Segoe UI"/>
15+
<Setter Property="FontSize" Value="14"/>
16+
<Setter Property="Padding" Value="0"/>
17+
<Setter Property="Cursor" Value="Hand"/>
18+
<Setter Property="Template">
19+
<Setter.Value>
20+
<ControlTemplate TargetType="Button">
21+
<Border x:Name="border"
22+
CornerRadius="6"
23+
Background="{TemplateBinding Background}"
24+
BorderBrush="{TemplateBinding BorderBrush}"
25+
BorderThickness="{TemplateBinding BorderThickness}">
26+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
27+
<Path Fill="#BF3989" VerticalAlignment="Center" Margin="0 1 0 0" Data="m8 14.25.345.666a.75.75 0 0 1-.69 0l-.008-.004-.018-.01a7.152 7.152 0 0 1-.31-.17 22.055 22.055 0 0 1-3.434-2.414C2.045 10.731 0 8.35 0 5.5 0 2.836 2.086 1 4.25 1 5.797 1 7.153 1.802 8 3.02 8.847 1.802 10.203 1 11.75 1 13.914 1 16 2.836 16 5.5c0 2.85-2.045 5.231-3.885 6.818a22.066 22.066 0 0 1-3.744 2.584l-.018.01-.006.003h-.002ZM4.25 2.5c-1.336 0-2.75 1.164-2.75 3 0 2.15 1.58 4.144 3.365 5.682A20.58 20.58 0 0 0 8 13.393a20.58 20.58 0 0 0 3.135-2.211C12.92 9.644 14.5 7.65 14.5 5.5c0-1.836-1.414-3-2.75-3-1.373 0-2.609.986-3.029 2.456a.749.749 0 0 1-1.442 0C6.859 3.486 5.623 2.5 4.25 2.5Z"/>
28+
<ContentPresenter Margin="9 2 0 0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
29+
</StackPanel>
30+
</Border>
31+
<ControlTemplate.Triggers>
32+
<Trigger Property="IsMouseOver" Value="True">
33+
<Setter TargetName="border" Property="Background" Value="#EFF2F5"/>
34+
</Trigger>
35+
</ControlTemplate.Triggers>
36+
</ControlTemplate>
37+
</Setter.Value>
38+
</Setter>
39+
</Style>
40+
</UserControl.Resources>
41+
<Grid Margin="0 0 0 13" >
42+
<Grid.ColumnDefinitions>
43+
<ColumnDefinition />
44+
<ColumnDefinition Width="0.5*"/>
45+
</Grid.ColumnDefinitions>
46+
<Grid.RowDefinitions>
47+
<RowDefinition Height="auto" />
48+
<RowDefinition Height="1*"/>
49+
</Grid.RowDefinitions>
50+
51+
<TextBlock Text="Revit Database Explorer website" FontFamily="Segoe UI Semibold" FontSize="12" Margin="0 0 0 2" />
52+
53+
<TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
54+
<Hyperlink NavigateUri="https://github.com/NeVeSpl/RevitDBExplorer" RequestNavigate="Hyperlink_RequestNavigate">
55+
https://github.com/NeVeSpl/RevitDBExplorer
56+
</Hyperlink>
57+
</TextBlock>
58+
59+
<TextBlock Grid.Row="0" Grid.Column="1" Text="Sponsor this project" FontFamily="Segoe UI Semibold" FontSize="12" />
60+
61+
<Button Grid.Row="1" Grid.Column="1" Content="Sponsor" Height="32" VerticalAlignment="Center" Style="{StaticResource SponsorButtonStyle}" SnapsToDevicePixels="True" Click="SponsorButton_Click" />
62+
</Grid>
63+
</UserControl>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
using System.Windows.Controls;
9+
using System.Windows.Data;
10+
using System.Windows.Documents;
11+
using System.Windows.Input;
12+
using System.Windows.Media;
13+
using System.Windows.Media.Imaging;
14+
using System.Windows.Navigation;
15+
using System.Windows.Shapes;
16+
17+
namespace RevitDBExplorer.UIComponents.About
18+
{
19+
/// <summary>
20+
/// Interaction logic for AboutControl.xaml
21+
/// </summary>
22+
public partial class AboutControl : UserControl
23+
{
24+
public AboutControl()
25+
{
26+
InitializeComponent();
27+
}
28+
29+
public void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
30+
{
31+
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
32+
e.Handled = true;
33+
}
34+
35+
private void SponsorButton_Click(object sender, RoutedEventArgs e)
36+
{
37+
Process.Start(new ProcessStartInfo("https://github.com/sponsors/NeVeSpl") { UseShellExecute = true });
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)