Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Modified] UI improvements - round 1 #138

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Source/Hurl.BrowserSelector/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<wpfui:ControlsDictionary />
<wpfui:ThemesDictionary Theme="Dark" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="BottomBarStyle" TargetType="Border">
<Setter Property="Padding" Value="16" />
<Setter Property="Background" Value="{wpfui:ThemeResource SolidBackgroundFillColorBaseBrush}" />
<Setter Property="BorderBrush" Value="{wpfui:ThemeResource DividerStrokeColorDefaultBrush}" />
<Setter Property="BorderThickness" Value="0,1,0,0" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
70 changes: 25 additions & 45 deletions Source/Hurl.BrowserSelector/Controls/BrowsersList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
x:Class="Hurl.BrowserSelector.Controls.BrowsersList"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:Hurl.BrowserSelector.Converters"
xmlns:converters="clr-namespace:Hurl.BrowserSelector.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpfui="http://schemas.lepo.co/wpfui/2022/xaml"
d:DesignHeight="450"
d:DesignHeight="400"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.Resources>
<conv:AltLaunchParentConverter x:Key="AltLaunchParentConverter" />
<converters:AltLaunchParentConverter x:Key="AltLaunchParentConverter" />
<ContextMenu
x:Key="TheCM"
x:Name="TheCM"
Expand All @@ -32,11 +33,10 @@
</ContextMenu>
</UserControl.Resources>

<ItemsControl ItemsSource="{Binding}">
<ItemsControl IsTabStop="False" ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal" />
Expand All @@ -45,60 +45,40 @@

<ItemsControl.ItemTemplate>
<DataTemplate>
<Border
x:Name="BtnArea"
Width="120"
MaxHeight="130"
Margin="2"
Padding="5,10,5,10"
BorderThickness="0"
CornerRadius="5"
Cursor="Hand"
Focusable="True"
MouseLeftButtonUp="BrowserButton_Click"
<wpfui:Button
Width="128"
Margin="4"
VerticalAlignment="Stretch"
VerticalContentAlignment="Top"
Appearance="Transparent"
AutomationProperties.Name="{Binding Path=Name}"
BorderBrush="Transparent"
Click="BrowserButton_Click"
Tag="{Binding}"
ToolTip="{Binding Path=Name}">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#55000000" />
<Setter Property="BorderBrush" Value="AliceBlue" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel x:Name="BrowserBtn">
<StackPanel>
<Image
Width="70"
Height="70"
Width="64"
Height="64"
Source="{Binding Path=GetIcon}" />
<TextBlock
Margin="90,-18,0,0"
FontSize="18"
Foreground="#33FFFFFF"
Style="{StaticResource CaptionTextBlockStyle}"
Text="+"
Visibility="{Binding ShowAdditionalBtn}" />
<wpfui:Button
x:Name="AdditionalBtn"
Height="30"
Margin="0,-85,-4,0"
Padding="1"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="#00000000"
BorderBrush="#00000000"
Click="AdditionalBtn_Click"
Visibility="Hidden">
<wpfui:SymbolIcon Symbol="MoreVertical24" />
FontSize="16"
Visibility="{Binding ShowAdditionalBtn}">
<wpfui:SymbolIcon Symbol="MoreHorizontal16" />
</wpfui:Button>
<TextBlock
Margin="0,2,0,0"
FontSize="11"
Foreground="AliceBlue"
Margin="0,8,0,0"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding Path=Name}"
TextAlignment="Center"
TextWrapping="NoWrap" />
TextAlignment="Center" />
<StackPanel.ContextMenu>
<ContextMenu
x:Name="MainContextMenu"
Expand All @@ -121,7 +101,7 @@
</ContextMenu>
</StackPanel.ContextMenu>
</StackPanel>
</Border>
</wpfui:Button>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="AdditionalBtn" Property="Visibility" Value="{Binding ShowAdditionalBtn}" />
Expand Down
24 changes: 12 additions & 12 deletions Source/Hurl.BrowserSelector/Controls/BrowsersList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ public BrowsersList()
{
DataContext = SettingsGlobal.GetBrowsers();
InitializeComponent();
Loaded += (s, e) =>
{
var parent = Window.GetWindow(this);
parent.PreviewKeyUp += OnPreviewKeyUp;
};
Unloaded += (s, e) =>
{
var parent = Window.GetWindow(this);
parent.PreviewKeyUp -= OnPreviewKeyUp;
};
//Loaded += (s, e) =>
//{
// var parent = Window.GetWindow(this);
// parent.PreviewKeyUp += OnPreviewKeyUp;
//};
//Unloaded += (s, e) =>
//{
// var parent = Window.GetWindow(this);
// parent.PreviewKeyUp -= OnPreviewKeyUp;
//};
}

private void OnPreviewKeyUp(object sender, KeyEventArgs e)
Expand All @@ -41,9 +41,9 @@ private void OnPreviewKeyUp(object sender, KeyEventArgs e)
//if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control)) { }
}

private void BrowserButton_Click(object sender, MouseButtonEventArgs e)
private void BrowserButton_Click(object sender, RoutedEventArgs e)
{
var tag = ((Border)sender).Tag as Browser;
var tag = ((Button)sender).Tag as Browser;
OpenLink(tag);
MinimizeWindow();
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Hurl.BrowserSelector/Hurl.BrowserSelector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
</ItemGroup>
<ItemGroup>
<None Remove="Assets\internet.ico" />
<None Remove="Windows\internet.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Hurl.Library\Hurl.Library.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\internet.ico" />
<Resource Include="Windows\internet.ico" />
</ItemGroup>
</Project>
Loading