mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Add browser path selection for browserbookmark plugin
This commit is contained in:
@@ -3,5 +3,7 @@
|
||||
public class Settings : BaseModel
|
||||
{
|
||||
public bool OpenInNewBrowserWindow { get; set; } = true;
|
||||
|
||||
public string BrowserPath { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,12 @@
|
||||
<Label Content="Open bookmark in:" Margin="40 3 0 8"/>
|
||||
<RadioButton Name="NewWindowBrowser" GroupName="OpenSearchBehaviour" Content="New window" Click="OnNewBrowserWindowClick" Margin="10" />
|
||||
<RadioButton Name="NewTabInBrowser" GroupName="OpenSearchBehaviour" Content="New tab" Click="OnNewTabClick" Margin="10" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center" Margin="0,50,0,44" Grid.Row="1">
|
||||
<Label Content="Set browser from path:" Height="28" Margin="0,0,155,0" HorizontalAlignment="Right" Width="290"/>
|
||||
<TextBox x:Name="browserPathBox" HorizontalAlignment="Left" Height="34" Margin="35,0,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="311" RenderTransformOrigin="0.502,-1.668"/>
|
||||
<Button x:Name="setButton" HorizontalAlignment="Left" Margin="272,5,0,0" Width="73" Height="25" FontSize="10" Click="OnApplyBTClick" Content="Apply" />
|
||||
<Button x:Name="viewButton" HorizontalAlignment="Left" Margin="180,-25,0,0" Width="73" Height="25" Click="OnChooseClick" FontSize="10" Content="Choose" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,3 +1,4 @@
|
||||
using Microsoft.Win32;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Wox.Plugin.BrowserBookmark.Models;
|
||||
@@ -28,5 +29,22 @@ namespace Wox.Plugin.BrowserBookmark.Views
|
||||
{
|
||||
_settings.OpenInNewBrowserWindow = false;
|
||||
}
|
||||
|
||||
private void OnApplyBTClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_settings.BrowserPath = browserPathBox.Text;
|
||||
}
|
||||
|
||||
private void OnChooseClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var fileBrowserDialog = new OpenFileDialog();
|
||||
fileBrowserDialog.Filter = "Application(*.exe)|*.exe|All files|*.*";
|
||||
fileBrowserDialog.CheckFileExists = true;
|
||||
fileBrowserDialog.CheckPathExists = true;
|
||||
if (fileBrowserDialog.ShowDialog() == true)
|
||||
{
|
||||
browserPathBox.Text = fileBrowserDialog.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user