mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add File Select Dialogue
This commit is contained in:
parent
c727150621
commit
07b42ff92c
2 changed files with 44 additions and 11 deletions
|
|
@ -88,7 +88,7 @@
|
|||
Orientation="Horizontal">
|
||||
<Grid Width="545">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="220" />
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
|
|
@ -123,16 +123,35 @@
|
|||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource fileManager_path}" />
|
||||
<TextBox
|
||||
x:Name="PathTextBox"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="Auto"
|
||||
Margin="10,10,15,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
IsEnabled="{Binding Editable}"
|
||||
Text="{Binding Path}" />
|
||||
<DockPanel Grid.Row="1" Grid.Column="1">
|
||||
<TextBox
|
||||
x:Name="PathTextBox"
|
||||
Width="230"
|
||||
Margin="10,10,10,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
IsEnabled="{Binding Editable}"
|
||||
Text="{Binding Path}" />
|
||||
<Button
|
||||
Name="btnBrowseFile"
|
||||
Width="80"
|
||||
Margin="0,10,15,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Click="btnBrowseFile_Click"
|
||||
Content="{DynamicResource selectPythonDirectory}"
|
||||
DockPanel.Dock="Right">
|
||||
<Button.Style>
|
||||
<Style BasedOn="{StaticResource DefaultButtonStyle}" TargetType="{x:Type Button}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ProfileTextBox, UpdateSourceTrigger=PropertyChanged, Path=IsEnabled}" Value="False">
|
||||
<Setter Property="IsEnabled" Value="False" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
</DockPanel>
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
|
|
|
|||
|
|
@ -73,5 +73,19 @@ namespace Flow.Launcher
|
|||
{
|
||||
CustomExplorers.RemoveAt(SelectedCustomExplorerIndex--);
|
||||
}
|
||||
|
||||
private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
|
||||
Nullable<bool> result = dlg.ShowDialog();
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");
|
||||
path.Text = dlg.FileName;
|
||||
path.Focus();
|
||||
((Button)sender).Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue