|
1 | 1 | <UserControl
|
2 |
| - x:Class="Flow.Launcher.Plugin.Shell.CMDSetting" |
| 2 | + x:Class="Flow.Launcher.Plugin.Shell.Views.CMDSetting" |
3 | 3 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
4 | 4 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
| 5 | + xmlns:converters="clr-namespace:Flow.Launcher.Plugin.Shell.Converters" |
5 | 6 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
6 | 7 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
| 8 | + xmlns:vm="clr-namespace:Flow.Launcher.Plugin.Shell.ViewModels" |
| 9 | + d:DataContext="{d:DesignInstance vm:ShellSettingViewModel}" |
7 | 10 | d:DesignHeight="300"
|
8 | 11 | d:DesignWidth="300"
|
9 |
| - Loaded="CMDSetting_OnLoaded" |
10 | 12 | mc:Ignorable="d">
|
| 13 | + <UserControl.Resources> |
| 14 | + <converters:CloseShellAfterPressEnabledConverter x:Key="CloseShellAfterPressEnabledConverter" /> |
| 15 | + <converters:LeaveShellOpenEnabledConverter x:Key="LeaveShellOpenEnabledConverter" /> |
| 16 | + </UserControl.Resources> |
| 17 | + |
11 | 18 | <Grid Margin="{StaticResource SettingPanelMargin}" VerticalAlignment="Top">
|
12 | 19 | <Grid.RowDefinitions>
|
13 | 20 | <RowDefinition />
|
|
23 | 30 | Grid.Row="0"
|
24 | 31 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
25 | 32 | HorizontalAlignment="Left"
|
26 |
| - Content="{DynamicResource flowlauncher_plugin_cmd_relace_winr}" /> |
| 33 | + Content="{DynamicResource flowlauncher_plugin_cmd_relace_winr}" |
| 34 | + IsChecked="{Binding Settings.ReplaceWinR, Mode=TwoWay}" /> |
27 | 35 | <CheckBox
|
28 | 36 | x:Name="CloseShellAfterPress"
|
29 | 37 | Grid.Row="1"
|
30 | 38 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
31 | 39 | HorizontalAlignment="Left"
|
32 |
| - Content="{DynamicResource flowlauncher_plugin_cmd_close_cmd_after_press}" /> |
| 40 | + Content="{DynamicResource flowlauncher_plugin_cmd_close_cmd_after_press}" |
| 41 | + IsChecked="{Binding CloseShellAfterPress, Mode=TwoWay}" |
| 42 | + IsEnabled="{Binding LeaveShellOpen, Converter={StaticResource CloseShellAfterPressEnabledConverter}, Mode=OneWay}" /> |
33 | 43 | <CheckBox
|
34 | 44 | x:Name="LeaveShellOpen"
|
35 | 45 | Grid.Row="2"
|
36 | 46 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
37 | 47 | HorizontalAlignment="Left"
|
38 |
| - Content="{DynamicResource flowlauncher_plugin_cmd_leave_cmd_open}" /> |
| 48 | + Content="{DynamicResource flowlauncher_plugin_cmd_leave_cmd_open}" |
| 49 | + IsChecked="{Binding LeaveShellOpen, Mode=TwoWay}"> |
| 50 | + <CheckBox.IsEnabled> |
| 51 | + <MultiBinding Converter="{StaticResource LeaveShellOpenEnabledConverter}"> |
| 52 | + <Binding Mode="OneWay" Path="CloseShellAfterPress" /> |
| 53 | + <Binding Mode="OneWay" Path="SelectedShell" /> |
| 54 | + </MultiBinding> |
| 55 | + </CheckBox.IsEnabled> |
| 56 | + </CheckBox> |
39 | 57 | <CheckBox
|
40 | 58 | x:Name="AlwaysRunAsAdministrator"
|
41 | 59 | Grid.Row="3"
|
42 | 60 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
43 | 61 | HorizontalAlignment="Left"
|
44 |
| - Content="{DynamicResource flowlauncher_plugin_cmd_always_run_as_administrator}" /> |
| 62 | + Content="{DynamicResource flowlauncher_plugin_cmd_always_run_as_administrator}" |
| 63 | + IsChecked="{Binding Settings.RunAsAdministrator, Mode=TwoWay}" /> |
45 | 64 | <CheckBox
|
46 | 65 | x:Name="UseWindowsTerminal"
|
47 | 66 | Grid.Row="4"
|
48 | 67 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
49 | 68 | HorizontalAlignment="Left"
|
50 |
| - Content="{DynamicResource flowlauncher_plugin_cmd_use_windows_terminal}" /> |
| 69 | + Content="{DynamicResource flowlauncher_plugin_cmd_use_windows_terminal}" |
| 70 | + IsChecked="{Binding Settings.UseWindowsTerminal, Mode=TwoWay}" /> |
51 | 71 | <ComboBox
|
52 | 72 | x:Name="ShellComboBox"
|
53 | 73 | Grid.Row="5"
|
54 | 74 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
55 |
| - HorizontalAlignment="Left"> |
56 |
| - <ComboBoxItem>CMD</ComboBoxItem> |
57 |
| - <ComboBoxItem>PowerShell</ComboBoxItem> |
58 |
| - <ComboBoxItem>Pwsh</ComboBoxItem> |
59 |
| - <ComboBoxItem>RunCommand</ComboBoxItem> |
60 |
| - </ComboBox> |
| 75 | + HorizontalAlignment="Left" |
| 76 | + DisplayMemberPath="Display" |
| 77 | + ItemsSource="{Binding AllShells, Mode=OneTime}" |
| 78 | + SelectedValue="{Binding SelectedShell, Mode=TwoWay}" |
| 79 | + SelectedValuePath="Value" /> |
61 | 80 | <StackPanel Grid.Row="6" Orientation="Horizontal">
|
62 | 81 | <CheckBox
|
63 | 82 | x:Name="ShowOnlyMostUsedCMDs"
|
64 | 83 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
65 |
| - Content="{DynamicResource flowlauncher_plugin_cmd_history}" /> |
| 84 | + Content="{DynamicResource flowlauncher_plugin_cmd_history}" |
| 85 | + IsChecked="{Binding Settings.ShowOnlyMostUsedCMDs, Mode=TwoWay}" /> |
66 | 86 | <ComboBox
|
67 | 87 | x:Name="ShowOnlyMostUsedCMDsNumber"
|
68 | 88 | Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
|
69 |
| - HorizontalAlignment="Left" /> |
| 89 | + HorizontalAlignment="Left" |
| 90 | + IsEnabled="{Binding Settings.ShowOnlyMostUsedCMDs, Mode=OneWay}" |
| 91 | + ItemsSource="{Binding OnlyMostUsedCMDsNumbers, Mode=OneTime}" |
| 92 | + SelectedItem="{Binding SelectedOnlyMostUsedCMDsNumber, Mode=TwoWay}" /> |
70 | 93 | </StackPanel>
|
71 | 94 | </Grid>
|
72 | 95 | </UserControl>
|
0 commit comments