Skip to content

Commit 7a3a777

Browse files
ferrariofilippoyaira2
authored andcommitted
Placeholder & Do not require testing
1 parent f8a52ae commit 7a3a777

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4067,4 +4067,7 @@
40674067
<data name="VisualStudioCode" xml:space="preserve">
40684068
<value>Visual Studio Code</value>
40694069
</data>
4070+
<data name="IDEPathPlaceholder" xml:space="preserve">
4071+
<value>code</value>
4072+
</data>
40704073
</root>

src/Files.App/ViewModels/Settings/DevToolsViewModel.cs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public bool IsEditingIDEConfig
3636
}
3737

3838
public bool CanSaveIDEChanges =>
39-
IsFriendlyNameValid && IsIDEPathValid && _IDEPathTested;
39+
IsFriendlyNameValid && IsIDEPathValid;
4040

4141
private bool _IsIDEPathValid;
4242
public bool IsIDEPathValid
@@ -64,7 +64,6 @@ public string IDEPath
6464
!string.IsNullOrWhiteSpace(value) &&
6565
!value.Contains('\"') &&
6666
!value.Contains('\'');
67-
IDEPathTested = false;
6867
}
6968
}
7069
}
@@ -83,17 +82,6 @@ public string IDEFriendlyName
8382
}
8483
}
8584

86-
private bool _IDEPathTested = false;
87-
public bool IDEPathTested
88-
{
89-
get => _IDEPathTested;
90-
set
91-
{
92-
if (SetProperty(ref _IDEPathTested, value))
93-
OnPropertyChanged(nameof(CanSaveIDEChanges));
94-
}
95-
}
96-
9785
public DevToolsViewModel()
9886
{
9987
// Open in IDE options
@@ -170,25 +158,24 @@ private void DoStartEditingIDE()
170158

171159
private void DoOpenFilePickerForIDE()
172160
{
173-
CommonDialogService.Open_FileOpenDialog(
161+
var res = CommonDialogService.Open_FileOpenDialog(
174162
MainWindow.Instance.WindowHandle,
175163
false,
176164
["*.exe;*.bat;*.cmd;*.ahk"],
177165
Environment.SpecialFolder.ProgramFiles,
178166
out var filePath
179167
);
180168

181-
IDEPath = filePath;
169+
if (res)
170+
IDEPath = filePath;
182171
}
183172

184173
private async void DoTestIDE()
185174
{
186-
IDEPathTested = await Win32Helper.RunPowershellCommandAsync(
175+
IsIDEPathValid = await Win32Helper.RunPowershellCommandAsync(
187176
$"& \'{IDEPath}\'",
188177
PowerShellExecutionOptions.Hidden
189178
);
190-
191-
IsIDEPathValid = _IDEPathTested;
192179
}
193180
}
194181
}

src/Files.App/Views/Settings/DevToolsPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
x:Name="IDEPathTextBox"
100100
Width="300"
101101
VerticalAlignment="Center"
102+
PlaceholderText="{helpers:ResourceString Name=IDEPathPlaceholder}"
102103
Text="{x:Bind ViewModel.IDEPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
103104
<TextBox.Resources>
104105
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="{ThemeResource SolidBackgroundFillColorSecondary}" />
@@ -112,8 +113,7 @@
112113
<Button
113114
x:Name="TestIDE"
114115
Command="{x:Bind ViewModel.TestIDECommand, Mode=OneWay}"
115-
Content="{helpers:ResourceString Name=Test}"
116-
IsEnabled="{x:Bind ViewModel.IDEPathTested, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" />
116+
Content="{helpers:ResourceString Name=Test}" />
117117
</StackPanel>
118118

119119
<Grid

0 commit comments

Comments
 (0)