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

New UI #121

Closed
wants to merge 6 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
12 changes: 9 additions & 3 deletions Source/Hurl.BrowserSelector/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Hurl.BrowserSelector"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
xmlns:wpfui="http://schemas.lepo.co/wpfui/2022/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ControlsDictionary />
<ui:ThemesDictionary Theme="Dark" />
<wpfui:ControlsDictionary />
<wpfui:ThemesDictionary Theme="Light" />
</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>
2 changes: 1 addition & 1 deletion Source/Hurl.BrowserSelector/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected override void OnStartup(StartupEventArgs e)
{
if (Current.MainWindow is { } window)
{
_mainWindow.MaximizeWindow();
_mainWindow.ShowWindow();
}
else
{
Expand Down
71 changes: 21 additions & 50 deletions Source/Hurl.BrowserSelector/Controls/BrowsersList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

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

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

<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="BtnArea_MouseLeftButtonUp"
<wpfui:Button
Width="128"
Margin="4"
VerticalAlignment="Stretch"
VerticalContentAlignment="Top"
Appearance="Transparent"
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"
MaxWidth="64"
MaxHeight="64"
Source="{Binding Path=GetIcon}" />
<TextBlock
Margin="90,-18,0,0"
FontSize="18"
Foreground="#33FFFFFF"
Text="+"
Visibility="{Binding ShowAdditionalBtn}" />
<TextBlock 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" />
Visibility="Collapsed">
<wpfui:SymbolIcon Symbol="MoreVertical16" />
</wpfui:Button>
<TextBlock
Margin="0,2,0,0"
FontSize="11"
Foreground="AliceBlue"
Margin="0,12,0,0"
Text="{Binding Path=Name}"
TextAlignment="Center"
TextWrapping="NoWrap" />
TextWrapping="Wrap" />
<StackPanel.ContextMenu>
<ContextMenu
x:Name="MainContextMenu"
ItemsSource="{Binding Path=AlternateLaunches}"
Visibility="{Binding ShowAdditionalBtn}">
<ContextMenu ItemsSource="{Binding Path=AlternateLaunches}" Visibility="{Binding ShowAdditionalBtn}">
<ContextMenu.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Header" Value="{Binding Path=ItemName}" />
Expand All @@ -121,7 +94,7 @@
</ContextMenu>
</StackPanel.ContextMenu>
</StackPanel>
</Border>
</wpfui:Button>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="AdditionalBtn" Property="Visibility" Value="{Binding ShowAdditionalBtn}" />
Expand All @@ -130,6 +103,4 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>


</UserControl>
10 changes: 5 additions & 5 deletions Source/Hurl.BrowserSelector/Controls/BrowsersList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public BrowsersList()
{
DataContext = Globals.SettingsGlobal.GetBrowsers();
InitializeComponent();
Loaded += (s, e) =>
/* Loaded += (s, e) =>
{
var parent = Window.GetWindow(this);
parent.PreviewKeyUp += OnPreviewKeyUp;
Expand All @@ -27,7 +27,7 @@ public BrowsersList()
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 BtnArea_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
private void BrowserButton_Click(object sender, RoutedEventArgs e)
{
var tag = (sender as Border).Tag as Browser;
var tag = ((Button)sender).Tag as Browser;
OpenLink(tag);
MinimizeWindow();
}
Expand All @@ -66,7 +66,7 @@ private void AdditionalBtn_Click(object sender, RoutedEventArgs e)

private void MenuItem_Click(object sender, RoutedEventArgs e)
{
var alt = (sender as MenuItem).Tag as AltLaunchParentConverter.AltLaunchParent;
var alt = ((MenuItem)sender).Tag as AltLaunchParentConverter.AltLaunchParent;
OpenAltLaunch(alt.AltLaunch, alt.Browser);
MinimizeWindow();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return new object[] {
return [
(value as AltLaunchParent).AltLaunch,
(value as AltLaunchParent).Browser
};
];
}
}
}
4 changes: 3 additions & 1 deletion Source/Hurl.BrowserSelector/Hurl.BrowserSelector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,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>
</Project>
Loading